Author: vjrj Date: 2009-03-10 18:53:08 +0100 (Tue, 10 Mar 2009) New Revision: 1067 Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtml.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlGroup.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlPresenter.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlView.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlAgent.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlEditor.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlEditorPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlEditorPresenter.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlEditorView.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/EditHtmlPreview.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/EditHtmlPreviewPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/EditHtmlPreviewPresenter.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/EditHtmlPreviewView.java Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KunePlatformModule.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/MessageToolbar.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/noti/NotifyUser.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessagePanel.java Log: Complete - task editHtml dialog (editor/preview) for RTE Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KunePlatformModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/services/KunePlatformModule.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KunePlatformModule.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -59,6 +59,16 @@ import org.ourproject.kune.platf.client.ui.rte.RTEditorPanel; import org.ourproject.kune.platf.client.ui.rte.RTEditorPresenter; import org.ourproject.kune.platf.client.ui.rte.TestRTEDialog; +import org.ourproject.kune.platf.client.ui.rte.edithtml.EditHtml; +import org.ourproject.kune.platf.client.ui.rte.edithtml.EditHtmlGroup; +import org.ourproject.kune.platf.client.ui.rte.edithtml.EditHtmlPanel; +import org.ourproject.kune.platf.client.ui.rte.edithtml.EditHtmlPresenter; +import org.ourproject.kune.platf.client.ui.rte.edithtml.editor.EditHtmlEditor; +import org.ourproject.kune.platf.client.ui.rte.edithtml.editor.EditHtmlEditorPanel; +import org.ourproject.kune.platf.client.ui.rte.edithtml.editor.EditHtmlEditorPresenter; +import org.ourproject.kune.platf.client.ui.rte.edithtml.preview.EditHtmlPreview; +import org.ourproject.kune.platf.client.ui.rte.edithtml.preview.EditHtmlPreviewPanel; +import org.ourproject.kune.platf.client.ui.rte.edithtml.preview.EditHtmlPreviewPresenter; import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources; import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper; import org.ourproject.kune.platf.client.utils.TimerWrapper; @@ -256,7 +266,7 @@ RTEActionSndToolbar sndBar = $(RTEActionSndToolbar.class); final RTEditorPresenter presenter = new RTEditorPresenter($(I18nTranslationService.class), $(Session.class), topBar, sndBar, $(RTEImgResources.class), $(TextEditorInsertElement.class), - $(ColorWebSafePalette.class), $(DeferredCommandWrapper.class)); + $(ColorWebSafePalette.class), $$(EditHtml.class), $(DeferredCommandWrapper.class)); final RTEditorPanel panel = new RTEditorPanel(presenter, $(I18nUITranslationService.class), $(ActionManager.class)); presenter.init(panel); @@ -297,6 +307,37 @@ } }); + registerDecorator(EditHtmlGroup.class, new EditHtmlGroup(container)); + + register(EditHtmlGroup.class, new Factory<EditHtml>(EditHtml.class) { + @Override + public EditHtml create() { + final EditHtmlPresenter presenter = new EditHtmlPresenter(); + final EditHtmlPanel panel = new EditHtmlPanel(presenter, $(I18nTranslationService.class), + $(RTEImgResources.class), $(Images.class), $(EditHtmlGroup.class)); + presenter.init(panel); + return presenter; + } + }); + + register(EditHtmlGroup.class, new Factory<EditHtmlEditor>(EditHtmlEditor.class) { + @Override + public EditHtmlEditor create() { + final EditHtmlEditorPresenter presenter = new EditHtmlEditorPresenter($(EditHtml.class)); + final EditHtmlEditorPanel panel = new EditHtmlEditorPanel(i18n, presenter); + presenter.init(panel); + return presenter; + } + }, new Factory<EditHtmlPreview>(EditHtmlPreview.class) { + @Override + public EditHtmlPreview create() { + final EditHtmlPreviewPresenter presenter = new EditHtmlPreviewPresenter($(EditHtml.class)); + final EditHtmlPreviewPanel panel = new EditHtmlPreviewPanel(i18n, presenter); + presenter.init(panel); + return presenter; + } + }); + $(ApplicationComponentGroup.class).createAll(); $(ToolGroup.class).createAll(); $(Application.class).start(); Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/MessageToolbar.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/MessageToolbar.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/MessageToolbar.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -60,6 +60,8 @@ public void setErrorMessage(final String message, final Level type) { errorLabel.setText(message); errorIcon.setVisible(true); + // FIXME + // String iconCls = NotifyUser.getCls(level); toolbar.setVisible(true); } } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/noti/NotifyUser.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/noti/NotifyUser.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/noti/NotifyUser.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -55,6 +55,25 @@ onNotify.fire(Level.error, message); } + public static String getCls(Level level) { + String iconCls = ""; + switch (level) { + case info: + iconCls = "k-stm-info-icon"; + break; + case important: + iconCls = "k-stm-imp-icon"; + break; + case veryImportant: + iconCls = "k-stm-verimp-icon"; + break; + case error: + iconCls = "k-stm-error-icon"; + break; + } + return iconCls; + } + public static void hideProgress() { onHideProgress.fire(); } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPresenter.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPresenter.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -19,6 +19,7 @@ import org.ourproject.kune.platf.client.ui.TextUtils; import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.platf.client.ui.palette.ColorWebSafePalette; +import org.ourproject.kune.platf.client.ui.rte.edithtml.EditHtml; import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources; import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper; import org.ourproject.kune.workspace.client.editor.insert.TextEditorInsertElement; @@ -27,6 +28,7 @@ import com.calclab.suco.client.events.Listener; import com.calclab.suco.client.events.Listener0; import com.calclab.suco.client.events.Listener2; +import com.calclab.suco.client.ioc.Provider; import com.google.gwt.libideas.resources.client.ImageResource; public class RTEditorPresenter implements RTEditor { @@ -61,16 +63,18 @@ private final DeferredCommandWrapper deferred; private final ActionAddCondition<Object> canBeBasic; private final ActionAddCondition<Object> canBeExtended; + private final Provider<EditHtml> editHtmlDialog; public RTEditorPresenter(I18nTranslationService i18n, Session session, RTEActionTopToolbar topBar, RTEActionSndToolbar sndBar, RTEImgResources imgResources, TextEditorInsertElement textEditorInsertElement, - ColorWebSafePalette palette, DeferredCommandWrapper deferred) { + ColorWebSafePalette palette, Provider<EditHtml> editHtmlDialog, DeferredCommandWrapper deferred) { this.i18n = i18n; this.session = session; this.topBar = topBar; this.sndBar = sndBar; this.insertElement = textEditorInsertElement; this.palette = palette; + this.editHtmlDialog = editHtmlDialog; this.deferred = deferred; styleToolbar(sndBar); sndBar.attach(); @@ -392,7 +396,14 @@ ActionToolbarMenuDescriptor<Object> editHtml = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar, new Listener0() { public void onEvent() { - NotifyUser.info("In dev"); + EditHtml dialog = editHtmlDialog.get(); + dialog.setUpdateListener(new Listener<String>() { + public void onEvent(String html) { + view.setHtml(html); + } + }); + dialog.show(); + dialog.setHtml(view.getHtml()); } }); editHtml.setIconCls(getCssName(imgResources.edithtml())); Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtml.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtml.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtml.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -0,0 +1,21 @@ +package org.ourproject.kune.platf.client.ui.rte.edithtml; + +import org.ourproject.kune.platf.client.ui.rte.edithtml.editor.EditHtmlAgent; +import org.ourproject.kune.workspace.client.options.AbstractOptions; + +import com.calclab.suco.client.events.Listener; +import com.calclab.suco.client.events.Listener0; + +public interface EditHtml extends AbstractOptions { + + String getHtml(); + + void setAgent(EditHtmlAgent agent); + + void setCancelListener(Listener0 cancelListener); + + void setHtml(String html); + + void setUpdateListener(Listener<String> updateListener); + +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlGroup.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlGroup.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlGroup.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -0,0 +1,19 @@ +package org.ourproject.kune.platf.client.ui.rte.edithtml; + +import com.calclab.suco.client.ioc.Container; +import com.calclab.suco.client.ioc.Provider; +import com.calclab.suco.client.ioc.decorator.ProviderCollection; +import com.calclab.suco.client.ioc.decorator.Singleton; + +public class EditHtmlGroup extends ProviderCollection { + + public EditHtmlGroup(final Container container) { + super(container, Singleton.instance); + } + + public void createAll() { + for (final Provider<?> p : getProviders()) { + p.get(); + } + } +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlPanel.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlPanel.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -0,0 +1,60 @@ +package org.ourproject.kune.platf.client.ui.rte.edithtml; + +import org.ourproject.kune.platf.client.i18n.I18nTranslationService; +import org.ourproject.kune.platf.client.services.Images; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level; +import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources; +import org.ourproject.kune.workspace.client.options.AbstractOptionsPanel; + +import com.google.gwt.user.client.Window; +import com.gwtext.client.core.EventObject; +import com.gwtext.client.widgets.Button; +import com.gwtext.client.widgets.event.ButtonListenerAdapter; + +public class EditHtmlPanel extends AbstractOptionsPanel implements EditHtmlView { + + public static final String EDIT_HTML_DIALOG = "ehtml-dialog"; + public static final String EDIG_HTML_DIALOG_ERROR_ID = "ehtml-dialgo-error"; + private final EditHtmlGroup editHtmlGroup; + private final I18nTranslationService i18n; + private Button cancel; + private final EditHtmlPresenter presenter; + + public EditHtmlPanel(final EditHtmlPresenter presenter, I18nTranslationService i18n, RTEImgResources resources, + Images images, EditHtmlGroup editHtmlGroup) { + super(EDIT_HTML_DIALOG, i18n.tWithNT("Edit the HTML", + "Option in a content editor to edit the html internal code (for advance users)"), + Window.getClientWidth() - 100, HEIGHT + 80, Window.getClientWidth() - 100, HEIGHT + 80, true, images, + EDIG_HTML_DIALOG_ERROR_ID); + this.presenter = presenter; + this.i18n = i18n; + this.editHtmlGroup = editHtmlGroup; + // super.setIconCls(RTEImgResources.SUFFIX + + // resources.edithtml().getName()); + } + + @Override + public void createAndShow() { + if (cancel == null) { + cancel = new Button(i18n.t("Cancel")); + Button update = new Button(i18n.t("Update")); + cancel.addListener(new ButtonListenerAdapter() { + @Override + public void onClick(Button button, EventObject e) { + presenter.onCancel(); + } + }); + update.addListener(new ButtonListenerAdapter() { + @Override + public void onClick(Button button, EventObject e) { + presenter.onUpdate(); + } + }); + super.addButton(update); + super.addButton(cancel); + } + editHtmlGroup.createAll(); + super.createAndShow(); + super.setErrorMessage(i18n.t("This option is only for advanced users"), Level.info); + } +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlPresenter.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlPresenter.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -0,0 +1,64 @@ +package org.ourproject.kune.platf.client.ui.rte.edithtml; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.ui.rte.edithtml.editor.EditHtmlAgent; +import org.ourproject.kune.workspace.client.options.AbstractOptionsPresenter; + +import com.calclab.suco.client.events.Listener; +import com.calclab.suco.client.events.Listener0; + +public class EditHtmlPresenter extends AbstractOptionsPresenter implements EditHtml { + + private EditHtmlView view; + private Listener<String> updateListener; + private Listener0 cancelListener; + private EditHtmlAgent agent; + + public EditHtmlPresenter() { + } + + public String getHtml() { + return agent.getHtml(); + } + + @Override + public View getView() { + return view; + } + + public void init(EditHtmlView view) { + super.init(view); + this.view = view; + } + + public void onCancel() { + if (cancelListener != null) { + cancelListener.onEvent(); + } + view.hide(); + } + + public void onUpdate() { + if (updateListener != null) { + // FIXME + updateListener.onEvent(agent.getHtml()); + } + view.hide(); + } + + public void setAgent(EditHtmlAgent agent) { + this.agent = agent; + } + + public void setCancelListener(Listener0 cancelListener) { + this.cancelListener = cancelListener; + } + + public void setHtml(String html) { + agent.setHtml(html); + } + + public void setUpdateListener(Listener<String> updateListener) { + this.updateListener = updateListener; + } +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlView.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlView.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -0,0 +1,8 @@ +package org.ourproject.kune.platf.client.ui.rte.edithtml; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.workspace.client.options.AbstractOptionsView; + +public interface EditHtmlView extends AbstractOptionsView, View { + int HEIGHT = 225; +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlAgent.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlAgent.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlAgent.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -0,0 +1,8 @@ +package org.ourproject.kune.platf.client.ui.rte.edithtml.editor; + +public interface EditHtmlAgent { + + String getHtml(); + + void setHtml(String html); +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlEditor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlEditor.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlEditor.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -0,0 +1,5 @@ +package org.ourproject.kune.platf.client.ui.rte.edithtml.editor; + +public interface EditHtmlEditor { + +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlEditorPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlEditorPanel.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlEditorPanel.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -0,0 +1,35 @@ +package org.ourproject.kune.platf.client.ui.rte.edithtml.editor; + +import org.ourproject.kune.platf.client.i18n.I18nUITranslationService; +import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm; +import org.ourproject.kune.platf.client.ui.rte.edithtml.EditHtmlView; + +import com.gwtext.client.widgets.form.TextArea; + +public class EditHtmlEditorPanel extends DefaultForm implements EditHtmlEditorView { + + public static final String HTML_FIELD = "ehtp-html-f"; + private final TextArea editorField; + + public EditHtmlEditorPanel(I18nUITranslationService i18n, final EditHtmlEditorPresenter presenter) { + super("HTML"); + super.setAutoWidth(true); + super.setHideLabels(true); + super.setHeight(EditHtmlView.HEIGHT - 35); + editorField = new TextArea(); + editorField.setHeight(EditHtmlView.HEIGHT - 70); + editorField.setWidth("98%"); + editorField.setTabIndex(4); + editorField.setName(HTML_FIELD); + editorField.setId(HTML_FIELD); + add(editorField); + } + + public String getHtml() { + return editorField.getRawValue(); + } + + public void setHtml(String html) { + editorField.setValue(html); + } +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlEditorPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlEditorPresenter.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlEditorPresenter.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -0,0 +1,32 @@ +package org.ourproject.kune.platf.client.ui.rte.edithtml.editor; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.ui.rte.edithtml.EditHtml; + +public class EditHtmlEditorPresenter implements EditHtmlEditor, EditHtmlAgent { + + private EditHtmlEditorView view; + private final EditHtml editHtml; + + public EditHtmlEditorPresenter(EditHtml editHtml) { + this.editHtml = editHtml; + editHtml.setAgent(this); + } + + public String getHtml() { + return view.getHtml(); + } + + public View getView() { + return view; + } + + public void init(EditHtmlEditorView view) { + this.view = view; + editHtml.addOptionTab(view); + } + + public void setHtml(String html) { + view.setHtml(html); + } +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlEditorView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlEditorView.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/EditHtmlEditorView.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -0,0 +1,10 @@ +package org.ourproject.kune.platf.client.ui.rte.edithtml.editor; + +import org.ourproject.kune.platf.client.View; + +public interface EditHtmlEditorView extends View { + + String getHtml(); + + void setHtml(String html); +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/EditHtmlPreview.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/EditHtmlPreview.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/EditHtmlPreview.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -0,0 +1,5 @@ +package org.ourproject.kune.platf.client.ui.rte.edithtml.preview; + +public interface EditHtmlPreview { + +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/EditHtmlPreviewPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/EditHtmlPreviewPanel.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/EditHtmlPreviewPanel.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -0,0 +1,29 @@ +package org.ourproject.kune.platf.client.ui.rte.edithtml.preview; + +import org.ourproject.kune.platf.client.i18n.I18nTranslationService; +import org.ourproject.kune.platf.client.ui.rte.edithtml.EditHtmlView; + +import com.google.gwt.user.client.ui.HTML; +import com.gwtext.client.widgets.Panel; +import com.gwtext.client.widgets.event.PanelListenerAdapter; + +public class EditHtmlPreviewPanel extends Panel implements EditHtmlPreviewView { + + public EditHtmlPreviewPanel(I18nTranslationService i18n, final EditHtmlPreviewPresenter presenter) { + setTitle(i18n.t("Preview")); + super.setCls("kune-Content-Main"); + setHeight(EditHtmlView.HEIGHT - 40); + setAutoScroll(true); + setAutoWidth(true); + super.addListener(new PanelListenerAdapter() { + @Override + public void onActivate(Panel panel) { + clear(); + add(new HTML(presenter.getHtml())); + if (isRendered()) { + doLayout(); + } + } + }); + } +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/EditHtmlPreviewPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/EditHtmlPreviewPresenter.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/EditHtmlPreviewPresenter.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -0,0 +1,27 @@ +package org.ourproject.kune.platf.client.ui.rte.edithtml.preview; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.ui.rte.edithtml.EditHtml; + +public class EditHtmlPreviewPresenter implements EditHtmlPreview { + + private EditHtmlPreviewView view; + private final EditHtml editHtml; + + public EditHtmlPreviewPresenter(EditHtml editHtml) { + this.editHtml = editHtml; + } + + public String getHtml() { + return editHtml.getHtml(); + } + + public View getView() { + return view; + } + + public void init(EditHtmlPreviewView view) { + this.view = view; + editHtml.addOptionTab(view); + } +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/EditHtmlPreviewView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/EditHtmlPreviewView.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/EditHtmlPreviewView.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -0,0 +1,7 @@ +package org.ourproject.kune.platf.client.ui.rte.edithtml.preview; + +import org.ourproject.kune.platf.client.View; + +public interface EditHtmlPreviewView extends View { +} + Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsPanel.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsPanel.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -19,6 +19,8 @@ */ package org.ourproject.kune.workspace.client.options; +import java.util.ArrayList; + import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.services.Images; import org.ourproject.kune.platf.client.ui.dialogs.BasicDialog; @@ -28,6 +30,7 @@ import com.allen_sauer.gwt.log.client.Log; import com.calclab.suco.client.events.Listener0; +import com.gwtext.client.widgets.Button; import com.gwtext.client.widgets.Component; import com.gwtext.client.widgets.Panel; import com.gwtext.client.widgets.TabPanel; @@ -48,6 +51,7 @@ private final String errorLabelId; private String iconCls; private Listener0 onHideListener; + private final ArrayList<Button> buttons; public AbstractOptionsPanel(String dialogId, String title, int width, int height, int minWidth, int minHeight, boolean modal, Images images, String errorLabelId) { @@ -60,8 +64,18 @@ this.modal = modal; this.images = images; this.errorLabelId = errorLabelId; + buttons = new ArrayList<Button>(); } + /** + * User before show/render + * + * @param button + */ + public void addButton(Button button) { + buttons.add(button); + } + public void addHideListener(final Listener0 onHideListener) { this.onHideListener = onHideListener; if (dialog != null) { @@ -168,6 +182,9 @@ if (onHideListener != null) { addHideListener(); } + for (Button button : buttons) { + dialog.addButton(button); + } } private void createDialogIfNecessary() { Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessagePanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessagePanel.java 2009-03-10 13:43:43 UTC (rev 1066) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessagePanel.java 2009-03-10 17:53:08 UTC (rev 1067) @@ -19,6 +19,7 @@ */ package org.ourproject.kune.workspace.client.site.msg; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level; import com.google.gwt.user.client.ui.HTML; @@ -33,22 +34,9 @@ HTML html = new HTML(message); html.addStyleName("kune-Margin-Medium-trbl"); ToastWindow toastWindow = new ToastWindow(title, html.toString()); - String iconCls = ""; - switch (level) { - case info: - iconCls = "k-stm-info-icon"; - break; - case important: - iconCls = "k-stm-imp-icon"; - break; - case veryImportant: - iconCls = "k-stm-verimp-icon"; - break; - case error: - iconCls = "k-stm-error-icon"; - break; - } + String iconCls = NotifyUser.getCls(level); toastWindow.setIconCls(iconCls); toastWindow.show(); } + }