r1072 - in trunk/src/main/java/org/ourproject/kune: platf/client/ui/dialogs platf/client/ui/dialogs/tabbed platf/client/ui/rte platf/client/ui/rte/edithtml platf/client/ui/rte/insertimg platf/client/ui/rte/insertlink workspace/client/options
Author: vjrj Date: 2009-03-11 15:24:39 +0100 (Wed, 11 Mar 2009) New Revision: 1072 Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/tabbed/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/tabbed/AbstractTabbedDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/tabbed/AbstractTabbedDialogPresenter.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/tabbed/AbstractTabbedDialogView.java Removed: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimgext/ trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptions.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsView.java Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogPresenter.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogView.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/insertlink/InsertLinkDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPanel.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/insertlink/InsertLinkDialogView.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptions.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsView.java Log: Incomplete - task Better RTE (Rich Text Editor) support Copied: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/tabbed/AbstractTabbedDialog.java (from rev 1069, trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptions.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptions.java 2009-03-11 13:21:45 UTC (rev 1069) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/tabbed/AbstractTabbedDialog.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -0,0 +1,35 @@ +/* + * + * Copyright (C) 2007-2009 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.ourproject.kune.platf.client.ui.dialogs.tabbed; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level; + +public interface AbstractTabbedDialog { + + public void hideMessages(); + + public void setErrorMessage(String message, Level level); + + void addOptionTab(View view); + + void show(); + +} Copied: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java (from rev 1069, 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-11 13:21:45 UTC (rev 1069) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -0,0 +1,195 @@ +/* + * + * Copyright (C) 2007-2009 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.ourproject.kune.platf.client.ui.dialogs.tabbed; + +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; +import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm; +import org.ourproject.kune.platf.client.ui.dialogs.MessageToolbar; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level; + +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; +import com.gwtext.client.widgets.event.WindowListenerAdapter; + +public abstract class AbstractTabbedDialogPanel { + private BasicDialog dialog; + private final String dialogId; + private TabPanel tabPanel; + private MessageToolbar messageErrorBar; + private String title; + private final int width; + private final int height; + private final int minWidth; + private final int minHeight; + private final boolean modal; + private final Images images; + private final String errorLabelId; + private String iconCls; + private Listener0 onHideListener; + private final ArrayList<Button> buttons; + + public AbstractTabbedDialogPanel(String dialogId, String title, int width, int height, int minWidth, int minHeight, + boolean modal, Images images, String errorLabelId) { + this.dialogId = dialogId; + this.title = title; + this.width = width; + this.height = height; + this.minWidth = minWidth; + this.minHeight = minHeight; + 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) { + addHideListener(); + } + } + + public void addOptionTab(View view) { + if (view instanceof Panel) { + addTab((Panel) view); + } else if (view instanceof DefaultForm) { + addTab(((DefaultForm) view).getFormPanel()); + } else { + Log.error("Programatic error: Unexpected element added to GroupOptions"); + } + doLayoutIfNeeded(); + } + + public void createAndShow() { + show(); + setFirstTabActive(); + } + + public void doLayoutIfNeeded() { + if (dialog.isRendered()) { + dialog.doLayout(false); + } + } + + public void hide() { + if (dialog != null) { + dialog.hide(); + } + } + + public void hideMessages() { + if (dialog != null) { + messageErrorBar.hideErrorMessage(); + } + } + + public boolean isVisible() { + createDialogIfNecessary(); + return dialog.isVisible(); + } + + public void setErrorMessage(final String message, final Level level) { + messageErrorBar.setErrorMessage(message, level); + } + + public void setFirstTabActive() { + tabPanel.setActiveTab(0); + } + + public void setIconCls(String iconCls) { + this.iconCls = iconCls; + if (dialog != null) { + dialog.setIconCls(iconCls); + } + } + + public void setTitle(String title) { + this.title = title; + if (dialog != null) { + dialog.setTitle(title); + } + } + + public void show() { + createDialogIfNecessary(); + dialog.show(); + } + + private void addHideListener() { + dialog.addListener(new WindowListenerAdapter() { + @Override + public void onClose(Panel panel) { + onHideListener.onEvent(); + } + + @Override + public void onHide(Component component) { + onHideListener.onEvent(); + } + }); + } + + private void addTab(Panel newTab) { + createDialogIfNecessary(); + tabPanel.add(newTab); + } + + private void createDialog() { + dialog = new BasicDialog(dialogId, title, modal, true, width, height, minWidth, minHeight); + dialog.setCollapsible(false); + messageErrorBar = new MessageToolbar(images, errorLabelId); + dialog.setBottomToolbar(messageErrorBar.getToolbar()); + tabPanel = new TabPanel(); + tabPanel.setBorder(false); + dialog.add(tabPanel); + if (iconCls != null) { + dialog.setIconCls(iconCls); + } + if (onHideListener != null) { + addHideListener(); + } + for (Button button : buttons) { + dialog.addButton(button); + } + } + + private void createDialogIfNecessary() { + if (dialog == null) { + createDialog(); + } + } +} Copied: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/tabbed/AbstractTabbedDialogPresenter.java (from rev 1069, trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsPresenter.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsPresenter.java 2009-03-11 13:21:45 UTC (rev 1069) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/tabbed/AbstractTabbedDialogPresenter.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -0,0 +1,57 @@ +/* + * + * Copyright (C) 2007-2009 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.ourproject.kune.platf.client.ui.dialogs.tabbed; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level; + +public abstract class AbstractTabbedDialogPresenter { + + private AbstractTabbedDialogView view; + + public void addOptionTab(View tab) { + view.addOptionTab(tab); + } + + public View getView() { + return view; + } + + public void hide() { + view.hide(); + } + + public void hideMessages() { + view.hideMessages(); + } + + public void init(AbstractTabbedDialogView view) { + this.view = view; + } + + public void setErrorMessage(String message, Level level) { + view.setErrorMessage(message, level); + } + + public void show() { + view.createAndShow(); + } + +} Copied: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/tabbed/AbstractTabbedDialogView.java (from rev 1069, trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsView.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsView.java 2009-03-11 13:21:45 UTC (rev 1069) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/tabbed/AbstractTabbedDialogView.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -0,0 +1,37 @@ +/* + * + * Copyright (C) 2007-2009 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.ourproject.kune.platf.client.ui.dialogs.tabbed; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level; + +public interface AbstractTabbedDialogView extends View { + + void addOptionTab(View tab); + + void createAndShow(); + + void hide(); + + void hideMessages(); + + void setErrorMessage(final String message, final Level level); + +} Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialog.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialog.java 2009-03-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialog.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -1,11 +1,11 @@ package org.ourproject.kune.platf.client.ui.rte.edithtml; -import org.ourproject.kune.workspace.client.options.AbstractOptions; +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 EditHtmlDialog extends AbstractOptions { +public interface EditHtmlDialog extends AbstractTabbedDialog { String getHtml(); Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogPanel.java 2009-03-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogPanel.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -2,16 +2,16 @@ import org.ourproject.kune.platf.client.i18n.I18nTranslationService; import org.ourproject.kune.platf.client.services.Images; +import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogPanel; 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 EditHtmlDialogPanel extends AbstractOptionsPanel implements EditHtmlDialogView { +public class EditHtmlDialogPanel extends AbstractTabbedDialogPanel implements EditHtmlDialogView { public static final String EDIT_HTML_DIALOG = "ehtml-dialog"; public static final String EDIG_HTML_DIALOG_ERROR_ID = "ehtml-dialgo-error"; Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogPresenter.java 2009-03-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogPresenter.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -1,11 +1,11 @@ package org.ourproject.kune.platf.client.ui.rte.edithtml; -import org.ourproject.kune.workspace.client.options.AbstractOptionsPresenter; +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 EditHtmlDialogPresenter extends AbstractOptionsPresenter implements EditHtmlDialog { +public class EditHtmlDialogPresenter extends AbstractTabbedDialogPresenter implements EditHtmlDialog { private Listener<String> updateListener; private Listener0 cancelListener; Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogView.java 2009-03-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogView.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -1,8 +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; +import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogView; -public interface EditHtmlDialogView extends AbstractOptionsView, View { +public interface EditHtmlDialogView extends AbstractTabbedDialogView, View { int HEIGHT = 225; } 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-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialog.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -1,7 +1,7 @@ package org.ourproject.kune.platf.client.ui.rte.insertimg; -import org.ourproject.kune.workspace.client.options.AbstractOptions; +import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialog; -public interface InsertImageDialog extends AbstractOptions { +public interface InsertImageDialog extends AbstractTabbedDialog { } 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-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPanel.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -2,9 +2,9 @@ import org.ourproject.kune.platf.client.i18n.I18nTranslationService; import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.workspace.client.options.AbstractOptionsPanel; +import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogPanel; -public class InsertImageDialogPanel extends AbstractOptionsPanel implements InsertImageDialogView { +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"; 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-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPresenter.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -1,8 +1,8 @@ package org.ourproject.kune.platf.client.ui.rte.insertimg; -import org.ourproject.kune.workspace.client.options.AbstractOptionsPresenter; +import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogPresenter; -public class InsertImageDialogPresenter extends AbstractOptionsPresenter implements InsertImageDialog { +public class InsertImageDialogPresenter extends AbstractTabbedDialogPresenter implements InsertImageDialog { public InsertImageDialogPresenter() { } 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-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogView.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -1,8 +1,8 @@ package org.ourproject.kune.platf.client.ui.rte.insertimg; import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.workspace.client.options.AbstractOptionsView; +import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogView; -public interface InsertImageDialogView extends AbstractOptionsView, View { +public interface InsertImageDialogView extends AbstractTabbedDialogView, View { int HEIGHT = 225; } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialog.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialog.java 2009-03-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialog.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -19,11 +19,11 @@ */ package org.ourproject.kune.platf.client.ui.rte.insertlink; -import org.ourproject.kune.workspace.client.options.AbstractOptions; +import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialog; import com.calclab.suco.client.events.Listener2; -public interface InsertLinkDialog extends AbstractOptions { +public interface InsertLinkDialog extends AbstractTabbedDialog { @Deprecated void addOnCreateLink(Listener2<String, String> slot); Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPanel.java 2009-03-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPanel.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -21,11 +21,11 @@ import org.ourproject.kune.platf.client.i18n.I18nTranslationService; import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.workspace.client.options.AbstractOptionsPanel; +import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogPanel; import com.calclab.suco.client.events.Listener0; -public class InsertLinkDialogPanel extends AbstractOptionsPanel implements InsertLinkDialogView { +public class InsertLinkDialogPanel extends AbstractTabbedDialogPanel implements InsertLinkDialogView { public static final String TEXT_EDT_INSERT_DIALOG = "k-ted-iep-dialog"; public static final String TEXT_EDT_INSERT_DIALOG_ERROR_ID = "k-ted-iep-dialog-err"; private final InsertLinkGroup textEditorInsertElementGroup; 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-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPresenter.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -19,12 +19,12 @@ */ package org.ourproject.kune.platf.client.ui.rte.insertlink; -import org.ourproject.kune.workspace.client.options.AbstractOptionsPresenter; +import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogPresenter; import com.calclab.suco.client.events.Event2; import com.calclab.suco.client.events.Listener2; -public class InsertLinkDialogPresenter extends AbstractOptionsPresenter implements InsertLinkDialog { +public class InsertLinkDialogPresenter extends AbstractTabbedDialogPresenter implements InsertLinkDialog { private final Event2<String, String> onCreateLink; Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogView.java 2009-03-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogView.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -20,8 +20,8 @@ package org.ourproject.kune.platf.client.ui.rte.insertlink; import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.workspace.client.options.AbstractOptionsView; +import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogView; -public interface InsertLinkDialogView extends AbstractOptionsView, View { +public interface InsertLinkDialogView extends AbstractTabbedDialogView, View { int HEIGHT = 225; } Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptions.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptions.java 2009-03-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptions.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -1,35 +0,0 @@ -/* - * - * Copyright (C) 2007-2009 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.options; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level; - -public interface AbstractOptions { - - public void hideMessages(); - - public void setErrorMessage(String message, Level level); - - void addOptionTab(View view); - - void show(); - -} Deleted: 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-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsPanel.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -1,195 +0,0 @@ -/* - * - * Copyright (C) 2007-2009 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -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; -import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm; -import org.ourproject.kune.platf.client.ui.dialogs.MessageToolbar; -import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level; - -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; -import com.gwtext.client.widgets.event.WindowListenerAdapter; - -public abstract class AbstractOptionsPanel { - private BasicDialog dialog; - private final String dialogId; - private TabPanel tabPanel; - private MessageToolbar messageErrorBar; - private String title; - private final int width; - private final int height; - private final int minWidth; - private final int minHeight; - private final boolean modal; - private final Images images; - 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) { - this.dialogId = dialogId; - this.title = title; - this.width = width; - this.height = height; - this.minWidth = minWidth; - this.minHeight = minHeight; - 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) { - addHideListener(); - } - } - - public void addOptionTab(View view) { - if (view instanceof Panel) { - addTab((Panel) view); - } else if (view instanceof DefaultForm) { - addTab(((DefaultForm) view).getFormPanel()); - } else { - Log.error("Programatic error: Unexpected element added to GroupOptions"); - } - doLayoutIfNeeded(); - } - - public void createAndShow() { - show(); - setFirstTabActive(); - } - - public void doLayoutIfNeeded() { - if (dialog.isRendered()) { - dialog.doLayout(false); - } - } - - public void hide() { - if (dialog != null) { - dialog.hide(); - } - } - - public void hideMessages() { - if (dialog != null) { - messageErrorBar.hideErrorMessage(); - } - } - - public boolean isVisible() { - createDialogIfNecessary(); - return dialog.isVisible(); - } - - public void setErrorMessage(final String message, final Level level) { - messageErrorBar.setErrorMessage(message, level); - } - - public void setFirstTabActive() { - tabPanel.setActiveTab(0); - } - - public void setIconCls(String iconCls) { - this.iconCls = iconCls; - if (dialog != null) { - dialog.setIconCls(iconCls); - } - } - - public void setTitle(String title) { - this.title = title; - if (dialog != null) { - dialog.setTitle(title); - } - } - - public void show() { - createDialogIfNecessary(); - dialog.show(); - } - - private void addHideListener() { - dialog.addListener(new WindowListenerAdapter() { - @Override - public void onClose(Panel panel) { - onHideListener.onEvent(); - } - - @Override - public void onHide(Component component) { - onHideListener.onEvent(); - } - }); - } - - private void addTab(Panel newTab) { - createDialogIfNecessary(); - tabPanel.add(newTab); - } - - private void createDialog() { - dialog = new BasicDialog(dialogId, title, modal, true, width, height, minWidth, minHeight); - dialog.setCollapsible(false); - messageErrorBar = new MessageToolbar(images, errorLabelId); - dialog.setBottomToolbar(messageErrorBar.getToolbar()); - tabPanel = new TabPanel(); - tabPanel.setBorder(false); - dialog.add(tabPanel); - if (iconCls != null) { - dialog.setIconCls(iconCls); - } - if (onHideListener != null) { - addHideListener(); - } - for (Button button : buttons) { - dialog.addButton(button); - } - } - - private void createDialogIfNecessary() { - if (dialog == null) { - createDialog(); - } - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsPresenter.java 2009-03-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsPresenter.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -1,57 +0,0 @@ -/* - * - * Copyright (C) 2007-2009 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.options; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level; - -public abstract class AbstractOptionsPresenter { - - private AbstractOptionsView view; - - public void addOptionTab(View tab) { - view.addOptionTab(tab); - } - - public View getView() { - return view; - } - - public void hide() { - view.hide(); - } - - public void hideMessages() { - view.hideMessages(); - } - - public void init(AbstractOptionsView view) { - this.view = view; - } - - public void setErrorMessage(String message, Level level) { - view.setErrorMessage(message, level); - } - - public void show() { - view.createAndShow(); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsView.java 2009-03-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/AbstractOptionsView.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -1,37 +0,0 @@ -/* - * - * Copyright (C) 2007-2009 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.options; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level; - -public interface AbstractOptionsView extends View { - - void addOptionTab(View tab); - - void createAndShow(); - - void hide(); - - void hideMessages(); - - void setErrorMessage(final String message, final Level level); - -} Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptions.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptions.java 2009-03-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptions.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -20,9 +20,10 @@ package org.ourproject.kune.workspace.client.options; import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialog; import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level; -public interface EntityOptions extends AbstractOptions { +public interface EntityOptions extends AbstractTabbedDialog { public void addOptionTab(View tab); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java 2009-03-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -23,13 +23,14 @@ import org.ourproject.kune.platf.client.app.EntityOptionsGroup; import org.ourproject.kune.platf.client.i18n.I18nTranslationService; import org.ourproject.kune.platf.client.services.Images; +import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogPanel; import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.entityheader.EntityHeaderButton; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.Widget; -public class EntityOptionsPanel extends AbstractOptionsPanel implements EntityOptionsView { +public class EntityOptionsPanel extends AbstractTabbedDialogPanel implements EntityOptionsView { public static final String ENTITY_OP_PANEL_ID = "k-eop-diag"; public static final String GROUP_OPTIONS_ERROR_ID = "k-eop-err-mess"; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPresenter.java 2009-03-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPresenter.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -21,10 +21,11 @@ import org.ourproject.kune.platf.client.dto.StateAbstractDTO; import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogPresenter; import com.calclab.suco.client.events.Listener; -public class EntityOptionsPresenter extends AbstractOptionsPresenter implements EntityOptions { +public class EntityOptionsPresenter extends AbstractTabbedDialogPresenter implements EntityOptions { EntityOptionsView view; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsView.java 2009-03-11 14:08:13 UTC (rev 1071) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsView.java 2009-03-11 14:24:39 UTC (rev 1072) @@ -20,8 +20,9 @@ package org.ourproject.kune.workspace.client.options; import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogView; -public interface EntityOptionsView extends View, AbstractOptionsView { +public interface EntityOptionsView extends View, AbstractTabbedDialogView { int HEIGHT = 270;
participants (1)
-
vjrj