[kune-commits] r1086 - in trunk/src/main/java/org/ourproject/kune:
platf/client/actions platf/client/ui/rte/basic
platf/client/ui/rte/insertimg
platf/client/ui/rte/insertimg/abstractimg
platf/client/ui/rte/insertimg/ext
platf/client/ui/rte/insertlink platf/client/ui/rte/saving
workspace/client/editor workspace/client/editor/insertlocalimg
vjrj
vjrj at ourproject.org
Tue Mar 24 15:25:51 CET 2009
Author: vjrj
Date: 2009-03-24 15:25:48 +0100 (Tue, 24 Mar 2009)
New Revision: 1086
Added:
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/
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstract.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
Modified:
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionManager.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.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/InsertImageDialog.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogView.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageGroup.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/InsertImageExt.java
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/InsertImageExtPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/InsertImageExtView.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocal.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalView.java
Log:
Complete - task RTE Create/Edit link improved
Incomplete - task Create/Edit Image
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -61,7 +61,7 @@
private final Listener<T> onPerformCall;
/** The on not confirmed. */
- private final Listener<T> onNotConfirmed;
+ private Listener<T> onNotConfirmed;
/** The must be authenticated. */
private boolean mustBeAuthenticated;
@@ -141,6 +141,24 @@
this.enableCondition = enableCondition;
}
+ public ActionDescriptor(ActionDescriptor<T> copy) {
+ this(copy.getAccessRol(), copy.getOnPerformCall());
+ setAddCondition(copy.getAddCondition());
+ setConfirmationText(copy.getConfirmationText());
+ setConfirmationTitle(copy.getConfirmationTitle());
+ setEnableCondition(copy.getEnableCondition());
+ setIconCls(copy.getIconCls());
+ setIconDescriptor(copy.getIconDescriptor());
+ setIconUrl(copy.getIconUrl());
+ setMustBeAuthenticated(copy.mustBeAuthenticated());
+ setMustBeConfirmed(copy.mustBeConfirmed());
+ setOnNotConfirmed(copy.getOnNotConfirmed());
+ setPosition(copy.getPosition());
+ setShortcut(copy.getShortcut());
+ setTextDescription(copy.getTextDescription());
+ setToolTip(copy.getToolTip());
+ }
+
/**
* Fire on not confirmed.
*
@@ -262,15 +280,6 @@
return shortcut != null;
}
- /**
- * Checks if is must be confirmed.
- *
- * @return true, if is must be confirmed
- */
- public boolean isMustBeConfirmed() {
- return mustBeConfirmed;
- }
-
public boolean mustBeAdded(T item) {
return addCondition != null ? addCondition.mustBeAdded(item) : true;
}
@@ -284,6 +293,15 @@
return mustBeAuthenticated;
}
+ /**
+ * Checks if is must be confirmed.
+ *
+ * @return true, if is must be confirmed
+ */
+ public boolean mustBeConfirmed() {
+ return mustBeConfirmed;
+ }
+
public boolean mustBeEnabled(T item) {
return enableCondition != null ? enableCondition.mustBeEnabled(item) : true;
}
@@ -424,4 +442,29 @@
public void setToolTip(final String toolTip) {
this.toolTip = toolTip;
}
+
+ private ActionAddCondition<T> getAddCondition() {
+ return addCondition;
+ }
+
+ private ActionEnableCondition<T> getEnableCondition() {
+ return enableCondition;
+ }
+
+ private Listener<T> getOnNotConfirmed() {
+ return onNotConfirmed;
+ }
+
+ private Listener<T> getOnPerformCall() {
+ return onPerformCall;
+ }
+
+ private String getTextDescription() {
+ return textDescription;
+ }
+
+ private void setOnNotConfirmed(Listener<T> onNotConfirmed) {
+ this.onNotConfirmed = onNotConfirmed;
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionManager.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionManager.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -31,7 +31,7 @@
public void doAction(final ActionItem<?> actionItem) {
final ActionDescriptor<?> action = actionItem.getAction();
final Object item = actionItem.getItem();
- if (action.isMustBeConfirmed()) {
+ if (action.mustBeConfirmed()) {
NotifyUser.askConfirmation(action.getConfirmationTitle(), action.getConfirmationText(), new Listener0() {
public void onEvent() {
fire(action, item);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -63,6 +63,10 @@
super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
}
+ public ActionToolbarButtonDescriptor(ActionDescriptor<T> copy) {
+ super(copy);
+ }
+
public ActionToolbarButtonSeparator getLeftSeparator() {
return leftSeparator;
}
@@ -86,4 +90,5 @@
public void setRightSeparator(final ActionToolbarButtonSeparator rightSeparator) {
this.rightSeparator = rightSeparator;
}
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -64,6 +64,15 @@
this.actionToolbarPosition = actionToolbarPosition;
}
+ public ActionToolbarDescriptor(ActionDescriptor<T> copy) {
+ super(copy);
+ }
+
+ public ActionToolbarDescriptor(ActionToolbarDescriptor<T> copy) {
+ super(copy);
+ setActionPosition(copy.getActionPosition());
+ }
+
public ActionToolbarPosition getActionPosition() {
return actionToolbarPosition;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -69,6 +69,10 @@
super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
}
+ public ActionToolbarMenuDescriptor(ActionDescriptor<T> copy) {
+ super(copy);
+ }
+
public String getParentMenuIconCls() {
return parentMenuIconCls;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -11,8 +11,8 @@
public interface RTEditor {
- public final ActionToolbarPosition topbar = new ActionToolbarPosition("rte-topbar");
- public final ActionToolbarPosition sndbar = new ActionToolbarPosition("rte-sndbar");;
+ public final ActionToolbarPosition topbarPosition = new ActionToolbarPosition("rte-topbar");
+ public final ActionToolbarPosition sndbarPosition = new ActionToolbarPosition("rte-sndbar");;
void addAction(ActionDescriptor<Object> action);
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-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -132,8 +132,8 @@
public void attach() {
topBar.clear();
sndBar.clear();
- topBar.addActions(actions, topbar);
- sndBar.addActions(actions, sndbar);
+ topBar.addActions(actions, topbarPosition);
+ sndBar.addActions(actions, sndbarPosition);
view.addActions(actions);
}
@@ -215,7 +215,7 @@
}
private void createBasicActions() {
- ActionToolbarMenuDescriptor<Object> selectAll = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar,
+ ActionToolbarMenuDescriptor<Object> selectAll = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
new Listener0() {
public void onEvent() {
view.selectAll();
@@ -229,7 +229,7 @@
selectAll.setTopSeparator(true);
selectAll.setBottomSeparator(true);
- bold = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbar, new Listener0() {
+ bold = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbarPosition, new Listener0() {
public void onEvent() {
view.toggleBold();
fireOnEdit();
@@ -240,7 +240,7 @@
bold.setShortcut(new ShortcutDescriptor(true, 'B'));
bold.setAddCondition(canBeBasic);
- italic = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbar, new Listener0() {
+ italic = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbarPosition, new Listener0() {
public void onEvent() {
view.toggleItalic();
fireOnEdit();
@@ -252,7 +252,7 @@
italic.setAddCondition(canBeBasic);
italic.setAddCondition(canBeBasic);
- underline = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbar, new Listener0() {
+ underline = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbarPosition, new Listener0() {
public void onEvent() {
view.toggleUnderline();
fireOnEdit();
@@ -263,7 +263,7 @@
underline.setShortcut(new ShortcutDescriptor(true, 'U'));
underline.setAddCondition(canBeBasic);
- ActionToolbarMenuDescriptor<Object> subscript = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar,
+ ActionToolbarMenuDescriptor<Object> subscript = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
new Listener0() {
public void onEvent() {
view.toggleSubscript();
@@ -276,7 +276,7 @@
subscript.setShortcut(new ShortcutDescriptor(true, 188, ","));
subscript.setAddCondition(canBeBasic);
- ActionToolbarMenuDescriptor<Object> superscript = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar,
+ ActionToolbarMenuDescriptor<Object> superscript = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
new Listener0() {
public void onEvent() {
view.toggleSuperscript();
@@ -290,7 +290,7 @@
superscript.setAddCondition(canBeBasic);
ActionToolbarButtonDescriptor<Object> justifyLeft = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbar, new Listener0() {
+ sndbarPosition, new Listener0() {
public void onEvent() {
view.justifyLeft();
fireOnEdit();
@@ -302,7 +302,7 @@
justifyLeft.setAddCondition(canBeBasic);
ActionToolbarButtonDescriptor<Object> justifyCentre = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbar, new Listener0() {
+ sndbarPosition, new Listener0() {
public void onEvent() {
view.justifyCenter();
fireOnEdit();
@@ -314,7 +314,7 @@
justifyCentre.setAddCondition(canBeBasic);
ActionToolbarButtonDescriptor<Object> justifyRight = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbar, new Listener0() {
+ sndbarPosition, new Listener0() {
public void onEvent() {
view.justifyRight();
fireOnEdit();
@@ -325,7 +325,7 @@
justifyRight.setShortcut(new ShortcutDescriptor(true, 'R'));
justifyRight.setAddCondition(canBeBasic);
- ActionToolbarMenuDescriptor<Object> undo = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar,
+ ActionToolbarMenuDescriptor<Object> undo = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
new Listener0() {
public void onEvent() {
view.undo();
@@ -338,7 +338,7 @@
undo.setAddCondition(canBeExtended);
undo.setIconCls(getCssName(imgResources.undo()));
- ActionToolbarMenuDescriptor<Object> redo = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar,
+ ActionToolbarMenuDescriptor<Object> redo = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
new Listener0() {
public void onEvent() {
view.redo();
@@ -352,7 +352,7 @@
redo.setBottomSeparator(true);
redo.setIconCls(getCssName(imgResources.redo()));
- ActionToolbarButtonDescriptor<Object> undoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbar,
+ ActionToolbarButtonDescriptor<Object> undoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition,
new Listener0() {
public void onEvent() {
view.undo();
@@ -364,7 +364,7 @@
undoBtn.setIconCls(getCssName(imgResources.undo()));
undoBtn.setPosition(0);
- ActionToolbarButtonDescriptor<Object> redoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbar,
+ ActionToolbarButtonDescriptor<Object> redoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition,
new Listener0() {
public void onEvent() {
view.redo();
@@ -377,7 +377,7 @@
redoBtn.setPosition(1);
redoBtn.setRightSeparator(ActionToolbarButtonSeparator.separator);
- ActionToolbarMenuDescriptor<Object> copy = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar,
+ ActionToolbarMenuDescriptor<Object> copy = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
new Listener0() {
public void onEvent() {
view.copy();
@@ -389,7 +389,7 @@
copy.setAddCondition(canBeExtended);
copy.setIconCls(getCssName(imgResources.copy()));
- ActionToolbarMenuDescriptor<Object> cut = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar,
+ ActionToolbarMenuDescriptor<Object> cut = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
new Listener0() {
public void onEvent() {
view.cut();
@@ -402,7 +402,7 @@
cut.setAddCondition(canBeExtended);
cut.setIconCls(getCssName(imgResources.cut()));
- ActionToolbarMenuDescriptor<Object> paste = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar,
+ ActionToolbarMenuDescriptor<Object> paste = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
new Listener0() {
public void onEvent() {
view.paste();
@@ -415,7 +415,7 @@
paste.setAddCondition(canBeExtended);
paste.setIconCls(getCssName(imgResources.paste()));
- ActionToolbarMenuDescriptor<Object> editHtml = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar,
+ ActionToolbarMenuDescriptor<Object> editHtml = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
new Listener0() {
public void onEvent() {
@@ -438,7 +438,7 @@
editHtml.setParentMenuTitle(i18n.t(EDIT_MENU));
editHtml.setAddCondition(canBeExtended);
- ActionToolbarMenuDescriptor<Object> comment = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar,
+ ActionToolbarMenuDescriptor<Object> comment = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
@@ -481,7 +481,7 @@
comment.setEnableCondition(isInsertHtmlSupported());
comment.setAddCondition(canBeExtended);
- ActionToolbarMenuDescriptor<Object> hr = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar,
+ ActionToolbarMenuDescriptor<Object> hr = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
new Listener0() {
public void onEvent() {
view.focus();
@@ -495,7 +495,7 @@
hr.setParentMenuTitle(i18n.t(INSERT_MENU));
hr.setAddCondition(canBeExtended);
- ActionToolbarMenuDescriptor<Object> blockquote = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar,
+ ActionToolbarMenuDescriptor<Object> blockquote = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
new Listener0() {
public void onEvent() {
view.focus();
@@ -507,7 +507,7 @@
blockquote.setParentMenuTitle(i18n.t(FORMAT_MENU));
blockquote.setAddCondition(canBeExtended);
- ActionToolbarButtonDescriptor<Object> hrButton = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbar,
+ ActionToolbarButtonDescriptor<Object> hrButton = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition,
new Listener0() {
public void onEvent() {
view.focus();
@@ -519,7 +519,7 @@
hrButton.setToolTip(i18n.t("Horizontal line"));
hrButton.setAddCondition(canBeExtended);
- strikethrough = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbar, new Listener0() {
+ strikethrough = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbarPosition, new Listener0() {
public void onEvent() {
view.toggleStrikethrough();
fireOnEdit();
@@ -531,7 +531,7 @@
strikethrough.setAddCondition(canBeExtended);
ActionToolbarButtonDescriptor<Object> decreaseIndent = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbar, new Listener0() {
+ sndbarPosition, new Listener0() {
public void onEvent() {
view.leftIndent();
fireOnEdit();
@@ -542,7 +542,7 @@
decreaseIndent.setAddCondition(canBeExtended);
ActionToolbarButtonDescriptor<Object> increaseIndent = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbar, new Listener0() {
+ sndbarPosition, new Listener0() {
public void onEvent() {
view.rightIndent();
fireOnEdit();
@@ -552,7 +552,7 @@
increaseIndent.setToolTip(i18n.t("Increase Indent"));
increaseIndent.setAddCondition(canBeExtended);
- ActionToolbarButtonDescriptor<Object> ol = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbar,
+ ActionToolbarButtonDescriptor<Object> ol = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition,
new Listener0() {
public void onEvent() {
view.insertOrderedList();
@@ -564,7 +564,7 @@
ol.setShortcut(new ShortcutDescriptor(true, '7'));
ol.setAddCondition(canBeExtended);
- ActionToolbarButtonDescriptor<Object> ul = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbar,
+ ActionToolbarButtonDescriptor<Object> ul = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition,
new Listener0() {
public void onEvent() {
view.insertUnorderedList();
@@ -577,18 +577,24 @@
ul.setRightSeparator(ActionToolbarButtonSeparator.separator);
ul.setAddCondition(canBeExtended);
- ActionToolbarButtonDescriptor<Object> img = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbar,
+ ActionToolbarButtonDescriptor<Object> imgBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition,
new Listener0() {
public void onEvent() {
insertImageDialog.get().show();
}
});
- img.setIconCls(getCssName(imgResources.images()));
- img.setToolTip(i18n.t("Insert Image"));
- img.setAddCondition(canBeExtended);
+ imgBtn.setIconCls(getCssName(imgResources.images()));
+ imgBtn.setToolTip(i18n.t("Insert Image"));
+ imgBtn.setAddCondition(canBeExtended);
- ActionToolbarButtonDescriptor<Object> createOrEditLink = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbar, new Listener0() {
+ ActionToolbarMenuDescriptor<Object> imgMenu = new ActionToolbarMenuDescriptor<Object>(imgBtn);
+ imgMenu.setTextDescription(i18n.t("Image..."));
+ imgMenu.setToolTip(null);
+ imgMenu.setParentMenuTitle(i18n.t(INSERT_MENU));
+ imgMenu.setActionPosition(topbarPosition);
+
+ ActionToolbarButtonDescriptor<Object> createOrEditLinkBtn = new ActionToolbarButtonDescriptor<Object>(
+ accessRol, sndbarPosition, new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
public void onEvent() {
@@ -619,12 +625,20 @@
});
}
});
- createOrEditLink.setIconCls(getCssName(imgResources.link()));
- createOrEditLink.setToolTip(i18n.t("Create or Edit Link"));
- createOrEditLink.setShortcut(new ShortcutDescriptor(true, 'K'));
- createOrEditLink.setAddCondition(canBeExtended);
+ createOrEditLinkBtn.setIconCls(getCssName(imgResources.link()));
+ createOrEditLinkBtn.setToolTip(i18n.t("Create or Edit Link"));
+ createOrEditLinkBtn.setShortcut(new ShortcutDescriptor(true, 'K'));
+ createOrEditLinkBtn.setAddCondition(canBeExtended);
- ActionToolbarButtonDescriptor<Object> removeLink = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbar,
+ ActionToolbarMenuDescriptor<Object> createOrEditLink = new ActionToolbarMenuDescriptor<Object>(
+ createOrEditLinkBtn);
+ createOrEditLink.setTextDescription(i18n.t("Link...") + createOrEditLinkBtn.getShortcutToS());
+ createOrEditLink.setToolTip(null);
+ createOrEditLink.setShortcut(null);
+ createOrEditLink.setActionPosition(topbarPosition);
+ createOrEditLink.setParentMenuTitle(i18n.t(INSERT_MENU));
+
+ ActionToolbarButtonDescriptor<Object> removeLink = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition,
new Listener0() {
public void onEvent() {
view.unlink();
@@ -637,7 +651,7 @@
removeLink.setAddCondition(canBeExtended);
final ActionToolbarMenuDescriptor<Object> removeFormat = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbar, new Listener0() {
+ topbarPosition, new Listener0() {
public void onEvent() {
view.removeFormat();
fireOnEdit();
@@ -651,7 +665,7 @@
removeFormat.setBottomSeparator(true);
final ActionToolbarButtonDescriptor<Object> removeFormatBtn = new ActionToolbarButtonDescriptor<Object>(
- accessRol, sndbar, new Listener0() {
+ accessRol, sndbarPosition, new Listener0() {
public void onEvent() {
view.removeFormat();
fireOnEdit();
@@ -664,7 +678,7 @@
removeFormatBtn.setRightSeparator(ActionToolbarButtonSeparator.separator);
final ActionToolbarMenuDescriptor<Object> insertSpecialChar = new ActionToolbarMenuDescriptor<Object>(
- accessRol, topbar, new Listener0() {
+ accessRol, topbarPosition, new Listener0() {
public void onEvent() {
NotifyUser.showProgressLoading();
if (insertSpecialCharListener == null) {
@@ -686,7 +700,7 @@
insertSpecialChar.setTopSeparator(true);
final ActionToolbarMenuDescriptor<Object> insertMedia = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbar, new Listener0() {
+ topbarPosition, new Listener0() {
public void onEvent() {
NotifyUser.info(TextUtils.IN_DEVELOPMENT);
}
@@ -697,7 +711,7 @@
insertMedia.setParentMenuTitle(i18n.t(INSERT_MENU));
final ActionToolbarMenuDescriptor<Object> insertTable = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbar, new Listener0() {
+ topbarPosition, new Listener0() {
public void onEvent() {
onInsertTablePressed();
}
@@ -707,7 +721,7 @@
insertTable.setAddCondition(canBeExtended);
insertTable.setParentMenuTitle(i18n.t(INSERT_MENU));
- insertTableBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbar, new Listener0() {
+ insertTableBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition, new Listener0() {
public void onEvent() {
onInsertTablePressed();
}
@@ -718,7 +732,7 @@
insertTableBtn.setRightSeparator(ActionToolbarButtonSeparator.separator);
final ActionToolbarButtonDescriptor<Object> fontColor = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbar, new Listener0() {
+ sndbarPosition, new Listener0() {
public void onEvent() {
palette.show(getActionLeftPosition(sndBar, insertTableBtn), getActionTopPosition(sndBar,
removeFormatBtn), new Listener<String>() {
@@ -735,7 +749,7 @@
fontColor.setAddCondition(canBeBasic);
ActionToolbarButtonDescriptor<Object> backgroundColor = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbar, new Listener0() {
+ sndbarPosition, new Listener0() {
public void onEvent() {
palette.show(getActionLeftPosition(sndBar, fontColor), getActionTopPosition(sndBar, fontColor),
new Listener<String>() {
@@ -751,7 +765,7 @@
backgroundColor.setToolTip(i18n.t("Text Background Colour"));
backgroundColor.setAddCondition(canBeBasic);
- final ActionToolbarMenuDescriptor<Object> devInfo = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar,
+ final ActionToolbarMenuDescriptor<Object> devInfo = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
@@ -792,10 +806,12 @@
actions.add(withNoItem(ul));
actions.add(withNoItem(removeFormatBtn));
actions.add(withNoItem(hrButton));
- actions.add(withNoItem(img));
- actions.add(withNoItem(createOrEditLink));
+ actions.add(withNoItem(imgBtn));
+ actions.add(withNoItem(createOrEditLinkBtn));
actions.add(withNoItem(removeLink));
actions.add(withNoItem(insertTableBtn));
+ actions.add(withNoItem(createOrEditLink));
+ actions.add(withNoItem(imgMenu));
actions.add(withNoItem(insertTable));
actions.add(withNoItem(insertMedia));
actions.add(withNoItem(insertSpecialChar));
@@ -820,7 +836,7 @@
private ActionToolbarMenuDescriptor<Object> createFontNameAction(ActionAddCondition<Object> canBeBasic,
final String fontName) {
- final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol, sndbar,
+ final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol, sndbarPosition,
new Listener0() {
public void onEvent() {
view.setFontName(fontName);
@@ -836,7 +852,7 @@
private ActionToolbarMenuDescriptor<Object> createFontSizeAction(ActionAddCondition<Object> canBeBasic,
final int fontSize, String fontSizeName) {
- final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol, sndbar,
+ final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol, sndbarPosition,
new Listener0() {
public void onEvent() {
view.setFontSize(fontSizesConstants[fontSize]);
Added: 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-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -0,0 +1,59 @@
+package org.ourproject.kune.platf.client.ui.rte.insertimg;
+
+public class ImageInfo {
+
+ public static String[][] positions = { new String[] { "left" }, new String[] { "center" }, new String[] { "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" } };
+
+ private String href;
+ private boolean wraptext;
+ private String position;
+ private String size;
+
+ public ImageInfo(String href, boolean wraptext, String position, String size) {
+ this.href = href;
+ this.wraptext = wraptext;
+ this.setPosition(position);
+ this.setSize(size);
+ }
+
+ public String getHref() {
+ return href;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public String getSize() {
+ return size;
+ }
+
+ public boolean isWraptext() {
+ return wraptext;
+ }
+
+ public void setHref(String href) {
+ this.href = href;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public void setSize(String size) {
+ this.size = size;
+ }
+
+ public void setWraptext(boolean wraptext) {
+ this.wraptext = wraptext;
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialog.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialog.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialog.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -2,6 +2,23 @@
import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialog;
+import com.calclab.suco.client.events.Listener;
+import com.calclab.suco.client.events.Listener0;
+
public interface InsertImageDialog extends AbstractTabbedDialog {
+ void fireOnInsertImage(ImageInfo imageInfo);
+
+ ImageInfo getImageInfo();
+
+ void setImageInfo(ImageInfo imageInfo);
+
+ void setImagePosition(String position);
+
+ void setImageSize(String size);
+
+ void setOnCreateImage(Listener<ImageInfo> listener);
+
+ void setOnInsertImagePressed(Listener0 onInsertLinkPressed);
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPanel.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPanel.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -4,18 +4,47 @@
import org.ourproject.kune.platf.client.services.Images;
import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogPanel;
+import com.calclab.suco.client.events.Listener0;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+
public class InsertImageDialogPanel extends AbstractTabbedDialogPanel implements InsertImageDialogView {
- private static final String INSERT_IMG_DIALOG = "iip-dial";
- private static final String INSERT_IMG_DIALOG_ERROR_ID = "iip-err";
+ private static final String INSERT_IMG_DIALOG = "k-iip-dial";
+ private static final String INSERT_IMG_DIALOG_ERROR_ID = "k-iip-err";
private final InsertImageGroup insertImageGroup;
- public InsertImageDialogPanel(final InsertImageDialogPresenter presenter, I18nTranslationService i18n, Images images,
- InsertImageGroup insertImageGroup) {
- super(INSERT_IMG_DIALOG, i18n.t("Insert an image"), 380, HEIGHT + 90, 380, HEIGHT + 90, true, images,
+ public InsertImageDialogPanel(final InsertImageDialogPresenter presenter, I18nTranslationService i18n,
+ Images images, final InsertImageGroup insertImageGroup) {
+ super(INSERT_IMG_DIALOG, i18n.t("Insert Image"), 380, HEIGHT + 100, 380, HEIGHT + 100, true, images,
INSERT_IMG_DIALOG_ERROR_ID);
super.setIconCls("k-picture-icon");
this.insertImageGroup = insertImageGroup;
+
+ super.addHideListener(new Listener0() {
+ public void onEvent() {
+ insertImageGroup.resetAll();
+ }
+ });
+
+ Button insert = new Button(i18n.t("Insert"));
+ insert.addListener(new ButtonListenerAdapter() {
+ @Override
+ public void onClick(Button button, EventObject e) {
+ presenter.onInsert();
+ }
+ });
+
+ Button cancel = new Button(i18n.t("Cancel"));
+ cancel.addListener(new ButtonListenerAdapter() {
+ @Override
+ public void onClick(Button button, EventObject e) {
+ presenter.onCancel();
+ }
+ });
+ addButton(insert);
+ addButton(cancel);
}
@Override
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPresenter.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPresenter.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -2,8 +2,49 @@
import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogPresenter;
+import com.calclab.suco.client.events.Listener;
+import com.calclab.suco.client.events.Listener0;
+
public class InsertImageDialogPresenter extends AbstractTabbedDialogPresenter implements InsertImageDialog {
- public InsertImageDialogPresenter() {
+ private Listener<ImageInfo> onCreateListener;
+ private ImageInfo imageInfo;
+ private Listener0 onInsertPressed;
+
+ public void fireOnInsertImage(ImageInfo imageInfo) {
+ onCreateListener.onEvent(imageInfo);
+ super.hide();
}
+
+ public ImageInfo getImageInfo() {
+ return imageInfo;
+ }
+
+ public void setImageInfo(ImageInfo imageInfo) {
+ this.imageInfo = imageInfo;
+ }
+
+ public void setImagePosition(String position) {
+ imageInfo.setPosition(position);
+ }
+
+ public void setImageSize(String size) {
+ imageInfo.setSize(size);
+ }
+
+ public void setOnCreateImage(Listener<ImageInfo> listener) {
+ onCreateListener = listener;
+ }
+
+ public void setOnInsertImagePressed(Listener0 onInsertPressed) {
+ this.onInsertPressed = onInsertPressed;
+ }
+
+ protected void onCancel() {
+ super.hide();
+ }
+
+ protected void onInsert() {
+ onInsertPressed.onEvent();
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogView.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogView.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -3,5 +3,7 @@
import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogView;
public interface InsertImageDialogView extends AbstractTabbedDialogView {
- int HEIGHT = 225;
+
+ int HEIGHT = 350;
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageGroup.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageGroup.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageGroup.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -1,5 +1,7 @@
package org.ourproject.kune.platf.client.ui.rte.insertimg;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg.InsertImageAbstract;
+
import com.calclab.suco.client.ioc.Container;
import com.calclab.suco.client.ioc.Provider;
import com.calclab.suco.client.ioc.decorator.ProviderCollection;
@@ -16,4 +18,10 @@
p.get();
}
}
+
+ public void resetAll() {
+ for (final Provider<?> p : getProviders()) {
+ ((InsertImageAbstract) p.get()).reset();
+ }
+ }
}
\ No newline at end of file
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstract.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstract.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstract.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -0,0 +1,7 @@
+package org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg;
+
+public interface InsertImageAbstract {
+
+ void reset();
+
+}
Added: 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-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPanel.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -0,0 +1,137 @@
+package org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg;
+
+import org.ourproject.kune.platf.client.i18n.Resources;
+import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm;
+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.SimpleStore;
+import com.gwtext.client.data.Store;
+import com.gwtext.client.widgets.Component;
+import com.gwtext.client.widgets.Panel;
+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.FormPanelListenerAdapter;
+
+public class InsertImageAbstractPanel extends DefaultForm implements InsertImageAbstractView {
+
+ private Object[][] sizesObjs;
+ private Object[][] positionObjs;
+ private final ComboBox sizeCombo;
+ private final ComboBox positionCombo;
+ protected final Checkbox wrapText;
+
+ public InsertImageAbstractPanel(String title, final InsertImageAbstractPresenter presenter) {
+ super(title);
+ super.setAutoWidth(true);
+ super.setHeight(InsertImageDialogView.HEIGHT);
+
+ final Store storeSizes = new SimpleStore(new String[] { "abbr", "trans", "size" }, getSizes());
+ storeSizes.load();
+
+ final Store storePositions = new SimpleStore(new String[] { "abbr", "trans" }, getPositions());
+ storePositions.load();
+
+ 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.setChecked(false);
+
+ super.addListener(new FormPanelListenerAdapter() {
+ @Override
+ public void onActivate(Panel panel) {
+ ImageInfo linkImage = presenter.getImageInfo();
+ updateValues(linkImage);
+ presenter.onActivate();
+ }
+ });
+
+ FieldSet advanced = new FieldSet(Resources.i18n.t("More options"));
+ advanced.setCollapsible(true);
+ advanced.setCollapsed(true);
+ advanced.setAutoHeight(true);
+
+ advanced.add(sizeCombo);
+ advanced.add(positionCombo);
+ advanced.add(wrapText);
+ add(advanced);
+ }
+
+ public String getHref() {
+ return null;
+ }
+
+ public String getPosition() {
+ return positionCombo.getValue();
+ }
+
+ public String getSize() {
+ return sizeCombo.getValue();
+ }
+
+ @Override
+ public void insert(int index, Component component) {
+ super.insert(index, component);
+ }
+
+ public boolean wrapText() {
+ return wrapText.getValue();
+ }
+
+ protected void updateValues(ImageInfo imageInfo) {
+ sizeCombo.setValue(imageInfo.getSize());
+ positionCombo.setValue(imageInfo.getPosition());
+ if (wrapText.isVisible()) {
+ wrapText.setChecked(imageInfo.isWraptext());
+ }
+ }
+
+ private ComboBox createCombo(final Store storeSizes, String title) {
+ ComboBox cb = new ComboBox();
+ cb.setForceSelection(true);
+ cb.setMinChars(1);
+ cb.setFieldLabel(title);
+ cb.setStore(storeSizes);
+ 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);
+ return cb;
+ }
+
+ private Object[][] getPositions() {
+ if (positionObjs == null) {
+ String[][] values = ImageInfo.positions;
+ positionObjs = new Object[values.length][1];
+ int i = 0;
+ for (String[] position : values) {
+ final Object[] obj = new Object[] { position[0], Resources.i18n.t(position[0]) };
+ positionObjs[i++] = obj;
+ }
+ }
+ return positionObjs;
+ }
+
+ private Object[][] getSizes() {
+ if (sizesObjs == null) {
+ String[][] values = ImageInfo.sizes;
+ sizesObjs = new Object[values.length][1];
+ int i = 0;
+ for (String[] size : values) {
+ final Object[] obj = new Object[] { size[0], Resources.i18n.t(size[1], size[2]) };
+ sizesObjs[i++] = obj;
+ }
+ }
+ return sizesObjs;
+ }
+
+}
Added: 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-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPresenter.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -0,0 +1,72 @@
+package org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg;
+
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.ImageInfo;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.InsertImageDialog;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.calclab.suco.client.events.Listener0;
+
+public class InsertImageAbstractPresenter implements InsertImageAbstract {
+
+ protected InsertImageAbstractView view;
+ protected final InsertImageDialog insertImageDialog;
+ private final Listener0 onInsertImagePressed;
+
+ public InsertImageAbstractPresenter(final InsertImageDialog insertImageDialog) {
+ this.insertImageDialog = insertImageDialog;
+ onInsertImagePressed = new Listener0() {
+ public void onEvent() {
+ if (isValid()) {
+ ImageInfo linkInfo = updateImageInfo();
+ insertImageDialog.fireOnInsertImage(linkInfo);
+ } else {
+ Log.debug("Form in InsertImage not valid");
+ }
+ }
+ };
+ }
+
+ public ImageInfo getImageInfo() {
+ return insertImageDialog.getImageInfo();
+ }
+
+ public View getView() {
+ return view;
+ }
+
+ public void init(InsertImageAbstractView view) {
+ this.view = view;
+ insertImageDialog.addTab(view);
+ }
+
+ public boolean isValid() {
+ return view.isValid();
+ }
+
+ public void onActivate() {
+ insertImageDialog.setOnInsertImagePressed(onInsertImagePressed);
+ }
+
+ public void onInsert(ImageInfo linkInfo) {
+ insertImageDialog.fireOnInsertImage(linkInfo);
+ reset();
+ }
+
+ public void onPositionFieldChanged(String position) {
+ insertImageDialog.setImagePosition(position);
+ }
+
+ public void onSizeFieldChanged(String size) {
+ insertImageDialog.setImageSize(size);
+ }
+
+ public void reset() {
+ view.reset();
+ }
+
+ protected ImageInfo updateImageInfo() {
+ return new ImageInfo(view.getHref(), view.wrapText(), view.getPosition(), view.getSize());
+ }
+
+}
Added: 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-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractView.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -0,0 +1,18 @@
+package org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg;
+
+import org.ourproject.kune.platf.client.View;
+
+public interface InsertImageAbstractView extends View {
+
+ String getHref();
+
+ String getPosition();
+
+ String getSize();
+
+ boolean isValid();
+
+ void reset();
+
+ boolean wrapText();
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/InsertImageExt.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/InsertImageExt.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/InsertImageExt.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -1,5 +1,7 @@
package org.ourproject.kune.platf.client.ui.rte.insertimg.ext;
-public interface InsertImageExt {
+import org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg.InsertImageAbstract;
+public interface InsertImageExt extends InsertImageAbstract {
+
}
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-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/InsertImageExtPanel.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -2,8 +2,7 @@
import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
import org.ourproject.kune.platf.client.ui.TextUtils;
-import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm;
-import org.ourproject.kune.platf.client.ui.rte.insertimg.InsertImageDialogView;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg.InsertImageAbstractPanel;
import com.gwtext.client.core.EventObject;
import com.gwtext.client.widgets.Button;
@@ -13,16 +12,15 @@
import com.gwtext.client.widgets.form.TextField;
import com.gwtext.client.widgets.layout.FitLayout;
-public class InsertImageExtPanel extends DefaultForm implements InsertImageExtView {
+public class InsertImageExtPanel extends InsertImageAbstractPanel implements InsertImageExtView {
private static final String LINK_FIELD = "iiep-img-field";
private final TextField linkField;
private final Panel previewPanel;
public InsertImageExtPanel(final InsertImageExtPresenter presenter, I18nTranslationService i18n) {
- super(i18n.t("External image"));
- super.setAutoWidth(true);
- super.setHeight(InsertImageDialogView.HEIGHT);
+ super(i18n.t("External image"), presenter);
+
linkField = new TextField();
linkField.setTabIndex(1);
linkField.setFieldLabel(i18n.t("External image link (URL)"));
@@ -44,18 +42,10 @@
preview.addListener(new ButtonListenerAdapter() {
@Override
public void onClick(Button button, EventObject e) {
- presenter.onPreview();
+ // presenter.onPreview();
}
});
addButton(preview);
- Button insert = new Button(i18n.t("Insert"));
- insert.addListener(new ButtonListenerAdapter() {
- @Override
- public void onClick(Button button, EventObject e) {
- presenter.onInsert();
- }
- });
- addButton(insert);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/InsertImageExtPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/InsertImageExtPresenter.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/InsertImageExtPresenter.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -1,26 +1,12 @@
package org.ourproject.kune.platf.client.ui.rte.insertimg.ext;
import org.ourproject.kune.platf.client.ui.rte.insertimg.InsertImageDialog;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg.InsertImageAbstractPresenter;
-public class InsertImageExtPresenter implements InsertImageExt {
+public class InsertImageExtPresenter extends InsertImageAbstractPresenter implements InsertImageExt {
- private final InsertImageDialog insertImageDialog;
-
public InsertImageExtPresenter(InsertImageDialog insertImageDialog) {
- this.insertImageDialog = insertImageDialog;
+ super(insertImageDialog);
}
- public void init(InsertImageExtView view) {
- insertImageDialog.addTab(view);
- }
-
- public void onInsert() {
- // TODO Auto-generated method stub
-
- }
-
- public void onPreview() {
- // TODO Auto-generated method stub
-
- }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/InsertImageExtView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/InsertImageExtView.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/InsertImageExtView.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -1,7 +1,6 @@
package org.ourproject.kune.platf.client.ui.rte.insertimg.ext;
-import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg.InsertImageAbstractView;
-public interface InsertImageExtView extends View {
+public interface InsertImageExtView extends InsertImageAbstractView {
}
-
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPresenter.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPresenter.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -30,9 +30,6 @@
private LinkInfo linkInfo;
private Listener0 onInsertLinkPressed;
- public InsertLinkDialogPresenter() {
- }
-
public void fireOnInsertLink(LinkInfo linkInfo) {
onCreateListener.onEvent(linkInfo);
super.hide();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -179,7 +179,7 @@
onDoSave();
}
};
- saveBtn = new ActionToolbarButtonDescriptor<Object>(AccessRolDTO.Editor, RTEditor.sndbar, onPerformSaveCall);
+ saveBtn = new ActionToolbarButtonDescriptor<Object>(AccessRolDTO.Editor, RTEditor.sndbarPosition, onPerformSaveCall);
saveBtn.setIconCls(RTEImgResources.SUFFIX + imgResources.save().getName());
saveBtn.setToolTip(i18n.t("Save"));
ShortcutDescriptor ctrl_S = new ShortcutDescriptor(true, 'S');
@@ -187,14 +187,14 @@
saveBtn.setPosition(0);
ActionToolbarMenuDescriptor<Object> save = new ActionToolbarMenuDescriptor<Object>(AccessRolDTO.Editor,
- RTEditor.topbar, onPerformSaveCall);
+ RTEditor.topbarPosition, onPerformSaveCall);
save.setIconCls(RTEImgResources.SUFFIX + imgResources.save().getName());
save.setParentMenuTitle(i18n.t(FILE_DEF_MENU_OPTION));
save.setTextDescription(i18n.t("Save") + (ctrl_S.toString()));
save.setPosition(0);
ActionToolbarMenuDescriptor<Object> close = new ActionToolbarMenuDescriptor<Object>(AccessRolDTO.Editor,
- RTEditor.topbar, new Listener<Object>() {
+ RTEditor.topbarPosition, new Listener<Object>() {
public void onEvent(Object parameter) {
onCancel();
}
@@ -213,12 +213,12 @@
}
};
ActionToolbarMenuDescriptor<Object> saveclose = new ActionToolbarMenuDescriptor<Object>(AccessRolDTO.Editor,
- RTEditor.topbar, onPerformSaveAndCloseCall);
+ RTEditor.topbarPosition, onPerformSaveAndCloseCall);
saveclose.setParentMenuTitle(i18n.t(FILE_DEF_MENU_OPTION));
saveclose.setTextDescription(i18n.t("Save & Close"));
ActionToolbarButtonDescriptor<Object> saveCloseBtn = new ActionToolbarButtonDescriptor<Object>(
- AccessRolDTO.Editor, RTEditor.topbar, onPerformSaveAndCloseCall);
+ AccessRolDTO.Editor, RTEditor.topbarPosition, onPerformSaveAndCloseCall);
// saveCloseBtn.setIconCls(RTEImgResources.SUFFIX +
// imgResources.save().getName());
saveCloseBtn.setTextDescription(i18n.t("Save & Close"));
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -97,7 +97,7 @@
}
public void setFileMenuTitle(String fileMenuTitleNew) {
- basicEditor.getTopBar().setParentMenuTitle(RTEditor.topbar, fileMenuTitle, null, fileMenuTitleNew);
+ basicEditor.getTopBar().setParentMenuTitle(RTEditor.topbarPosition, fileMenuTitle, null, fileMenuTitleNew);
}
@Override
@@ -109,7 +109,7 @@
private void addContentActions() {
ActionToolbarMenuDescriptor<Object> rename = new ActionToolbarMenuDescriptor<Object>(AccessRolDTO.Editor,
- RTEditor.topbar, new Listener0() {
+ RTEditor.topbarPosition, new Listener0() {
public void onEvent() {
entityTitle.edit();
// basicEditor.setFocus(false);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocal.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocal.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocal.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -1,5 +1,7 @@
package org.ourproject.kune.workspace.client.editor.insertlocalimg;
-public interface InsertImageLocal {
+import org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg.InsertImageAbstract;
+public interface InsertImageLocal extends InsertImageAbstract {
+
}
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-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalPanel.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -1,19 +1,12 @@
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.InsertImageDialogView;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg.InsertImageAbstractPanel;
-import com.google.gwt.user.client.ui.Label;
-import com.gwtext.client.widgets.Panel;
+public class InsertImageLocalPanel extends InsertImageAbstractPanel implements InsertImageLocalView {
-public class InsertImageLocalPanel extends Panel implements InsertImageLocalView {
-
public InsertImageLocalPanel(final InsertImageLocalPresenter presenter, I18nTranslationService i18n) {
- super(i18n.t("Local image"));
- setAutoWidth(true);
- setHeight(InsertImageDialogView.HEIGHT);
- setPaddings(20);
- add(new Label(TextUtils.IN_DEVELOPMENT));
+ super(i18n.t("Local image"), presenter);
}
+
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalPresenter.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalPresenter.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -1,16 +1,12 @@
package org.ourproject.kune.workspace.client.editor.insertlocalimg;
import org.ourproject.kune.platf.client.ui.rte.insertimg.InsertImageDialog;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg.InsertImageAbstractPresenter;
-public class InsertImageLocalPresenter implements InsertImageLocal {
+public class InsertImageLocalPresenter extends InsertImageAbstractPresenter implements InsertImageLocal {
- private final InsertImageDialog insertImageDialog;
-
public InsertImageLocalPresenter(InsertImageDialog insertImageDialog) {
- this.insertImageDialog = insertImageDialog;
+ super(insertImageDialog);
}
- public void init(InsertImageLocalView view) {
- insertImageDialog.addTab(view);
- }
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalView.java 2009-03-23 21:21:45 UTC (rev 1085)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalView.java 2009-03-24 14:25:48 UTC (rev 1086)
@@ -1,7 +1,6 @@
package org.ourproject.kune.workspace.client.editor.insertlocalimg;
-import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg.InsertImageAbstractView;
-public interface InsertImageLocalView extends View {
+public interface InsertImageLocalView extends InsertImageAbstractView {
}
-
More information about the kune-commits
mailing list