[kune-commits] r1087 - in trunk: .
src/main/java/org/ourproject/kune/app
src/main/java/org/ourproject/kune/platf/client/services
src/main/java/org/ourproject/kune/platf/client/ui/rte/basic
src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg
src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg
src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext
src/main/java/org/ourproject/kune/workspace/client
src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg
vjrj
vjrj at ourproject.org
Wed Mar 25 18:15:13 CET 2009
Author: vjrj
Date: 2009-03-25 18:15:09 +0100 (Wed, 25 Mar 2009)
New Revision: 1087
Modified:
trunk/pom.xml
trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml
trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractView.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/InsertImageExtPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalPanel.java
Log:
Incomplete - task RTE: Create Image
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-03-24 14:25:48 UTC (rev 1086)
+++ trunk/pom.xml 2009-03-25 17:15:09 UTC (rev 1087)
@@ -53,6 +53,11 @@
</dependency>
-->
<dependency>
+ <groupId>org.cobogw</groupId>
+ <artifactId>gwt</artifactId>
+ <version>1.2.2</version>
+ </dependency>
+ <dependency>
<groupId>com.gwtext</groupId>
<artifactId>gwtext</artifactId>
<version>2.0.5</version>
Modified: trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml 2009-03-24 14:25:48 UTC (rev 1086)
+++ trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml 2009-03-25 17:15:09 UTC (rev 1087)
@@ -18,6 +18,8 @@
<inherits name='org.ourproject.kune.chat.Kune-Chat' />
<inherits name='org.ourproject.kune.gallery.Kune-Gallery' />
+ <inherits name='org.cobogw.gwt.user.User' />
+
<!-- gwt-ext -->
<inherits name='com.gwtext.GwtExt' />
<script src="js/ext/adapter/ext/ext-base.js" />
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java 2009-03-24 14:25:48 UTC (rev 1086)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java 2009-03-25 17:15:09 UTC (rev 1087)
@@ -328,8 +328,8 @@
RTEActionTopToolbar topBar = $(RTEActionTopToolbar.class);
RTEActionSndToolbar sndBar = $(RTEActionSndToolbar.class);
final RTEditorPresenter presenter = new RTEditorPresenter($(I18nTranslationService.class),
- $(Session.class), topBar, sndBar, $(RTEImgResources.class), $(InsertLinkDialog.class),
- $(ColorWebSafePalette.class), $$(EditHtmlDialog.class), $$(InsertImageDialog.class),
+ $(Session.class), topBar, sndBar, $(RTEImgResources.class), $$(InsertLinkDialog.class),
+ $$(ColorWebSafePalette.class), $$(EditHtmlDialog.class), $$(InsertImageDialog.class),
$$(InsertTableDialog.class), $$(InsertSpecialCharDialog.class), $(DeferredCommandWrapper.class));
final RTEditorPanel panel = new RTEditorPanel(presenter, $(I18nUITranslationService.class),
$(ActionManager.class), $(GlobalShortcutRegister.class));
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2009-03-24 14:25:48 UTC (rev 1086)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2009-03-25 17:15:09 UTC (rev 1087)
@@ -22,6 +22,7 @@
import org.ourproject.kune.platf.client.ui.rte.RichTextArea;
import org.ourproject.kune.platf.client.ui.rte.edithtml.EditHtmlDialog;
import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.ImageInfo;
import org.ourproject.kune.platf.client.ui.rte.insertimg.InsertImageDialog;
import org.ourproject.kune.platf.client.ui.rte.insertlink.InsertLinkDialog;
import org.ourproject.kune.platf.client.ui.rte.insertlink.LinkInfo;
@@ -63,31 +64,33 @@
private ActionToolbarPushButtonDescriptor<Object> underline;
private ActionToolbarPushButtonDescriptor<Object> strikethrough;
private final Event0 onEdit;
- private final InsertLinkDialog insertElement;
- private final ColorWebSafePalette palette;
private final DeferredCommandWrapper deferred;
private final ActionAddCondition<Object> canBeBasic;
private final ActionAddCondition<Object> canBeExtended;
+ private final Provider<ColorWebSafePalette> palette;
+ private final Provider<InsertLinkDialog> insertLinkDialog;
private final Provider<EditHtmlDialog> editHtmlDialog;
private final Provider<InsertImageDialog> insertImageDialog;
private final Provider<InsertTableDialog> insertTableDialog;
private Listener<String> insertTableListener;
private Listener<LinkInfo> insertLinkListener;
+ private Listener<ImageInfo> insertImageListener;
private Listener<String> updateHtmlListener;
private ActionToolbarButtonDescriptor<Object> insertTableBtn;
private final Provider<InsertSpecialCharDialog> insertSpecialCharDialog;
protected Listener<String> insertSpecialCharListener;
public RTEditorPresenter(I18nTranslationService i18n, Session session, RTEActionTopToolbar topBar,
- RTEActionSndToolbar sndBar, RTEImgResources imgResources, InsertLinkDialog textEditorInsertElement,
- ColorWebSafePalette palette, Provider<EditHtmlDialog> editHtmlDialog,
- Provider<InsertImageDialog> insertImageDialog, Provider<InsertTableDialog> insertTableDialog,
- Provider<InsertSpecialCharDialog> insertSpecialCharDialog, DeferredCommandWrapper deferred) {
+ RTEActionSndToolbar sndBar, RTEImgResources imgResources,
+ Provider<InsertLinkDialog> textEditorInsertElement, Provider<ColorWebSafePalette> palette,
+ Provider<EditHtmlDialog> editHtmlDialog, Provider<InsertImageDialog> insertImageDialog,
+ Provider<InsertTableDialog> insertTableDialog, Provider<InsertSpecialCharDialog> insertSpecialCharDialog,
+ DeferredCommandWrapper deferred) {
this.i18n = i18n;
this.session = session;
this.topBar = topBar;
this.sndBar = sndBar;
- this.insertElement = textEditorInsertElement;
+ this.insertLinkDialog = textEditorInsertElement;
this.palette = palette;
this.editHtmlDialog = editHtmlDialog;
this.insertImageDialog = insertImageDialog;
@@ -182,7 +185,7 @@
public void onEditorFocus() {
topBar.hideAllMenus();
sndBar.hideAllMenus();
- palette.hide();
+ palette.get().hide();
}
public void setExtended(boolean extended) {
@@ -215,8 +218,8 @@
}
private void createBasicActions() {
- ActionToolbarMenuDescriptor<Object> selectAll = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
- new Listener0() {
+ ActionToolbarMenuDescriptor<Object> selectAll = new ActionToolbarMenuDescriptor<Object>(accessRol,
+ topbarPosition, new Listener0() {
public void onEvent() {
view.selectAll();
}
@@ -263,8 +266,8 @@
underline.setShortcut(new ShortcutDescriptor(true, 'U'));
underline.setAddCondition(canBeBasic);
- ActionToolbarMenuDescriptor<Object> subscript = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
- new Listener0() {
+ ActionToolbarMenuDescriptor<Object> subscript = new ActionToolbarMenuDescriptor<Object>(accessRol,
+ topbarPosition, new Listener0() {
public void onEvent() {
view.toggleSubscript();
fireOnEdit();
@@ -276,8 +279,8 @@
subscript.setShortcut(new ShortcutDescriptor(true, 188, ","));
subscript.setAddCondition(canBeBasic);
- ActionToolbarMenuDescriptor<Object> superscript = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
- new Listener0() {
+ ActionToolbarMenuDescriptor<Object> superscript = new ActionToolbarMenuDescriptor<Object>(accessRol,
+ topbarPosition, new Listener0() {
public void onEvent() {
view.toggleSuperscript();
fireOnEdit();
@@ -352,8 +355,8 @@
redo.setBottomSeparator(true);
redo.setIconCls(getCssName(imgResources.redo()));
- ActionToolbarButtonDescriptor<Object> undoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition,
- new Listener0() {
+ ActionToolbarButtonDescriptor<Object> undoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol,
+ sndbarPosition, new Listener0() {
public void onEvent() {
view.undo();
fireOnEdit();
@@ -364,8 +367,8 @@
undoBtn.setIconCls(getCssName(imgResources.undo()));
undoBtn.setPosition(0);
- ActionToolbarButtonDescriptor<Object> redoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition,
- new Listener0() {
+ ActionToolbarButtonDescriptor<Object> redoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol,
+ sndbarPosition, new Listener0() {
public void onEvent() {
view.redo();
fireOnEdit();
@@ -415,8 +418,8 @@
paste.setAddCondition(canBeExtended);
paste.setIconCls(getCssName(imgResources.paste()));
- ActionToolbarMenuDescriptor<Object> editHtml = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
- new Listener0() {
+ ActionToolbarMenuDescriptor<Object> editHtml = new ActionToolbarMenuDescriptor<Object>(accessRol,
+ topbarPosition, new Listener0() {
public void onEvent() {
if (updateHtmlListener == null) {
@@ -438,8 +441,8 @@
editHtml.setParentMenuTitle(i18n.t(EDIT_MENU));
editHtml.setAddCondition(canBeExtended);
- ActionToolbarMenuDescriptor<Object> comment = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
- new Listener0() {
+ ActionToolbarMenuDescriptor<Object> comment = new ActionToolbarMenuDescriptor<Object>(accessRol,
+ topbarPosition, new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
public void onEvent() {
@@ -495,8 +498,8 @@
hr.setParentMenuTitle(i18n.t(INSERT_MENU));
hr.setAddCondition(canBeExtended);
- ActionToolbarMenuDescriptor<Object> blockquote = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
- new Listener0() {
+ ActionToolbarMenuDescriptor<Object> blockquote = new ActionToolbarMenuDescriptor<Object>(accessRol,
+ topbarPosition, new Listener0() {
public void onEvent() {
view.focus();
view.insertBlockquote();
@@ -507,8 +510,8 @@
blockquote.setParentMenuTitle(i18n.t(FORMAT_MENU));
blockquote.setAddCondition(canBeExtended);
- ActionToolbarButtonDescriptor<Object> hrButton = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition,
- new Listener0() {
+ ActionToolbarButtonDescriptor<Object> hrButton = new ActionToolbarButtonDescriptor<Object>(accessRol,
+ sndbarPosition, new Listener0() {
public void onEvent() {
view.focus();
view.insertHorizontalRule();
@@ -577,10 +580,29 @@
ul.setRightSeparator(ActionToolbarButtonSeparator.separator);
ul.setAddCondition(canBeExtended);
- ActionToolbarButtonDescriptor<Object> imgBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition,
- new Listener0() {
+ ActionToolbarButtonDescriptor<Object> imgBtn = new ActionToolbarButtonDescriptor<Object>(accessRol,
+ sndbarPosition, new Listener0() {
public void onEvent() {
- insertImageDialog.get().show();
+ deferred.addCommand(new Listener0() {
+ public void onEvent() {
+ if (insertImageListener == null) {
+ insertImageListener = new Listener<ImageInfo>() {
+ public void onEvent(ImageInfo imageInfo) {
+ String img = imageInfo.toString();
+ Log.debug("Image: " + imageInfo);
+ view.focus();
+ view.insertHtml(img);
+ fireOnEdit();
+ }
+ };
+ }
+ InsertImageDialog dialog = insertImageDialog.get();
+ dialog.setImageInfo(new ImageInfo("", true, ImageInfo.POSITION_LEFT,
+ ImageInfo.SIZE_ORIGINAL));
+ dialog.setOnCreateImage(insertImageListener);
+ dialog.show();
+ }
+ });
}
});
imgBtn.setIconCls(getCssName(imgResources.images()));
@@ -596,33 +618,31 @@
ActionToolbarButtonDescriptor<Object> createOrEditLinkBtn = new ActionToolbarButtonDescriptor<Object>(
accessRol, sndbarPosition, new Listener0() {
public void onEvent() {
- deferred.addCommand(new Listener0() {
- public void onEvent() {
- if (insertLinkListener == null) {
- insertLinkListener = new Listener<LinkInfo>() {
- public void onEvent(LinkInfo linkInfo) {
- String link = linkInfo.toString();
- Log.debug("Link: " + link);
- view.focus();
- view.insertHtml(link);
- fireOnEdit();
- }
- };
+ if (insertLinkListener == null) {
+ insertLinkListener = new Listener<LinkInfo>() {
+ public void onEvent(LinkInfo linkInfo) {
+ String link = linkInfo.toString();
+ Log.debug("Link: " + link);
+ view.focus();
+ view.insertHtml(link);
+ fireOnEdit();
}
- LinkInfo linkInfo = view.getLinkInfoIfHref();
- insertElement.setLinkInfo(linkInfo);
- insertElement.setOnCreateLink(insertLinkListener);
- insertElement.show();
- String href = linkInfo.getHref();
- if (href.length() > 0) {
- if (href.startsWith("mailto")) {
- insertElement.activateTab(2);
- } else {
- insertElement.activateTab(1);
- }
- }
+ };
+ }
+ LinkInfo linkInfo = view.getLinkInfoIfHref();
+ InsertLinkDialog dialog = insertLinkDialog.get();
+ dialog.setLinkInfo(linkInfo);
+ dialog.setOnCreateLink(insertLinkListener);
+ dialog.show();
+ String href = linkInfo.getHref();
+ if (href.length() > 0) {
+ if (href.startsWith("mailto")) {
+ dialog.activateTab(2);
+ } else {
+ dialog.activateTab(1);
}
- });
+ }
+
}
});
createOrEditLinkBtn.setIconCls(getCssName(imgResources.link()));
@@ -638,8 +658,8 @@
createOrEditLink.setActionPosition(topbarPosition);
createOrEditLink.setParentMenuTitle(i18n.t(INSERT_MENU));
- ActionToolbarButtonDescriptor<Object> removeLink = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition,
- new Listener0() {
+ ActionToolbarButtonDescriptor<Object> removeLink = new ActionToolbarButtonDescriptor<Object>(accessRol,
+ sndbarPosition, new Listener0() {
public void onEvent() {
view.unlink();
fireOnEdit();
@@ -734,14 +754,14 @@
final ActionToolbarButtonDescriptor<Object> fontColor = new ActionToolbarButtonDescriptor<Object>(accessRol,
sndbarPosition, new Listener0() {
public void onEvent() {
- palette.show(getActionLeftPosition(sndBar, insertTableBtn), getActionTopPosition(sndBar,
- removeFormatBtn), new Listener<String>() {
- public void onEvent(String color) {
- palette.hide();
- view.setForeColor(color);
- fireOnEdit();
- }
- });
+ palette.get().show(getActionLeftPosition(sndBar, insertTableBtn),
+ getActionTopPosition(sndBar, removeFormatBtn), new Listener<String>() {
+ public void onEvent(String color) {
+ palette.get().hide();
+ view.setForeColor(color);
+ fireOnEdit();
+ }
+ });
}
});
fontColor.setIconCls(getCssName(imgResources.fontcolor()));
@@ -751,10 +771,10 @@
ActionToolbarButtonDescriptor<Object> backgroundColor = new ActionToolbarButtonDescriptor<Object>(accessRol,
sndbarPosition, new Listener0() {
public void onEvent() {
- palette.show(getActionLeftPosition(sndBar, fontColor), getActionTopPosition(sndBar, fontColor),
- new Listener<String>() {
+ palette.get().show(getActionLeftPosition(sndBar, fontColor),
+ getActionTopPosition(sndBar, fontColor), new Listener<String>() {
public void onEvent(String color) {
- palette.hide();
+ palette.get().hide();
view.setBackColor(color);
fireOnEdit();
}
@@ -765,8 +785,8 @@
backgroundColor.setToolTip(i18n.t("Text Background Colour"));
backgroundColor.setAddCondition(canBeBasic);
- final ActionToolbarMenuDescriptor<Object> devInfo = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
- new Listener0() {
+ final ActionToolbarMenuDescriptor<Object> devInfo = new ActionToolbarMenuDescriptor<Object>(accessRol,
+ topbarPosition, new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
public void onEvent() {
@@ -836,8 +856,8 @@
private ActionToolbarMenuDescriptor<Object> createFontNameAction(ActionAddCondition<Object> canBeBasic,
final String fontName) {
- final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol, sndbarPosition,
- new Listener0() {
+ final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol,
+ sndbarPosition, new Listener0() {
public void onEvent() {
view.setFontName(fontName);
fireOnEdit();
@@ -852,8 +872,8 @@
private ActionToolbarMenuDescriptor<Object> createFontSizeAction(ActionAddCondition<Object> canBeBasic,
final int fontSize, String fontSizeName) {
- final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol, sndbarPosition,
- new Listener0() {
+ final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol,
+ sndbarPosition, new Listener0() {
public void onEvent() {
view.setFontSize(fontSizesConstants[fontSize]);
fireOnEdit();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java 2009-03-24 14:25:48 UTC (rev 1086)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java 2009-03-25 17:15:09 UTC (rev 1087)
@@ -1,31 +1,59 @@
package org.ourproject.kune.platf.client.ui.rte.insertimg;
+import org.cobogw.gwt.user.client.CSS;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.user.client.DOM;
+
public class ImageInfo {
- public static String[][] positions = { new String[] { "left" }, new String[] { "center" }, new String[] { "right" } };
+ public static final String SIZE_ORIGINAL = "original";
+ public static final String SIZE_FIT = "fit";
+ public static final String SIZE_XS = "xs";
+ public static final String SIZE_S = "s";
+ public static final String SIZE_M = "m";
+ public static final String SIZE_L = "l";
+ public static final String SIZE_XL = "xl";
+ public static final String POSITION_LEFT = "left";
+ public static final String POSITION_CENTER = "center";
+ public static final String POSITION_RIGHT = "right";
- public static String[][] sizes = { new String[] { "original", "Original image size", "" },
- new String[] { "fit", "Fit page width", "100%" },
- new String[] { "xs", "Thumbnail, up to 160 pixels wide", "160px" },
- new String[] { "s", "Small, up to 320 pixels wide", "320px" },
- new String[] { "m", "Medium, up to 640 pixels wide", "640px" },
- new String[] { "l", "Large, up to 1024 pixels wide", "1024px" },
- new String[] { "xl", "Extra large, up to 1600 pixels wide", "1600px" } };
+ public static String[][] positions = { new String[] { POSITION_LEFT }, new String[] { POSITION_CENTER },
+ new String[] { POSITION_RIGHT } };
- private String href;
+ public static String[][] sizes = { new String[] { SIZE_ORIGINAL, "Original image size", "" },
+ new String[] { SIZE_FIT, "Fit page width", "100%" },
+ new String[] { SIZE_XS, "Thumbnail, up to 160 pixels wide", "160px" },
+ new String[] { SIZE_S, "Small, up to 320 pixels wide", "320px" },
+ new String[] { SIZE_M, "Medium, up to 640 pixels wide", "640px" },
+ new String[] { SIZE_L, "Large, up to 1024 pixels wide", "1024px" },
+ new String[] { SIZE_XL, "Extra large, up to 1600 pixels wide", "1600px" } };
+
+ private String src;
private boolean wraptext;
private String position;
private String size;
- public ImageInfo(String href, boolean wraptext, String position, String size) {
- this.href = href;
+ public ImageInfo(String src, boolean wraptext, String position, String size) {
+ this.src = src;
this.wraptext = wraptext;
this.setPosition(position);
this.setSize(size);
}
- public String getHref() {
- return href;
+ public Element getElement() {
+ com.google.gwt.user.client.Element img = DOM.createImg();
+ DOM.setElementProperty(img, "src", src);
+ CSS.setProperty(img, CSS.A.WIDTH, getStyleSize());
+ if (!wraptext || position.equals(POSITION_CENTER)) {
+ com.google.gwt.user.client.Element divEl = DOM.createDiv();
+ CSS.setProperty(divEl, CSS.A.TEXT_ALIGN, position);
+ divEl.setInnerHTML(img.getString());
+ return divEl;
+ } else {
+ CSS.setProperty(img, CSS.A.FLOAT, position);
+ return img;
+ }
}
public String getPosition() {
@@ -36,14 +64,14 @@
return size;
}
+ public String getSrc() {
+ return src;
+ }
+
public boolean isWraptext() {
return wraptext;
}
- public void setHref(String href) {
- this.href = href;
- }
-
public void setPosition(String position) {
this.position = position;
}
@@ -52,8 +80,26 @@
this.size = size;
}
+ public void setSrc(String src) {
+ this.src = src;
+ }
+
public void setWraptext(boolean wraptext) {
this.wraptext = wraptext;
}
+ @Override
+ public String toString() {
+ Element element = getElement();
+ return element.getString();
+ }
+
+ private String getStyleSize() {
+ for (String[] current : sizes) {
+ if (current[1].equals(size)) {
+ return current[2];
+ }
+ }
+ return "";
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPanel.java 2009-03-24 14:25:48 UTC (rev 1086)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPanel.java 2009-03-25 17:15:09 UTC (rev 1087)
@@ -5,6 +5,7 @@
import org.ourproject.kune.platf.client.ui.rte.insertimg.ImageInfo;
import org.ourproject.kune.platf.client.ui.rte.insertimg.InsertImageDialogView;
+import com.gwtext.client.data.Record;
import com.gwtext.client.data.SimpleStore;
import com.gwtext.client.data.Store;
import com.gwtext.client.widgets.Component;
@@ -12,6 +13,7 @@
import com.gwtext.client.widgets.form.Checkbox;
import com.gwtext.client.widgets.form.ComboBox;
import com.gwtext.client.widgets.form.FieldSet;
+import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
import com.gwtext.client.widgets.form.event.FormPanelListenerAdapter;
public class InsertImageAbstractPanel extends DefaultForm implements InsertImageAbstractView {
@@ -36,9 +38,17 @@
sizeCombo = createCombo(storeSizes, Resources.i18n.t("Size"));
positionCombo = createCombo(storePositions, Resources.i18n.t("Position"));
- wrapText = new Checkbox(Resources.i18n.t("Open link in new window"));
+ wrapText = new Checkbox(Resources.i18n.t("Wrap text around image"));
wrapText.setChecked(false);
+ positionCombo.addListener(new ComboBoxListenerAdapter() {
+ @Override
+ public void onSelect(ComboBox comboBox, Record record, int index) {
+ String pos = record.getAsString("abbr");
+ setWrapVisible(pos);
+ }
+ });
+
super.addListener(new FormPanelListenerAdapter() {
@Override
public void onActivate(Panel panel) {
@@ -59,18 +69,18 @@
add(advanced);
}
- public String getHref() {
- return null;
- }
-
public String getPosition() {
- return positionCombo.getValue();
+ return positionCombo.getValueAsString();
}
public String getSize() {
- return sizeCombo.getValue();
+ return sizeCombo.getValueAsString();
}
+ public String getSrc() {
+ return null;
+ }
+
@Override
public void insert(int index, Component component) {
super.insert(index, component);
@@ -82,14 +92,15 @@
protected void updateValues(ImageInfo imageInfo) {
sizeCombo.setValue(imageInfo.getSize());
- positionCombo.setValue(imageInfo.getPosition());
- if (wrapText.isVisible()) {
- wrapText.setChecked(imageInfo.isWraptext());
- }
+ String position = imageInfo.getPosition();
+ positionCombo.setValue(position);
+ wrapText.setChecked(imageInfo.isWraptext());
+ setWrapVisible(position);
}
private ComboBox createCombo(final Store storeSizes, String title) {
ComboBox cb = new ComboBox();
+ cb.setEditable(false);
cb.setForceSelection(true);
cb.setMinChars(1);
cb.setFieldLabel(title);
@@ -97,14 +108,14 @@
cb.setDisplayField("trans");
cb.setMode(ComboBox.LOCAL);
cb.setTriggerAction(ComboBox.ALL);
- // cb.setEmptyText("Enter state");
- // cb.setLoadingText("Searching...");
cb.setTypeAhead(true);
cb.setSelectOnFocus(true);
cb.setWidth(DEF_FIELD_WIDTH);
cb.setHideTrigger(false);
cb.setAllowBlank(false);
cb.setValidationEvent(false);
+ cb.setListWidth(DEF_FIELD_WIDTH + 30);
+ cb.setResizable(true);
return cb;
}
@@ -134,4 +145,12 @@
return sizesObjs;
}
+ private void setWrapVisible(String position) {
+ if (position.equals(ImageInfo.POSITION_CENTER)) {
+ wrapText.setVisible(false);
+ } else {
+ wrapText.setVisible(true);
+ }
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPresenter.java 2009-03-24 14:25:48 UTC (rev 1086)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPresenter.java 2009-03-25 17:15:09 UTC (rev 1087)
@@ -66,7 +66,7 @@
}
protected ImageInfo updateImageInfo() {
- return new ImageInfo(view.getHref(), view.wrapText(), view.getPosition(), view.getSize());
+ return new ImageInfo(view.getSrc(), view.wrapText(), view.getPosition(), view.getSize());
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractView.java 2009-03-24 14:25:48 UTC (rev 1086)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractView.java 2009-03-25 17:15:09 UTC (rev 1087)
@@ -4,12 +4,12 @@
public interface InsertImageAbstractView extends View {
- String getHref();
-
String getPosition();
String getSize();
+ String getSrc();
+
boolean isValid();
void reset();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/InsertImageExtPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/InsertImageExtPanel.java 2009-03-24 14:25:48 UTC (rev 1086)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/InsertImageExtPanel.java 2009-03-25 17:15:09 UTC (rev 1087)
@@ -15,25 +15,25 @@
public class InsertImageExtPanel extends InsertImageAbstractPanel implements InsertImageExtView {
private static final String LINK_FIELD = "iiep-img-field";
- private final TextField linkField;
+ private final TextField srcField;
private final Panel previewPanel;
public InsertImageExtPanel(final InsertImageExtPresenter presenter, I18nTranslationService i18n) {
super(i18n.t("External image"), presenter);
- linkField = new TextField();
- linkField.setTabIndex(1);
- linkField.setFieldLabel(i18n.t("External image link (URL)"));
- linkField.setRegex(TextUtils.URL_REGEXP);
- linkField.setRegexText(i18n.t("The link should be a URL in the format 'http://www.domain.com'"));
- linkField.setName(LINK_FIELD);
- linkField.setWidth(DEF_FIELD_WIDTH);
- linkField.setAllowBlank(false);
- linkField.setMinLength(3);
- linkField.setMaxLength(250);
- linkField.setValidationEvent(false);
- linkField.setId(LINK_FIELD);
- add(linkField);
+ srcField = new TextField();
+ srcField.setTabIndex(1);
+ srcField.setFieldLabel(i18n.t("External image link (URL)"));
+ srcField.setRegex(TextUtils.URL_REGEXP);
+ srcField.setRegexText(i18n.t("The link should be a URL in the format 'http://www.domain.com'"));
+ srcField.setName(LINK_FIELD);
+ srcField.setWidth(DEF_FIELD_WIDTH);
+ srcField.setAllowBlank(false);
+ srcField.setMinLength(3);
+ srcField.setMaxLength(250);
+ srcField.setValidationEvent(false);
+ srcField.setId(LINK_FIELD);
+ insert(0, srcField);
previewPanel = new Panel();
previewPanel.setLayout(new FitLayout());
previewPanel.setHeight(125);
@@ -46,6 +46,10 @@
}
});
addButton(preview);
+ }
+ @Override
+ public String getSrc() {
+ return srcField.getValueAsString();
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java 2009-03-24 14:25:48 UTC (rev 1086)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java 2009-03-25 17:15:09 UTC (rev 1087)
@@ -384,7 +384,7 @@
protected ActionToolbarMenuDescriptor<StateToken> createRefreshCntAction(String parentMenuTitle,
String... registerInTypes) {
final ActionToolbarMenuDescriptor<StateToken> refreshCnt = new ActionToolbarMenuDescriptor<StateToken>(
- AccessRolDTO.Viewer, CONTENT_TOPBAR, new Listener<StateToken>() {
+ AccessRolDTO.Editor, CONTENT_TOPBAR, new Listener<StateToken>() {
public void onEvent(final StateToken stateToken) {
stateManager.reload();
contextNavigator.selectItem(stateToken);
@@ -401,7 +401,7 @@
protected ActionToolbarMenuDescriptor<StateToken> createRefreshCxtAction(String parentMenuTitleCtx,
String... registerInTypes) {
final ActionToolbarMenuDescriptor<StateToken> refreshCtx = new ActionToolbarMenuDescriptor<StateToken>(
- AccessRolDTO.Viewer, CONTEXT_TOPBAR, new Listener<StateToken>() {
+ AccessRolDTO.Editor, CONTEXT_TOPBAR, new Listener<StateToken>() {
public void onEvent(final StateToken stateToken) {
stateManager.reload();
contextNavigator.selectItem(stateToken);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalPanel.java 2009-03-24 14:25:48 UTC (rev 1086)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalPanel.java 2009-03-25 17:15:09 UTC (rev 1087)
@@ -1,12 +1,16 @@
package org.ourproject.kune.workspace.client.editor.insertlocalimg;
import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
+import org.ourproject.kune.platf.client.ui.TextUtils;
import org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg.InsertImageAbstractPanel;
+import com.gwtext.client.widgets.form.Label;
+
public class InsertImageLocalPanel extends InsertImageAbstractPanel implements InsertImageLocalView {
public InsertImageLocalPanel(final InsertImageLocalPresenter presenter, I18nTranslationService i18n) {
super(i18n.t("Local image"), presenter);
+ insert(0, new Label(TextUtils.IN_DEVELOPMENT));
}
}
More information about the kune-commits
mailing list