[kune-commits] r1357 - in trunk/src: main/java/cc/kune/common/client/notify main/java/cc/kune/common/client/ui/dialogs main/java/cc/kune/common/client/ui/dialogs/tabbed main/java/cc/kune/common/client/ui/dialogs/wizard main/java/cc/kune/common/client/utils main/java/cc/kune/core/client/services main/java/cc/kune/core/client/ui main/java/cc/kune/core/client/ws/entheader main/java/cc/kune/core/public main/java/cc/kune/core/shared/dto main/java/cc/kune/gspace/client main/java/cc/kune/gspace/client/licensewizard main/java/cc/kune/gspace/client/licensewizard/pages main/java/cc/kune/gspace/client/options main/java/cc/kune/gspace/client/options/license main/java/org/ourproject/kune/platf/client/ui/dialogs main/java/org/ourproject/kune/platf/client/ui/rte/insertimg main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia main/java/org/ourproject/kune/workspace/client/licensewizard test/java/cc/kune/gspace/client test/java/cc/kune/gspace/client/licensewizard test/java/org/ourproject/kune test/java/org/ourproject/kune/workspace/client
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Sat May 7 17:55:38 CEST 2011
Author: vjrj_
Date: 2011-05-07 17:55:38 +0200 (Sat, 07 May 2011)
New Revision: 1357
Added:
trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/
trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardDialog.java
trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardDialogView.java
trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardListener.java
trunk/src/main/java/cc/kune/common/client/utils/SimpleResponseCallback.java
trunk/src/main/java/cc/kune/core/client/ui/ContentPosition.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/
trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChangeAction.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChooseCallback.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseWizard.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseWizardPanel.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseWizardPresenter.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseWizardView.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/
trunk/src/test/java/cc/kune/gspace/client/licensewizard/
Removed:
trunk/src/main/java/cc/kune/core/client/ui/utils/
trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseChangeAction.java
trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizard.java
trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/
trunk/src/test/java/org/ourproject/kune/wiki/
trunk/src/test/java/org/ourproject/kune/workspace/client/licensewizard/
Modified:
trunk/src/main/java/cc/kune/common/client/notify/ConfirmAskEvent.java
trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java
trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicDialog.java
trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicTopDialog.java
trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java
trunk/src/main/java/cc/kune/common/client/utils/OnAcceptCallback.java
trunk/src/main/java/cc/kune/common/client/utils/SimpleCallback.java
trunk/src/main/java/cc/kune/core/client/services/MediaUtils.java
trunk/src/main/java/cc/kune/core/client/ui/DefaultFormUtils.java
trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityTextLogo.java
trunk/src/main/java/cc/kune/core/public/ws.css
trunk/src/main/java/cc/kune/core/shared/dto/LicenseDTO.java
trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java
trunk/src/main/java/cc/kune/gspace/client/GSpaceGinjector.java
trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardFirstForm.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardFirstFormView.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardFlags.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardFrdForm.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardFrdFormView.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardSndForm.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardSndFormView.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardTrdForm.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardTrdFormView.java
trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPanel.java
trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPanel.java
trunk/src/main/java/cc/kune/gspace/client/options/license/EntityOptionsDefLicensePanel.java
trunk/src/main/java/cc/kune/gspace/client/options/license/EntityOptionsDefLicensePresenter.java
trunk/src/main/java/cc/kune/gspace/client/options/license/GroupOptionsDefLicensePresenter.java
trunk/src/main/java/cc/kune/gspace/client/options/license/UserOptionsDefLicensePresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertElementAbstractPanel.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/insertmedia/abstractmedia/InsertMediaAbstractPanel.java
trunk/src/test/java/cc/kune/gspace/client/licensewizard/LicenseWizardPresenterTest.java
trunk/src/test/java/cc/kune/gspace/client/licensewizard/MockProvider.java
Log:
License widget
Modified: trunk/src/main/java/cc/kune/common/client/notify/ConfirmAskEvent.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/notify/ConfirmAskEvent.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/common/client/notify/ConfirmAskEvent.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -43,7 +43,7 @@
public static void fire(final HasHandlers source, final java.lang.String title, final java.lang.String message,
final java.lang.String acceptBtnMsg, final java.lang.String cancelBtnMsg,
final java.lang.String acceptBtnTooltip, final java.lang.String cancelBtnTooltip,
- final cc.kune.common.client.utils.SimpleCallback callback) {
+ final cc.kune.common.client.utils.SimpleResponseCallback callback) {
source.fireEvent(new ConfirmAskEvent(title, message, acceptBtnMsg, cancelBtnMsg, acceptBtnTooltip,
cancelBtnTooltip, callback));
}
@@ -54,7 +54,7 @@
java.lang.String acceptBtnMsg;
java.lang.String acceptBtnTooltip;
- cc.kune.common.client.utils.SimpleCallback callback;
+ cc.kune.common.client.utils.SimpleResponseCallback callback;
java.lang.String cancelBtnMsg;
java.lang.String cancelBtnTooltip;
java.lang.String message;
@@ -70,7 +70,7 @@
public ConfirmAskEvent(final java.lang.String title, final java.lang.String message,
final java.lang.String acceptBtnMsg, final java.lang.String cancelBtnMsg,
- final cc.kune.common.client.utils.SimpleCallback callback) {
+ final cc.kune.common.client.utils.SimpleResponseCallback callback) {
this.title = title;
this.message = message;
this.acceptBtnMsg = acceptBtnMsg;
@@ -81,7 +81,7 @@
public ConfirmAskEvent(final java.lang.String title, final java.lang.String message,
final java.lang.String acceptBtnMsg, final java.lang.String cancelBtnMsg,
final java.lang.String acceptBtnTooltip, final java.lang.String cancelBtnTooltip,
- final cc.kune.common.client.utils.SimpleCallback callback) {
+ final cc.kune.common.client.utils.SimpleResponseCallback callback) {
this.title = title;
this.message = message;
this.acceptBtnMsg = acceptBtnMsg;
@@ -173,7 +173,7 @@
return TYPE;
}
- public cc.kune.common.client.utils.SimpleCallback getCallback() {
+ public cc.kune.common.client.utils.SimpleResponseCallback getCallback() {
return callback;
}
Modified: trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -19,7 +19,7 @@
*/
package cc.kune.common.client.notify;
-import cc.kune.common.client.utils.SimpleCallback;
+import cc.kune.common.client.utils.SimpleResponseCallback;
import cc.kune.core.client.notify.msgs.UserNotifyEvent;
import cc.kune.core.client.notify.spiner.ProgressHideEvent;
import cc.kune.core.client.notify.spiner.ProgressShowEvent;
@@ -30,9 +30,9 @@
public class NotifyUser {
private static EventBus eventBus;
private static I18nTranslationService i18n;
- private static SimpleCallback onOk;
+ private static SimpleResponseCallback onOk;
- public static void askConfirmation(final String tittle, final String message, final SimpleCallback callback) {
+ public static void askConfirmation(final String tittle, final String message, final SimpleResponseCallback callback) {
eventBus.fireEvent(new ConfirmAskEvent(tittle, message, i18n.t("Yes"), i18n.t("No"), callback));
}
@@ -73,7 +73,7 @@
public static void init(final EventBus eventBus, final I18nTranslationService i18n) {
NotifyUser.eventBus = eventBus;
NotifyUser.i18n = i18n;
- onOk = new SimpleCallback() {
+ onOk = new SimpleResponseCallback() {
@Override
public void onCancel() {
@@ -96,7 +96,7 @@
showAlertMessage(title, message, onOk);
}
- public static void showAlertMessage(final String title, final String message, final SimpleCallback callback) {
+ public static void showAlertMessage(final String title, final String message, final SimpleResponseCallback callback) {
eventBus.fireEvent(new ConfirmAskEvent(title, message, i18n.t("Ok"), "", callback));
}
Modified: trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicDialog.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicDialog.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicDialog.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -74,6 +74,10 @@
return bottomPanel;
}
+ public FlowPanel getBtnPanel() {
+ return btnPanel;
+ }
+
@Override
public HasClickHandlers getFirstBtn() {
return firstBtn;
@@ -94,6 +98,10 @@
return title;
}
+ public void setFirstBtnEnabled(final boolean enabled) {
+ firstBtn.setEnabled(enabled);
+ }
+
public void setFirstBtnId(final String id) {
firstBtn.ensureDebugId(id);
}
@@ -126,6 +134,10 @@
vp.setWidth(width);
}
+ public void setSecondBtnEnabled(final boolean enabled) {
+ secondBtn.setEnabled(enabled);
+ }
+
public void setSecondBtnId(final String id) {
secondBtn.ensureDebugId(id);
}
Modified: trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicTopDialog.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicTopDialog.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicTopDialog.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -74,7 +74,8 @@
}
public Builder height(final int height) {
- this.height = String.valueOf(height);
+ // FIXME
+ this.height = String.valueOf(height); // + "px";
return this;
}
@@ -109,7 +110,8 @@
}
public Builder width(final int width) {
- this.width = String.valueOf(width);
+ // FIXME
+ this.width = String.valueOf(width); // + "px";
return this;
}
Modified: trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -37,39 +37,40 @@
private final String errorLabelId;
private final String firstBtnId;
private final String firstBtnTitle;
- private final int height;
+ private int height;
private String iconCls;
private final NotifyLevelImages images;
private MessageToolbar messageErrorBar;
- private final int minHeight;
- private final int minWidth;
private final boolean modal;
private final String sndBtnId;
private final String sndBtnTitle;
private DecoratedTabPanel tabPanel;
private String title;
- private final int width;
+ private int width;
- public AbstractTabbedDialogPanel(final String dialogId, final String title, final int width,
- final int height, final int minWidth, final int minHeight, final boolean modal,
+ public AbstractTabbedDialogPanel(final String dialogId, final String title, final boolean modal,
final NotifyLevelImages images, final String errorLabelId, final String firstBtnTitle,
final String firstBtnId, final String sndBtnTitle, final String sndBtnId) {
this.dialogId = dialogId;
this.title = title;
- this.width = width;
- this.height = height;
this.modal = modal;
this.images = images;
this.errorLabelId = errorLabelId;
- // Not used:
- this.minWidth = minWidth;
- this.minHeight = minHeight;
this.firstBtnTitle = firstBtnTitle;
this.firstBtnId = firstBtnId;
this.sndBtnTitle = sndBtnTitle;
this.sndBtnId = sndBtnId;
}
+ public AbstractTabbedDialogPanel(final String dialogId, final String title, final int width,
+ final int height, final boolean modal, final NotifyLevelImages images, final String errorLabelId,
+ final String firstBtnTitle, final String firstBtnId, final String sndBtnTitle,
+ final String sndBtnId) {
+ this(dialogId, title, modal, images, errorLabelId, firstBtnTitle, firstBtnId, sndBtnTitle, sndBtnId);
+ this.width = width;
+ this.height = height;
+ }
+
@Override
public void activateTab(final int index) {
createDialogIfNecessary();
@@ -91,7 +92,7 @@
private void createDialog() {
dialog = new BasicTopDialog.Builder(dialogId, true, modal).autoscroll(true).width(width).height(
height).icon(iconCls).firstButtonId(firstBtnId).firstButtonTitle(firstBtnTitle).sndButtonId(
- dialogId).sndButtonTitle(sndBtnTitle).title(title).build();
+ dialogId).sndButtonTitle(sndBtnTitle).sndButtonId(sndBtnId).title(title).build();
messageErrorBar = new MessageToolbar(images, errorLabelId);
tabPanel = new DecoratedTabPanel();
tabPanel.getDeckPanel().setSize(String.valueOf(width), String.valueOf(height));
Added: trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardDialog.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardDialog.java (rev 0)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardDialog.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -0,0 +1,285 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.common.client.ui.dialogs.wizard;
+
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.client.ui.MaskWidget;
+import cc.kune.common.client.ui.dialogs.BasicTopDialog;
+import cc.kune.common.client.ui.dialogs.BasicTopDialog.Builder;
+import cc.kune.core.client.ui.DefaultForm;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.logical.shared.CloseEvent;
+import com.google.gwt.event.logical.shared.CloseHandler;
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DeckPanel;
+import com.google.gwt.user.client.ui.IsWidget;
+import com.google.gwt.user.client.ui.PopupPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+public class WizardDialog implements WizardDialogView {
+
+ private final Button cancelButton;
+ private final DeckPanel deck;
+ private final BasicTopDialog dialog;
+ private final I18nTranslationService i18n;
+ private WizardListener listener;
+ private final MaskWidget maskWidget;
+ private final Button nextButton;
+
+ public WizardDialog(final String dialogId, final String header, final boolean modal,
+ final boolean minimizable, final String width, final String height, final String backId,
+ final String nextId, final String finishId, final String cancelId, final String closeId,
+ final I18nTranslationService i18n, final MaskWidget maskWidget) {
+ this(dialogId, header, modal, minimizable, width, height, backId, nextId, finishId, cancelId,
+ closeId, i18n, maskWidget, null);
+ }
+
+ public WizardDialog(final String dialogId, final String header, final boolean modal,
+ final boolean minimizable, final String width, final String height, final String backId,
+ final String nextId, final String finishId, final String cancelId, final String closeId,
+ final I18nTranslationService i18n, final MaskWidget maskWidget, final WizardListener listener) {
+ this.maskWidget = maskWidget;
+ this.listener = listener;
+ final Builder dialogBuilder = new BasicTopDialog.Builder(dialogId, false, modal).width(width).height(
+ height).firstButtonId(backId).sndButtonId(finishId).title(header);
+
+ dialog = dialogBuilder.build();
+ this.i18n = i18n;
+
+ nextButton = new Button(i18n.tWithNT("Next »", "used in button"), new ClickHandler() {
+
+ @Override
+ public void onClick(final ClickEvent event) {
+ WizardDialog.this.listener.onNext();
+ }
+ });
+
+ nextButton.ensureDebugId(nextId);
+ nextButton.addStyleName("k-dialog-btn");
+ nextButton.addStyleName("k-dialog-firstBtn");
+ nextButton.addStyleName("k-5corners");
+ nextButton.addStyleName("k-button");
+ nextButton.addStyleName("kune-Margin-Medium-l");
+ dialog.getBtnPanel().add(nextButton);
+
+ dialog.setFirstBtnText(i18n.tWithNT("« Back", "used in button"));
+ dialog.getFirstBtn().addClickHandler(new ClickHandler() {
+
+ @Override
+ public void onClick(final ClickEvent event) {
+ WizardDialog.this.listener.onBack();
+ }
+ });
+
+ cancelButton = new Button(i18n.tWithNT("Cancel", "used in button"), new ClickHandler() {
+
+ @Override
+ public void onClick(final ClickEvent event) {
+ WizardDialog.this.listener.onCancel();
+ }
+ });
+ cancelButton.ensureDebugId(cancelId);
+ cancelButton.addStyleName("k-dialog-btn");
+ cancelButton.addStyleName("k-dialog-secondBtn");
+ cancelButton.addStyleName("k-5corners");
+ cancelButton.addStyleName("k-button");
+ cancelButton.addStyleName("kune-Margin-Medium-l");
+ dialog.getBtnPanel().add(cancelButton);
+
+ dialog.setSecondBtnId(finishId);
+ dialog.setSecondBtnText(i18n.tWithNT("Finish", "used in button"));
+ dialog.getSecondBtn().addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ WizardDialog.this.listener.onFinish();
+ }
+ });
+
+ dialog.getClose().addCloseHandler(new CloseHandler<PopupPanel>() {
+
+ @Override
+ public void onClose(final CloseEvent<PopupPanel> event) {
+ WizardDialog.this.listener.onClose();
+ }
+ });
+
+ deck = new DeckPanel();
+ }
+
+ @Override
+ public void add(final IsWidget view) {
+ deck.add(toWidget(view));
+ }
+
+ @Override
+ public void clear() {
+ }
+
+ private int getWidgetCount(final IsWidget view) {
+ if (view instanceof Widget) {
+ return deck.getWidgetIndex((Widget) view);
+ } else if (view instanceof DefaultForm) {
+ return deck.getWidgetIndex(((DefaultForm) view).getFormPanel());
+ }
+ return -1;
+ }
+
+ @Override
+ public void hide() {
+ dialog.hide();
+ }
+
+ @Override
+ public boolean isCurrentPage(final IsWidget view) {
+ final int visibleWidgetIndex = deck.getVisibleWidget();
+ if (visibleWidgetIndex == -1) {
+ return false;
+ } else {
+ return deck.getWidget(visibleWidgetIndex).equals(toWidget(view));
+ }
+ }
+
+ @Override
+ public void mask(final String message) {
+ maskWidget.mask(dialog, message);
+ }
+
+ @Override
+ public void maskProcessing() {
+ maskWidget.mask(dialog, i18n.t("Processing"));
+ }
+
+ @Override
+ public void remove(final IsWidget view) {
+ final int count = getWidgetCount(view);
+ if (count != -1) {
+ deck.remove(count);
+ }
+ }
+
+ @Override
+ public void setEnabled(final boolean back, final boolean next, final boolean cancel,
+ final boolean finish) {
+ setEnabledBackButton(back);
+ setEnabledNextButton(next);
+ setEnabledCancelButton(cancel);
+ setEnabledFinishButton(finish);
+ }
+
+ @Override
+ public void setEnabledBackButton(final boolean enabled) {
+ dialog.setFirstBtnEnabled(enabled);
+ }
+
+ @Override
+ public void setEnabledCancelButton(final boolean enabled) {
+ cancelButton.setEnabled(enabled);
+ }
+
+ @Override
+ public void setEnabledFinishButton(final boolean enabled) {
+ dialog.setSecondBtnEnabled(enabled);
+ }
+
+ @Override
+ public void setEnabledNextButton(final boolean enabled) {
+ nextButton.setEnabled(enabled);
+ }
+
+ @Override
+ public void setFinishText(final String text) {
+ dialog.setSecondBtnText(text);
+ }
+
+ public void setIcon(final ImageResource icon) {
+ dialog.setTitleIcon(icon);
+ }
+
+ @Override
+ public void setListener(final WizardListener listener) {
+ this.listener = listener;
+ }
+
+ @Override
+ public void setVisible(final boolean back, final boolean next, final boolean cancel,
+ final boolean finish) {
+ setVisibleBackButton(back);
+ setVisibleNextButton(next);
+ setVisibleCancelButton(cancel);
+ setVisibleFinishButton(finish);
+ }
+
+ @Override
+ public void setVisibleBackButton(final boolean visible) {
+ dialog.setFirstBtnVisible(visible);
+ }
+
+ @Override
+ public void setVisibleCancelButton(final boolean visible) {
+ cancelButton.setVisible(visible);
+ }
+
+ @Override
+ public void setVisibleFinishButton(final boolean visible) {
+ dialog.setSecondBtnVisible(visible);
+ }
+
+ @Override
+ public void setVisibleNextButton(final boolean visible) {
+ nextButton.setVisible(visible);
+ }
+
+ @Override
+ public void show() {
+ dialog.showCentered();
+ }
+
+ @Override
+ public void show(final IsWidget view) {
+ final int count = getWidgetCount(view);
+ if (count != -1) {
+ deck.showWidget(count);
+ dialog.getInnerPanel().add(deck);
+ } else {
+ NotifyUser.error("Widget not found in deck of WizardDialog");
+ }
+
+ }
+
+ private Widget toWidget(final IsWidget view) {
+ if (view instanceof Widget) {
+ return (Widget) view;
+ } else if (view instanceof DefaultForm) {
+ return ((DefaultForm) view).getFormPanel();
+ } else {
+ NotifyUser.error("Trying to add a unknown element in WizardDialog");
+ return null;
+ }
+ }
+
+ @Override
+ public void unMask() {
+ maskWidget.unMask();
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardDialogView.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardDialogView.java (rev 0)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardDialogView.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -0,0 +1,70 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.common.client.ui.dialogs.wizard;
+
+import com.google.gwt.user.client.ui.IsWidget;
+
+public interface WizardDialogView {
+
+ void add(IsWidget view);
+
+ void clear();
+
+ void hide();
+
+ boolean isCurrentPage(IsWidget view);
+
+ void mask(final String message);
+
+ void maskProcessing();
+
+ void remove(IsWidget view);
+
+ void setEnabled(boolean back, boolean next, boolean cancel, boolean finish);
+
+ void setEnabledBackButton(final boolean enabled);
+
+ void setEnabledCancelButton(final boolean enabled);
+
+ void setEnabledFinishButton(final boolean enabled);
+
+ void setEnabledNextButton(final boolean enabled);
+
+ void setFinishText(final String text);
+
+ void setListener(WizardListener listener);
+
+ void setVisible(boolean back, boolean next, boolean cancel, boolean finish);
+
+ void setVisibleBackButton(final boolean visible);
+
+ void setVisibleCancelButton(final boolean visible);
+
+ void setVisibleFinishButton(final boolean visible);
+
+ void setVisibleNextButton(final boolean visible);
+
+ void show();
+
+ void show(IsWidget view);
+
+ void unMask();
+
+}
Property changes on: trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardDialogView.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardListener.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardListener.java (rev 0)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardListener.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -0,0 +1,34 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.common.client.ui.dialogs.wizard;
+
+public interface WizardListener {
+
+ void onBack();
+
+ void onNext();
+
+ void onFinish();
+
+ void onCancel();
+
+ void onClose();
+
+}
Property changes on: trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/main/java/cc/kune/common/client/utils/OnAcceptCallback.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/utils/OnAcceptCallback.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/common/client/utils/OnAcceptCallback.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -2,7 +2,7 @@
import cc.kune.common.client.log.Log;
-public abstract class OnAcceptCallback implements SimpleCallback {
+public abstract class OnAcceptCallback implements SimpleResponseCallback {
@Override
public void onCancel() {
Modified: trunk/src/main/java/cc/kune/common/client/utils/SimpleCallback.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/utils/SimpleCallback.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/common/client/utils/SimpleCallback.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -20,13 +20,8 @@
package cc.kune.common.client.utils;
public interface SimpleCallback {
- /**
- * Notifies this callback of an accept response.
- */
- void onSuccess();
-
- /**
- * Notifies this callback of a cancel.
- */
- void onCancel();
+ /**
+ * Notifies this callback
+ */
+ void onCallback();
}
Copied: trunk/src/main/java/cc/kune/common/client/utils/SimpleResponseCallback.java (from rev 1355, trunk/src/main/java/cc/kune/common/client/utils/SimpleCallback.java)
===================================================================
--- trunk/src/main/java/cc/kune/common/client/utils/SimpleResponseCallback.java (rev 0)
+++ trunk/src/main/java/cc/kune/common/client/utils/SimpleResponseCallback.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -0,0 +1,32 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.common.client.utils;
+
+public interface SimpleResponseCallback {
+ /**
+ * Notifies this callback of an accept response.
+ */
+ void onSuccess();
+
+ /**
+ * Notifies this callback of a cancel.
+ */
+ void onCancel();
+}
Modified: trunk/src/main/java/cc/kune/core/client/services/MediaUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/services/MediaUtils.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/core/client/services/MediaUtils.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -21,7 +21,7 @@
import cc.kune.core.client.state.Session;
-import cc.kune.core.client.ui.utils.ContentPosition;
+import cc.kune.core.client.ui.ContentPosition;
import cc.kune.core.shared.domain.utils.StateToken;
public class MediaUtils {
Copied: trunk/src/main/java/cc/kune/core/client/ui/ContentPosition.java (from rev 1355, trunk/src/main/java/cc/kune/core/client/ui/utils/ContentPosition.java)
===================================================================
--- trunk/src/main/java/cc/kune/core/client/ui/ContentPosition.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/ui/ContentPosition.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -0,0 +1,79 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.core.client.ui;
+
+import org.cobogw.gwt.user.client.CSS;
+
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.inject.Inject;
+
+public class ContentPosition {
+
+ public static final String CENTER = "center";
+ public static final String LEFT = "left";
+ public static final String RIGHT = "right";
+ private static I18nTranslationService i18n;
+ private static Object[][] positionObjs;
+ public static final String[][] POSITIONS = { new String[] { LEFT }, new String[] { CENTER }, new String[] { RIGHT } };
+
+ public synchronized static Object[][] getPositions() {
+ if (positionObjs == null) {
+ final String[][] values = POSITIONS;
+ positionObjs = new Object[values.length][1];
+ int i = 0;
+ for (final String[] position : values) {
+ final Object[] obj = new Object[] { position[0], i18n.t(position[0]) };
+ positionObjs[i++] = obj;
+ }
+ }
+ return positionObjs;
+ }
+
+ public static String setCenterPosition(final String elementCode) {
+ return setPosition(elementCode, false, CENTER);
+ }
+
+ public static Element setPosition(final Element element, final boolean wraptext, final String position) {
+ if (!wraptext || position.equals(ContentPosition.CENTER)) {
+ final com.google.gwt.user.client.Element divEl = DOM.createDiv();
+ CSS.setProperty(divEl, CSS.A.TEXT_ALIGN, position);
+ divEl.setInnerHTML(element.getString());
+ return divEl;
+ } else {
+ CSS.setProperty(element, CSS.A.FLOAT, position);
+ return element;
+ }
+ }
+
+ public static String setPosition(final String elementCode, final boolean wraptext, final String position) {
+ final HTML html = new HTML(elementCode);
+ html.removeStyleName("gwt-HTML");
+ return setPosition(html.getElement(), wraptext, position).getString();
+ }
+
+ @Inject
+ public ContentPosition(final I18nTranslationService i18n) {
+ ContentPosition.i18n = i18n;
+ }
+}
Modified: trunk/src/main/java/cc/kune/core/client/ui/DefaultFormUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/ui/DefaultFormUtils.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/core/client/ui/DefaultFormUtils.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -25,20 +25,18 @@
import com.extjs.gxt.ui.client.widget.form.Radio;
public class DefaultFormUtils {
- public static Radio createRadio(final FieldSet fieldSet, final String radioLabel, final String radioFieldName,
- final String radioTip, final String id) {
- final Radio radio = new Radio();
- radio.setName(radioFieldName);
- radio.setHideLabel(true);
- radio.setId(id);
- fieldSet.add(radio);
+ public static Radio createRadio(final FieldSet fieldSet, final String radioLabel,
+ final String radioFieldName, final String radioTip, final String id) {
+ final Radio radio = new Radio();
+ radio.setName(radioFieldName);
+ radio.setHideLabel(true);
+ radio.setId(id);
+ fieldSet.add(radio);
- if (radioTip != null) {
- Tooltip.to(radio, radioTip);
- radio.setBoxLabel(radioLabel);
- } else {
- radio.setBoxLabel(radioLabel);
- }
- return radio;
+ if (radioTip != null) {
+ Tooltip.to(radio, radioTip);
}
+ radio.setBoxLabel(radioLabel);
+ return radio;
+ }
}
Modified: trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityTextLogo.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityTextLogo.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityTextLogo.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -27,91 +27,92 @@
public class EntityTextLogo extends VerticalPanel {
- public static final String LOGO_NAME = "k-elogop-ln";
- public static final String LOGO_IMAGE = "k-elogop-image";
+ private static final String _100 = "100%";
+ public static final String LOGO_IMAGE = "k-elogop-image";
- private static final String _100 = "100%";
- private static final String LOGO_MEDIUM_FONT_STYLE = "k-elogo-l-m";
- private static final String LOGO_SMALL_FONT_STYLE = "k-elogo-l-s";
- private static final String LOGO_LARGE_FONT_STYLE = "k-elogo-l-l";
- private final Label logoLabel;
- private final Image logoImage;
+ private static final String LOGO_LARGE_FONT_STYLE = "k-elogo-l-l";
+ private static final String LOGO_MEDIUM_FONT_STYLE = "k-elogo-l-m";
+ public static final String LOGO_NAME = "k-elogop-ln";
+ private static final String LOGO_SMALL_FONT_STYLE = "k-elogo-l-s";
+ private final Image logoImage;
+ private final Label logoLabel;
- public EntityTextLogo() {
- // Initialize
- super();
- final HorizontalPanel generalHP = new HorizontalPanel();
- final VerticalPanel logoTextVP = new VerticalPanel();
- logoImage = new Image();
- logoLabel = new Label();
- final Label expandCell = new Label("");
+ public EntityTextLogo() {
+ // Initialize
+ super();
+ final HorizontalPanel generalHP = new HorizontalPanel();
+ final VerticalPanel logoTextVP = new VerticalPanel();
+ logoImage = new Image();
+ logoLabel = new Label();
+ final Label expandCell = new Label("");
- logoImage.ensureDebugId(LOGO_IMAGE);
- logoLabel.ensureDebugId(LOGO_NAME);
+ logoImage.ensureDebugId(LOGO_IMAGE);
+ logoLabel.ensureDebugId(LOGO_NAME);
- // Layout
- add(generalHP);
- generalHP.add(logoImage);
- generalHP.add(logoTextVP);
- logoTextVP.add(logoLabel);
+ // Layout
+ add(generalHP);
+ generalHP.add(logoImage);
+ generalHP.add(logoTextVP);
+ logoTextVP.add(logoLabel);
- // Set properties
+ // Set properties
- expandCell.setStyleName("k-elogop-expand");
- generalHP.setWidth(_100);
- generalHP.setHeight(_100);
- generalHP.setCellWidth(logoTextVP, _100);
- generalHP.setCellHeight(logoTextVP, _100);
- logoTextVP.setWidth(_100);
- logoTextVP.setCellWidth(logoLabel, _100);
- super.setVerticalAlignment(ALIGN_MIDDLE);
- logoTextVP.setVerticalAlignment(ALIGN_MIDDLE);
- generalHP.setVerticalAlignment(ALIGN_MIDDLE);
- setStylePrimaryName("k-entitytextlogo");
- addStyleName("k-entitytextlogo-no-border");
- logoImage.setVisible(false);
- setLogoTextImpl("");
- }
+ expandCell.setStyleName("k-elogop-expand");
+ generalHP.setWidth(_100);
+ generalHP.setHeight(_100);
+ generalHP.setCellWidth(logoTextVP, _100);
+ generalHP.setCellHeight(logoTextVP, _100);
+ logoTextVP.setWidth(_100);
+ logoTextVP.setCellWidth(logoLabel, _100);
+ super.setVerticalAlignment(ALIGN_MIDDLE);
+ logoTextVP.setVerticalAlignment(ALIGN_MIDDLE);
+ generalHP.setVerticalAlignment(ALIGN_MIDDLE);
+ setStylePrimaryName("k-entitytextlogo");
+ addStyleName("k-entitytextlogo-no-border");
+ logoImage.setVisible(false);
+ setLogoTextImpl("");
+ }
- public void setLargeFont() {
- resetFontSize();
- logoLabel.addStyleName(LOGO_LARGE_FONT_STYLE);
- }
+ private void resetFontSize() {
+ logoLabel.removeStyleName(LOGO_LARGE_FONT_STYLE);
+ logoLabel.removeStyleName(LOGO_SMALL_FONT_STYLE);
+ logoLabel.removeStyleName(LOGO_MEDIUM_FONT_STYLE);
+ }
- public void setLogoImage(final AbstractImagePrototype imageProto) {
- imageProto.applyTo(logoImage);
- }
+ public void setLargeFont() {
+ resetFontSize();
+ logoLabel.addStyleName(LOGO_LARGE_FONT_STYLE);
+ }
- public void setLogoImage(final String url) {
- Image.prefetch(url);
- logoImage.setUrl(url);
- }
+ public void setLogoImage(final AbstractImagePrototype imageProto) {
+ imageProto.applyTo(logoImage);
+ }
- public void setLogoText(final String text) {
- setLogoTextImpl(text);
- }
+ public void setLogoImage(final String url) {
+ logoImage.setUrl("images/clear.gif");
+ Image.prefetch(url);
+ logoImage.setUrl(url);
+ }
- public void setLogoVisible(final boolean visible) {
- logoImage.setVisible(visible);
- }
+ public void setLogoText(final String text) {
+ setLogoTextImpl(text);
+ }
- public void setMediumFont() {
- resetFontSize();
- logoLabel.addStyleName(LOGO_MEDIUM_FONT_STYLE);
- }
+ private void setLogoTextImpl(final String text) {
+ logoLabel.setText(text);
+ }
- public void setSmallFont() {
- resetFontSize();
- logoLabel.addStyleName(LOGO_SMALL_FONT_STYLE);
- }
+ public void setLogoVisible(final boolean visible) {
+ logoImage.setVisible(visible);
+ }
- private void resetFontSize() {
- logoLabel.removeStyleName(LOGO_LARGE_FONT_STYLE);
- logoLabel.removeStyleName(LOGO_SMALL_FONT_STYLE);
- logoLabel.removeStyleName(LOGO_MEDIUM_FONT_STYLE);
- }
+ public void setMediumFont() {
+ resetFontSize();
+ logoLabel.addStyleName(LOGO_MEDIUM_FONT_STYLE);
+ }
- private void setLogoTextImpl(final String text) {
- logoLabel.setText(text);
- }
+ public void setSmallFont() {
+ resetFontSize();
+ logoLabel.addStyleName(LOGO_SMALL_FONT_STYLE);
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/core/public/ws.css 2011-05-07 15:55:38 UTC (rev 1357)
@@ -1,6 +1,4 @@
-CHARSET "UTF-8 ";
-
-body {
+CHARSET "UTF-8 "; body {
background-color: white;
color: black;
font-family: 'Ubuntu', Arial;
@@ -797,7 +795,8 @@
white-space: nowrap;
}
*/
-.k-sn-mainpanel .x-btn button,.k-sn-mainpanel button,button.k-button, .gwt-FileUpload {
+.k-sn-mainpanel .x-btn button,.k-sn-mainpanel button,button.k-button,.gwt-FileUpload
+ {
font: 13px 'Ubuntu', arial;
border: 2px solid #CCCCCC;
cursor: pointer;
@@ -832,8 +831,7 @@
}
.k-sn-mainpanel .x-btn button:active,.k-sn-mainpanel button:active,button.k-button:active
- {
- border-top-color: #ffffff;
+ { /* border-top-color: #ffffff; */
background: #ffffff;
}
@@ -888,6 +886,8 @@
button[disabled]:active,button[disabled],input[type="reset"][disabled]:active,input[type="reset"][disabled],input[type="button"][disabled]:active,input[type="button"][disabled],select[disabled]>input[type="button"],select[disabled]>input[type="button"]:active,input[type="submit"][disabled]:active,input[type="submit"][disabled],.k-button-disabled
{
color: gray !important;
+ border-color: #CCCCCC !important;
+ background: inherits !important;
}
/* end buttons */
@@ -1156,7 +1156,7 @@
-webkit-border-bottom-left-radius: 5px;
-moz-border-radius-bottomleft: 5px;
border-bottom-left-radius: 5px;
- kfilter: alpha(opacity = 90);
+ kfilter: alpha(opacity = 90);
-moz-opacity: 0.90;
-khtml-opacity: 0.90;
opacity: 0.90;
@@ -1309,7 +1309,6 @@
}
/* end Decorated tabbar */
-
.k-waveHolder {
position: absolute;
top: 0;
@@ -1318,7 +1317,18 @@
right: 0;
}
-.GWTUpld, table.GWTUpld td {
- font-family: inherits !important;
- font-size: 14px !important;
+.GWTUpld,table.GWTUpld td {
+ font-family: inherits !important;
+ font-size: 14px !important;
}
+
+.x-form-check-wrap {
+ height: inherit;;
+ line-height: inherit;
+}
+
+.k-info-links {
+ text-decoration: underline;
+ color: gray;
+ cursor: pointer;
+}
Modified: trunk/src/main/java/cc/kune/core/shared/dto/LicenseDTO.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/dto/LicenseDTO.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/core/shared/dto/LicenseDTO.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -23,112 +23,112 @@
public class LicenseDTO implements IsSerializable {
- private String shortName;
+ private String description;
- private String longName;
+ private String imageUrl;
- private String description;
+ private boolean isCC;
- private String url;
+ private boolean isCopyleft;
- private boolean isCC;
+ private boolean isDeprecated;
- private boolean isCopyleft;
+ private String longName;
- private boolean isDeprecated;
+ private String rdf;
- private String rdf;
+ private String shortName;
- private String imageUrl;
+ private String url;
- public LicenseDTO() {
- this(null, null, null, null, false, false, false, null, null);
- }
+ public LicenseDTO() {
+ this(null, null, null, null, false, false, false, null, null);
+ }
- public LicenseDTO(final String shortName, final String longName, final String description, final String url,
- final boolean isCC, final boolean isCopyleft, final boolean isDeprecated, final String rdf,
- final String imageUrl) {
- this.shortName = shortName;
- this.longName = longName;
- this.description = description;
- this.url = url;
- this.isCC = isCC;
- this.isCopyleft = isCopyleft;
- this.isDeprecated = isDeprecated;
- this.rdf = rdf;
- this.imageUrl = imageUrl;
- }
+ public LicenseDTO(final String shortName, final String longName, final String description,
+ final String url, final boolean isCC, final boolean isCopyleft, final boolean isDeprecated,
+ final String rdf, final String imageUrl) {
+ this.shortName = shortName;
+ this.longName = longName;
+ this.description = description;
+ this.url = url;
+ this.isCC = isCC;
+ this.isCopyleft = isCopyleft;
+ this.isDeprecated = isDeprecated;
+ this.rdf = rdf;
+ this.imageUrl = imageUrl;
+ }
- public String getShortName() {
- return shortName;
- }
+ public String getDescription() {
+ return description;
+ }
- public void setShortName(final String shortName) {
- this.shortName = shortName;
- }
+ public String getImageUrl() {
+ return imageUrl;
+ }
- public String getLongName() {
- return longName;
- }
+ public String getLongName() {
+ return longName;
+ }
- public void setLongName(final String longName) {
- this.longName = longName;
- }
+ public String getRdf() {
+ return rdf;
+ }
- public String getDescription() {
- return description;
- }
+ public String getShortName() {
+ return shortName;
+ }
- public void setDescription(final String description) {
- this.description = description;
- }
+ public String getUrl() {
+ return url;
+ }
- public String getImageUrl() {
- return imageUrl;
- }
+ public boolean isCC() {
+ return isCC;
+ }
- public void setImageUrl(final String imageUrl) {
- this.imageUrl = imageUrl;
- }
+ public boolean isCopyleft() {
+ return isCopyleft;
+ }
- public String getRdf() {
- return rdf;
- }
+ public boolean isDeprecated() {
+ return isDeprecated;
+ }
- public void setRdf(final String rdf) {
- this.rdf = rdf;
- }
+ public void setCC(final boolean isCC) {
+ this.isCC = isCC;
+ }
- public String getUrl() {
- return url;
- }
+ public void setCopyleft(final boolean isCopyleft) {
+ this.isCopyleft = isCopyleft;
+ }
- public void setUrl(final String url) {
- this.url = url;
- }
+ public void setDeprecated(final boolean isDeprecated) {
+ this.isDeprecated = isDeprecated;
+ }
- public boolean isCC() {
- return isCC;
- }
+ public void setDescription(final String description) {
+ this.description = description;
+ }
- public boolean isCopyleft() {
- return isCopyleft;
- }
+ public void setImageUrl(final String imageUrl) {
+ this.imageUrl = imageUrl;
+ }
- public boolean isDeprecated() {
- return isDeprecated;
- }
+ public void setLongName(final String longName) {
+ this.longName = longName;
+ }
- public void setCC(final boolean isCC) {
- this.isCC = isCC;
- }
+ public void setRdf(final String rdf) {
+ this.rdf = rdf;
+ }
- public void setCopyleft(final boolean isCopyleft) {
- this.isCopyleft = isCopyleft;
- }
+ public void setShortName(final String shortName) {
+ this.shortName = shortName;
+ }
- public void setDeprecated(final boolean isDeprecated) {
- this.isDeprecated = isDeprecated;
- }
+ public void setUrl(final String url) {
+ this.url = url;
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -24,6 +24,19 @@
import cc.kune.core.client.sitebar.search.SitebarSearchPresenter;
import cc.kune.gspace.client.actions.ContentViewerOptionsMenu;
import cc.kune.gspace.client.actions.RenameAction;
+import cc.kune.gspace.client.licensewizard.LicenseChangeAction;
+import cc.kune.gspace.client.licensewizard.LicenseWizard;
+import cc.kune.gspace.client.licensewizard.LicenseWizardPanel;
+import cc.kune.gspace.client.licensewizard.LicenseWizardPresenter;
+import cc.kune.gspace.client.licensewizard.LicenseWizardView;
+import cc.kune.gspace.client.licensewizard.pages.LicenseWizardFirstForm;
+import cc.kune.gspace.client.licensewizard.pages.LicenseWizardFirstFormView;
+import cc.kune.gspace.client.licensewizard.pages.LicenseWizardFrdForm;
+import cc.kune.gspace.client.licensewizard.pages.LicenseWizardFrdFormView;
+import cc.kune.gspace.client.licensewizard.pages.LicenseWizardSndForm;
+import cc.kune.gspace.client.licensewizard.pages.LicenseWizardSndFormView;
+import cc.kune.gspace.client.licensewizard.pages.LicenseWizardTrdForm;
+import cc.kune.gspace.client.licensewizard.pages.LicenseWizardTrdFormView;
import cc.kune.gspace.client.options.GroupOptions;
import cc.kune.gspace.client.options.GroupOptionsCollection;
import cc.kune.gspace.client.options.GroupOptionsPanel;
@@ -142,5 +155,15 @@
// Actions
s(ContentViewerOptionsMenu.class);
s(RenameAction.class);
+
+ // LicenseWizard
+ bindPresenter(LicenseWizardPresenter.class, LicenseWizardView.class, LicenseWizardPanel.class,
+ LicenseWizardPresenter.LicenseWizardProxy.class);
+ s(LicenseWizard.class, LicenseWizardPresenter.class);
+ s(LicenseWizardFirstFormView.class, LicenseWizardFirstForm.class);
+ s(LicenseWizardSndFormView.class, LicenseWizardSndForm.class);
+ s(LicenseWizardTrdFormView.class, LicenseWizardTrdForm.class);
+ s(LicenseWizardFrdFormView.class, LicenseWizardFrdForm.class);
+ s(LicenseChangeAction.class);
}
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceGinjector.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceGinjector.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceGinjector.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -1,6 +1,7 @@
package cc.kune.gspace.client;
import cc.kune.core.client.sitebar.search.SitebarSearchPresenter;
+import cc.kune.gspace.client.licensewizard.LicenseWizardPresenter;
import cc.kune.gspace.client.tags.TagsSummaryPresenter;
import cc.kune.gspace.client.tool.ContentViewerSelector;
import cc.kune.gspace.client.tool.selector.ToolSelectorPresenter;
@@ -23,6 +24,8 @@
GSpaceParts getGSpaceParts();
+ AsyncProvider<LicenseWizardPresenter> getLicenseWizardPresenter();
+
AsyncProvider<SitebarSearchPresenter> getSitebarSearchPresenter();
AsyncProvider<TagsSummaryPresenter> getTagsSummaryPresenter();
Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -39,16 +39,6 @@
final Provider<GroupOptionsToolsConf> gtc, final Provider<UserOptionsDefLicense> udl,
final Provider<UserOptionsPublicSpaceConf> ups, final Provider<UserOptionsLogo> ul,
final Provider<UserOptionsToolsConf> utc, final Provider<SitebarSearchPresenter> siteSearch) {
- // , final Provider<GroupOptionsPanel> gop,
- // , final Provider<UserOptionsPanel> uop,
- // final Provider<GroupOptionsPublicSpaceConfPanel> gpsp,
- // final Provider<GroupOptionsDefLicensePanel> gdlp,
- // final Provider<GroupOptionsLogoPanel> glp,
- // final Provider<GroupOptionsToolsConfPanel> gtcp,
- // final Provider<UserOptionsLogoPanel> ulp,
- // final Provider<UserOptionsDefLicensePanel> udlp,
- // final Provider<UserOptionsPublicSpaceConfPanel> upsp,
- // final Provider<UserOptionsToolsConfPanel> utcp
session.onAppStart(true, new AppStartHandler() {
@Override
Copied: trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChangeAction.java (from rev 1355, trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseChangeAction.java)
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChangeAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChangeAction.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -0,0 +1,70 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.gspace.client.licensewizard;
+
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.client.utils.SimpleResponseCallback;
+import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
+import cc.kune.core.client.rpcservices.GroupServiceAsync;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.domain.utils.StateToken;
+import cc.kune.core.shared.dto.LicenseDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class LicenseChangeAction {
+ private final Provider<GroupServiceAsync> groupService;
+ private final I18nTranslationService i18n;
+ private final Session session;
+ private final StateManager stateManager;
+
+ @Inject
+ public LicenseChangeAction(final Provider<GroupServiceAsync> groupService, final Session session,
+ final I18nTranslationService i18n, final StateManager stateManager) {
+ this.groupService = groupService;
+ this.session = session;
+ this.i18n = i18n;
+ this.stateManager = stateManager;
+ }
+
+ public void changeLicense(final StateToken token, final LicenseDTO license,
+ final SimpleResponseCallback callback) {
+ NotifyUser.showProgressProcessing();
+ groupService.get().changeDefLicense(session.getUserHash(), token, license,
+ new AsyncCallbackSimple<Void>() {
+ @Override
+ public void onFailure(final Throwable caught) {
+ super.onFailure(caught);
+ NotifyUser.hideProgress();
+ NotifyUser.error(i18n.t("Error changing license"));
+ callback.onCancel();
+ }
+
+ @Override
+ public void onSuccess(final Void result) {
+ stateManager.reload();
+ callback.onSuccess();
+ }
+ });
+ }
+}
Added: trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChooseCallback.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChooseCallback.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChooseCallback.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -0,0 +1,9 @@
+package cc.kune.gspace.client.licensewizard;
+
+import cc.kune.core.shared.dto.LicenseDTO;
+
+public interface LicenseChooseCallback {
+
+ void onSelected(LicenseDTO license);
+
+}
Property changes on: trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChooseCallback.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseWizard.java (from rev 1355, trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizard.java)
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseWizard.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseWizard.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -0,0 +1,26 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.gspace.client.licensewizard;
+
+public interface LicenseWizard {
+
+ void start(LicenseChooseCallback callback);
+
+}
Copied: trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseWizardPanel.java (from rev 1355, trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPanel.java)
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseWizardPanel.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseWizardPanel.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -0,0 +1,69 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.gspace.client.licensewizard;
+
+import cc.kune.common.client.ui.MaskWidget;
+import cc.kune.common.client.ui.dialogs.wizard.WizardDialog;
+import cc.kune.common.client.ui.dialogs.wizard.WizardListener;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
+
+public class LicenseWizardPanel extends WizardDialog implements LicenseWizardView {
+
+ public static final String BACK_BTN_ID = "k-lwp-back-btn";
+ public static final String CANCEL_BTN_ID = "k-lwp-cancel-btn";
+ public static final String CLOSE_BTN_ID = "k-lwp-close-btn";
+ public static final String FINISH_BTN_ID = "k-lwp-finish-btn";
+ public static final String LIC_WIZ_DIALOG = "k-lwp-diag";
+ public static final String NEXT_BTN_ID = "k-lwp-next-btn";
+
+ @Inject
+ public LicenseWizardPanel(final MaskWidget maskWidget, final I18nTranslationService i18n,
+ final CoreResources res) {
+ super(LIC_WIZ_DIALOG, i18n.t("License wizard"), true, false, WIDTH, null, BACK_BTN_ID, NEXT_BTN_ID,
+ FINISH_BTN_ID, CANCEL_BTN_ID, CLOSE_BTN_ID, i18n, maskWidget);
+ super.setFinishText(i18n.t("Select"));
+ super.setIcon(res.copyleft());
+ }
+
+ @Override
+ public void addToSlot(final Object slot, final Widget content) {
+ }
+
+ @Override
+ public Widget asWidget() {
+ return null;
+ }
+
+ @Override
+ public void removeFromSlot(final Object slot, final Widget content) {
+ }
+
+ @Override
+ public void setInSlot(final Object slot, final Widget content) {
+ }
+
+ public void setWizardListener(final WizardListener listener) {
+ super.setListener(listener);
+ }
+}
Copied: trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseWizardPresenter.java (from rev 1355, trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenter.java)
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseWizardPresenter.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseWizardPresenter.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -0,0 +1,267 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.gspace.client.licensewizard;
+
+import java.util.List;
+
+import cc.kune.common.client.log.Log;
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.client.ui.dialogs.wizard.WizardListener;
+import cc.kune.common.client.utils.SimpleCallback;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.dto.LicenseDTO;
+import cc.kune.gspace.client.licensewizard.pages.LicenseWizardFirstFormView;
+import cc.kune.gspace.client.licensewizard.pages.LicenseWizardFrdFormView;
+import cc.kune.gspace.client.licensewizard.pages.LicenseWizardSndFormView;
+import cc.kune.gspace.client.licensewizard.pages.LicenseWizardTrdFormView;
+
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.user.client.ui.IsWidget;
+import com.google.inject.Inject;
+import com.gwtplatform.mvp.client.Presenter;
+import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
+import com.gwtplatform.mvp.client.proxy.Proxy;
+import com.gwtplatform.mvp.client.proxy.RevealRootContentEvent;
+
+public class LicenseWizardPresenter extends
+ Presenter<LicenseWizardView, LicenseWizardPresenter.LicenseWizardProxy> implements LicenseWizard {
+
+ @ProxyCodeSplit
+ public interface LicenseWizardProxy extends Proxy<LicenseWizardPresenter> {
+ }
+
+ private final String ccVers;
+ private final LicenseWizardFrdFormView frdForm;
+ private final LicenseWizardFirstFormView fstForm;
+ private LicenseChooseCallback selectLicenseListener;
+ private final Session session;
+ private final LicenseWizardSndFormView sndForm;
+
+ private final LicenseWizardTrdFormView trdForm;
+
+ @Inject
+ public LicenseWizardPresenter(final EventBus eventBus, final LicenseWizardView view,
+ final LicenseWizardProxy proxy, final LicenseWizardFirstFormView firstForm,
+ final LicenseWizardSndFormView sndForm, final LicenseWizardTrdFormView trdForm,
+ final LicenseWizardFrdFormView frdForm, final Session session) {
+ super(eventBus, view, proxy);
+ this.fstForm = firstForm;
+ this.sndForm = sndForm;
+ this.trdForm = trdForm;
+ this.frdForm = frdForm;
+ this.session = session;
+ ccVers = "-" + session.getCurrentCCversion();
+ }
+
+ private LicenseDTO getLicenseFromShortName(final String shortName) {
+ final List<LicenseDTO> licenses = session.getLicenses();
+ for (int i = 0; i < licenses.size(); i++) {
+ final LicenseDTO licenseDTO = licenses.get(i);
+ if (licenseDTO.getShortName().equals(shortName)) {
+ return licenseDTO;
+ }
+ }
+ Log.error("Internal error: License not found");
+ throw new IndexOutOfBoundsException("License not found");
+ }
+
+ private boolean in(final IsWidget page) {
+ return getView().isCurrentPage(page);
+ }
+
+ void onAnotherLicenseSelecterd() {
+ getView().setEnabled(false, true, true, false);
+ }
+
+ public void onBack() {
+ if (getView().isCurrentPage(sndForm)) {
+ showFst();
+ } else if (in(trdForm)) {
+ showSnd();
+ } else if (in(frdForm)) {
+ showSnd();
+ } else {
+ Log.error("Programatic error in LicenseWizardPresenter");
+ }
+ }
+
+ @Override
+ protected void onBind() {
+ super.onBind();
+ fstForm.onChange(new SimpleCallback() {
+ @Override
+ public void onCallback() {
+ if (fstForm.isCopyleft()) {
+ onCopyLeftLicenseSelected();
+ } else {
+ onAnotherLicenseSelecterd();
+ }
+ }
+ });
+ trdForm.onChange(new SimpleCallback() {
+ @Override
+ public void onCallback() {
+ onCreativeCommonsChanged();
+ }
+ });
+ frdForm.onChange(new SimpleCallback() {
+ @Override
+ public void onCallback() {
+ if (frdForm.getSelectedLicense().length() > 0) {
+ getView().setEnabled(true, false, true, true);
+ }
+ }
+ });
+ getView().add(fstForm);
+ getView().add(sndForm);
+ getView().add(trdForm);
+ getView().add(frdForm);
+ final WizardListener listener = new WizardListener() {
+
+ @Override
+ public void onBack() {
+ LicenseWizardPresenter.this.onBack();
+
+ }
+
+ @Override
+ public void onCancel() {
+ LicenseWizardPresenter.this.onCancel();
+
+ }
+
+ @Override
+ public void onClose() {
+ LicenseWizardPresenter.this.onClose();
+ }
+
+ @Override
+ public void onFinish() {
+ LicenseWizardPresenter.this.onChange();
+ }
+
+ @Override
+ public void onNext() {
+ LicenseWizardPresenter.this.onNext();
+ }
+ };
+ getView().setListener(listener);
+ reset();
+ }
+
+ public void onCancel() {
+ getView().hide();
+ }
+
+ public void onChange() {
+ String licenseShortName;
+ if (in(fstForm)) {
+ licenseShortName = "by-sa" + ccVers;
+ } else if (in(trdForm)) {
+ if (trdForm.isAllowComercial()) {
+ licenseShortName = trdForm.isAllowModif() ? "by" + ccVers
+ : trdForm.isAllowModifShareAlike() ? "by-sa" + ccVers : "by-nd" + ccVers;
+ } else {
+ licenseShortName = trdForm.isAllowModif() ? "by-nc" + ccVers
+ : trdForm.isAllowModifShareAlike() ? "by-nc-sa" + ccVers : "by-nc-nd" + ccVers;
+ }
+ } else if (in(sndForm)) {
+ licenseShortName = "by-sa" + ccVers;
+ NotifyUser.error("Programatic error in LicenseWizardPresenter");
+ } else {
+ licenseShortName = frdForm.getSelectedLicense();
+ }
+ getView().hide();
+ selectLicenseListener.onSelected(getLicenseFromShortName(licenseShortName));
+ }
+
+ public void onClose() {
+ getView().hide();
+ }
+
+ void onCopyLeftLicenseSelected() {
+ getView().setEnabled(false, false, true, true);
+ }
+
+ private void onCreativeCommonsChanged() {
+ final boolean isCopyleft = trdForm.isAllowComercial() && trdForm.isAllowModifShareAlike();
+ final boolean isAppropiateForCulturalWorks = trdForm.isAllowComercial()
+ && (trdForm.isAllowModif() || trdForm.isAllowModifShareAlike());
+ trdForm.setFlags(isCopyleft, isAppropiateForCulturalWorks, !trdForm.isAllowComercial());
+ }
+
+ public void onNext() {
+ if (in(fstForm)) {
+ getView().clear();
+ showSnd();
+ } else if (in(sndForm)) {
+ if (sndForm.isCommonLicensesSelected()) {
+ showTrd();
+ } else {
+ showFrd();
+ }
+ } else {
+ Log.error("Programatic error in LicenseWizardPresenter");
+ }
+ }
+
+ private void reset() {
+ getView().clear();
+ getView().setEnabled(false, false, true, true);
+ getView().show(fstForm);
+ fstForm.reset();
+ sndForm.reset();
+ trdForm.reset();
+ frdForm.reset();
+ }
+
+ @Override
+ protected void revealInParent() {
+ RevealRootContentEvent.fire(this, this);
+ }
+
+ private void showFrd() {
+ getView().show(frdForm);
+ getView().setEnabled(true, false, true, false);
+ }
+
+ private void showFst() {
+ getView().clear();
+ getView().show(fstForm);
+ getView().setEnabled(false, true, true, true);
+ }
+
+ private void showSnd() {
+ getView().show(sndForm);
+ getView().setEnabled(true, true, true, false);
+ }
+
+ private void showTrd() {
+ getView().show(trdForm);
+ getView().setEnabled(true, false, true, true);
+ }
+
+ @Override
+ public void start(final LicenseChooseCallback selectLicenseListener) {
+ this.selectLicenseListener = selectLicenseListener;
+ reset();
+ getView().show();
+ }
+}
Copied: trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseWizardView.java (from rev 1355, trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardView.java)
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseWizardView.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseWizardView.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -0,0 +1,31 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.gspace.client.licensewizard;
+
+import cc.kune.common.client.ui.dialogs.wizard.WizardDialogView;
+
+import com.gwtplatform.mvp.client.View;
+
+public interface LicenseWizardView extends WizardDialogView, View {
+
+ String HEIGHT = "350px";
+ String WIDTH = "400px";
+
+}
Copied: trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages (from rev 1355, trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages)
Modified: trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardFirstForm.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardFirstForm.java 2011-05-06 14:45:24 UTC (rev 1355)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardFirstForm.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -17,110 +17,112 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-package org.ourproject.kune.workspace.client.licensewizard.pages;
+package cc.kune.gspace.client.licensewizard.pages;
-import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm;
-import org.ourproject.kune.platf.client.ui.dialogs.DefaultFormUtils;
-import org.ourproject.kune.workspace.client.licensewizard.LicenseWizardView;
-
+import cc.kune.common.client.utils.SimpleCallback;
import cc.kune.common.client.utils.TextUtils;
+import cc.kune.core.client.ui.DefaultForm;
+import cc.kune.core.client.ui.DefaultFormUtils;
import cc.kune.core.shared.i18n.I18nTranslationService;
-import com.calclab.suco.client.events.Listener0;
-import com.gwtext.client.widgets.form.Checkbox;
-import com.gwtext.client.widgets.form.FieldSet;
-import com.gwtext.client.widgets.form.Label;
-import com.gwtext.client.widgets.form.Radio;
-import com.gwtext.client.widgets.form.event.CheckboxListenerAdapter;
+import com.extjs.gxt.ui.client.Style.Orientation;
+import com.extjs.gxt.ui.client.event.BaseEvent;
+import com.extjs.gxt.ui.client.event.Events;
+import com.extjs.gxt.ui.client.event.Listener;
+import com.extjs.gxt.ui.client.widget.form.FieldSet;
+import com.extjs.gxt.ui.client.widget.form.Radio;
+import com.extjs.gxt.ui.client.widget.form.RadioGroup;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
public class LicenseWizardFirstForm extends DefaultForm implements LicenseWizardFirstFormView {
- private static final String POINT = "» ";
- public static final String RADIO_ANOTHER_ID = "k-lwff-another";
- public static final String RADIO_COPYLEFT_ID = "k-lwff-copyleft";
- private static final String RADIO_FIELD_NAME = "k-lwff-radio";
- private final Radio anotherLicenseRadio;
- // private final Event0 onCopyLeftLicenseSelected;
- // private final Event0 onAnotherLicenseSelected;
- private final Radio copyleftRadio;
+ private static final String POINT = "» ";
+ public static final String RADIO_ANOTHER_ID = "k-lwff-another";
+ public static final String RADIO_COPYLEFT_ID = "k-lwff-copyleft";
+ private static final String RADIO_FIELD_NAME = "k-lwff-radio";
+ private final Radio anotherLicenseRadio;
+ private final Radio copyleftRadio;
+ private SimpleCallback onChange;
- public LicenseWizardFirstForm(final I18nTranslationService i18n) {
- // this.onCopyLeftLicenseSelected = new
- // Event0("onCopyLeftLicenseSelected");
- // this.onAnotherLicenseSelected = new
- // Event0("onAnotherLicenseSelected");
- super.setFrame(true);
- super.setPaddings(10);
- super.setHeight(LicenseWizardView.HEIGHT);
+ @Inject
+ public LicenseWizardFirstForm(final I18nTranslationService i18n) {
+ super.setFrame(true);
+ super.setPadding(10);
+ super.setAutoHeight(true);
+ // super.setHeight(LicenseWizardView.HEIGHT);
- final Label intro = new Label();
- intro.setHtml(i18n.t("Select a license to share your group contents with other people:")
- + DefaultFormUtils.brbr());
+ final Label intro = new Label();
+ intro.setText(i18n.t("Select a license to share your group contents with other people:"));
- final FieldSet fieldSet = new FieldSet("license recommended");
- fieldSet.setStyle("margin-left: 105px");
- fieldSet.setWidth(250);
- copyleftRadio = DefaultFormUtils.createRadio(fieldSet, i18n.t("Use a copyleft license (recommended)"),
- RADIO_FIELD_NAME, null, RADIO_COPYLEFT_ID);
- anotherLicenseRadio = DefaultFormUtils.createRadio(fieldSet, i18n.t("Use another kind of license (advanced)"),
- RADIO_FIELD_NAME, null, RADIO_ANOTHER_ID);
- copyleftRadio.addListener(new CheckboxListenerAdapter() {
- @Override
- public void onCheck(final Checkbox field, final boolean checked) {
- if (checked) {
- // onCopyLeftLicenseSelected.fire();
- }
- }
- });
- anotherLicenseRadio.addListener(new CheckboxListenerAdapter() {
- @Override
- public void onCheck(final Checkbox field, final boolean checked) {
- if (checked) {
- // onAnotherLicenseSelected.fire();
- }
- }
- });
+ final FieldSet fieldSet = new FieldSet();
+ // fieldSet.setTitle(i18n.t("license recommended"));
+ fieldSet.addStyleName("margin-left: 105px");
+ fieldSet.setWidth(250);
+ copyleftRadio = DefaultFormUtils.createRadio(fieldSet,
+ i18n.t("Use a copyleft license (recommended)"), RADIO_FIELD_NAME, null, RADIO_COPYLEFT_ID);
+ anotherLicenseRadio = DefaultFormUtils.createRadio(fieldSet,
+ i18n.t("Use another kind of license (advanced)"), RADIO_FIELD_NAME, null, RADIO_ANOTHER_ID);
- final FieldSet infoFS = new FieldSet("Info");
- infoFS.setFrame(false);
- infoFS.setIconCls("k-info-icon");
- infoFS.setCollapsible(false);
- infoFS.setAutoHeight(true);
+ final RadioGroup radioGroup = new RadioGroup();
+ radioGroup.add(copyleftRadio);
+ radioGroup.add(anotherLicenseRadio);
+ radioGroup.setOrientation(Orientation.VERTICAL);
+ radioGroup.setHideLabel(true);
+ radioGroup.addListener(Events.Change, new Listener<BaseEvent>() {
+ @Override
+ public void handleEvent(final BaseEvent be) {
+ onChange.onCallback();
+ }
+ });
- final Label recommendCopyleft = new Label();
- final Label whyALicense = new Label();
- final Label youCanChangeTheLicenseLater = new Label();
- recommendCopyleft.setHtml(POINT
- + i18n.t("We recommend [%s] licenses, specially for practical works",
- TextUtils.generateHtmlLink("http://en.wikipedia.org/wiki/Copyleft", i18n.t("copyleft")))
- + DefaultFormUtils.br());
- whyALicense.setHtml(POINT
- + TextUtils.generateHtmlLink("http://mirrors.creativecommons.org/getcreative/",
- i18n.t("Why do we need a license?")) + DefaultFormUtils.br());
- youCanChangeTheLicenseLater.setHtml(POINT + i18n.t("You can change this license later") + DefaultFormUtils.br());
+ final FieldSet infoFS = new FieldSet();
+ infoFS.setHeading("Info");
+ // infoFS.setFrame(false);
+ // infoFS.setIcon("k-info-icon");
+ infoFS.setCollapsible(false);
+ infoFS.setAutoHeight(true);
- infoFS.addStyleName("kune-Margin-20-t");
- add(intro);
- add(copyleftRadio);
- add(anotherLicenseRadio);
- infoFS.add(recommendCopyleft);
- infoFS.add(whyALicense);
- infoFS.add(youCanChangeTheLicenseLater);
- add(infoFS);
- }
+ final HTML recommendCopyleft = new HTML();
+ final HTML whyALicense = new HTML();
+ final HTML youCanChangeTheLicenseLater = new HTML();
+ recommendCopyleft.setHTML(POINT
+ + i18n.t("We recommend [%s] licenses, specially for practical works",
+ TextUtils.generateHtmlLink("http://en.wikipedia.org/wiki/Copyleft", i18n.t("copyleft"))));
+ whyALicense.setHTML(POINT
+ + TextUtils.generateHtmlLink("http://mirrors.creativecommons.org/getcreative/",
+ i18n.t("Why do we need a license?")));
+ youCanChangeTheLicenseLater.setHTML(POINT + i18n.t("You can change this license later"));
- @Override
- public void onAnotherLicenseSelected(final Listener0 slot) {
- // onAnotherLicenseSelected.add(slot);
- }
+ infoFS.addStyleName("kune-Margin-20-t");
+ add(intro);
+ add(radioGroup);
+ infoFS.add(recommendCopyleft);
+ infoFS.add(whyALicense);
+ infoFS.add(youCanChangeTheLicenseLater);
+ add(infoFS);
+ }
- @Override
- public void onCopyLeftLicenseSelected(final Listener0 slot) {
- // onCopyLeftLicenseSelected.add(slot);
- }
+ @Override
+ public Widget asWidget() {
+ return this.getFormPanel();
+ }
- @Override
- public void reset() {
- super.reset();
- copyleftRadio.setChecked(true);
- }
+ @Override
+ public boolean isCopyleft() {
+ return copyleftRadio.getValue();
+ }
+
+ @Override
+ public void onChange(final SimpleCallback onChange) {
+ this.onChange = onChange;
+ }
+
+ @Override
+ public void reset() {
+ super.reset();
+ copyleftRadio.setValue(true);
+ }
+
}
Modified: trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardFirstFormView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardFirstFormView.java 2011-05-06 14:45:24 UTC (rev 1355)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardFirstFormView.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -17,16 +17,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-package org.ourproject.kune.workspace.client.licensewizard.pages;
+package cc.kune.gspace.client.licensewizard.pages;
-import org.ourproject.kune.platf.client.View;
+import cc.kune.common.client.utils.SimpleCallback;
-import com.calclab.suco.client.events.Listener0;
+import com.google.gwt.user.client.ui.IsWidget;
-public interface LicenseWizardFirstFormView extends View {
- void onAnotherLicenseSelected(Listener0 slot);
+public interface LicenseWizardFirstFormView extends IsWidget {
- void onCopyLeftLicenseSelected(Listener0 slot);
+ boolean isCopyleft();
- void reset();
+ void onChange(SimpleCallback onChange);
+
+ void reset();
+
}
Modified: trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardFlags.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardFlags.java 2011-05-06 14:45:24 UTC (rev 1355)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardFlags.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -17,74 +17,78 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-package org.ourproject.kune.workspace.client.licensewizard.pages;
+package cc.kune.gspace.client.licensewizard.pages;
-import org.ourproject.kune.platf.client.services.Images;
-import org.ourproject.kune.platf.client.ui.IconLabel;
-
+import cc.kune.common.client.ui.IconLabel;
import cc.kune.common.client.ui.KuneWindowUtils;
+import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
-import com.gwtext.client.widgets.Panel;
+import com.google.gwt.user.client.ui.FlowPanel;
-public class LicenseWizardFlags extends Panel {
- private final IconLabel copyleft;
- private final IconLabel nonCopyleft;
- private final IconLabel culturalWorks;
- private final IconLabel nonCulturalWorks;
- private final IconLabel nonCommercialReasons;
+public class LicenseWizardFlags extends FlowPanel {
+ private final IconLabel copyleft;
+ private final IconLabel culturalWorks;
+ private final IconLabel nonCommercialReasons;
+ private final IconLabel nonCopyleft;
+ private final IconLabel nonCulturalWorks;
- public LicenseWizardFlags(final Images images, final I18nTranslationService i18n) {
- copyleft = new IconLabel(images.copyleft(), i18n.t("This is a copyleft license."));
- nonCopyleft = new IconLabel(images.noCopyleft(), i18n.t("This is not a copyleft license."));
- culturalWorks = new IconLabel(images.info(), i18n.t("This is appropriate for free cultural works."));
- nonCulturalWorks = new IconLabel(images.alert(), i18n.t("This is not appropriate for free cultural works."));
- nonCommercialReasons = new IconLabel(images.alert(), i18n.t("Reasons not to use a non commercial license."));
- addLink(copyleft, "http://en.wikipedia.org/wiki/Copyleft");
- addLink(nonCopyleft, "http://en.wikipedia.org/wiki/Copyleft");
- addLink(culturalWorks, "http://freedomdefined.org/");
- addLink(nonCulturalWorks, "http://freedomdefined.org/");
- addLink(nonCommercialReasons, "http://freedomdefined.org/Licenses/NC");
- add(copyleft);
- add(nonCopyleft);
- add(culturalWorks);
- add(nonCulturalWorks);
- add(nonCommercialReasons);
- }
+ public LicenseWizardFlags(final CoreResources images, final I18nTranslationService i18n) {
+ copyleft = new IconLabel(images.copyleft(), i18n.t("This is a copyleft license."));
+ nonCopyleft = new IconLabel(images.noCopyleft(), i18n.t("This is not a copyleft license."));
+ culturalWorks = new IconLabel(images.info(), i18n.t("This is appropriate for free cultural works."));
+ nonCulturalWorks = new IconLabel(images.alert(),
+ i18n.t("This is not appropriate for free cultural works."));
+ nonCommercialReasons = new IconLabel(images.alert(),
+ i18n.t("Reasons not to use a non commercial license."));
+ addLink(copyleft, "http://en.wikipedia.org/wiki/Copyleft");
+ addLink(nonCopyleft, "http://en.wikipedia.org/wiki/Copyleft");
+ addLink(culturalWorks, "http://freedomdefined.org/");
+ addLink(nonCulturalWorks, "http://freedomdefined.org/");
+ addLink(nonCommercialReasons, "http://freedomdefined.org/Licenses/NC");
+ add(copyleft);
+ add(nonCopyleft);
+ add(culturalWorks);
+ add(nonCulturalWorks);
+ add(nonCommercialReasons);
+ }
- public void setCopyleft(final boolean isCopyleft) {
- copyleft.setVisible(isCopyleft);
- nonCopyleft.setVisible(!isCopyleft);
- }
+ private void addLink(final IconLabel label, final String url) {
+ label.addDomHandler(new ClickHandler() {
- public void setCulturalWorks(final boolean isAppropiateForCulturalWorks) {
- culturalWorks.setVisible(isAppropiateForCulturalWorks);
- nonCulturalWorks.setVisible(!isAppropiateForCulturalWorks);
- }
+ @Override
+ public void onClick(final ClickEvent event) {
+ openWindow(url);
+ }
- public void setNonComercial(final boolean isNonComercial) {
- nonCommercialReasons.setVisible(isNonComercial);
- }
+ private void openWindow(final String url) {
+ KuneWindowUtils.open(url);
+ }
+ }, ClickEvent.getType());
- public void setVisible(final boolean isCopyleft, final boolean isAppropiateForCulturalWorks,
- final boolean isNonComercial) {
- setCopyleft(isCopyleft);
- setCulturalWorks(isAppropiateForCulturalWorks);
- setNonComercial(isNonComercial);
- }
+ label.addStyleName("k-info-links");
+ }
- private void addLink(final IconLabel label, final String url) {
- label.addClickHandler(new ClickHandler() {
- public void onClick(final ClickEvent event) {
- openWindow(url);
- }
+ public void setCopyleft(final boolean isCopyleft) {
+ copyleft.setVisible(isCopyleft);
+ nonCopyleft.setVisible(!isCopyleft);
+ }
- private void openWindow(final String url) {
- KuneWindowUtils.open(url);
- }
- });
- label.setStyleNameToText("k-info-links");
- }
+ public void setCulturalWorks(final boolean isAppropiateForCulturalWorks) {
+ culturalWorks.setVisible(isAppropiateForCulturalWorks);
+ nonCulturalWorks.setVisible(!isAppropiateForCulturalWorks);
+ }
+
+ public void setNonComercial(final boolean isNonComercial) {
+ nonCommercialReasons.setVisible(isNonComercial);
+ }
+
+ public void setVisible(final boolean isCopyleft, final boolean isAppropiateForCulturalWorks,
+ final boolean isNonComercial) {
+ setCopyleft(isCopyleft);
+ setCulturalWorks(isAppropiateForCulturalWorks);
+ setNonComercial(isNonComercial);
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardFrdForm.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardFrdForm.java 2011-05-06 14:45:24 UTC (rev 1355)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardFrdForm.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -17,117 +17,149 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-package org.ourproject.kune.workspace.client.licensewizard.pages;
+package cc.kune.gspace.client.licensewizard.pages;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm;
-import org.ourproject.kune.platf.client.ui.dialogs.DefaultFormUtils;
-import org.ourproject.kune.workspace.client.licensewizard.LicenseWizardView;
-
+import cc.kune.common.client.utils.SimpleCallback;
import cc.kune.core.client.state.Session;
+import cc.kune.core.client.ui.DefaultForm;
import cc.kune.core.shared.dto.LicenseDTO;
import cc.kune.core.shared.i18n.I18nTranslationService;
-import com.calclab.suco.client.events.Listener0;
-import com.gwtext.client.core.Template;
-import com.gwtext.client.data.Record;
-import com.gwtext.client.data.SimpleStore;
-import com.gwtext.client.data.Store;
-import com.gwtext.client.widgets.form.ComboBox;
-import com.gwtext.client.widgets.form.Label;
-import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
+import com.extjs.gxt.ui.client.data.BaseModel;
+import com.extjs.gxt.ui.client.event.BaseEvent;
+import com.extjs.gxt.ui.client.event.Events;
+import com.extjs.gxt.ui.client.event.Listener;
+import com.extjs.gxt.ui.client.store.ListStore;
+import com.extjs.gxt.ui.client.widget.form.ComboBox;
+import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
public class LicenseWizardFrdForm extends DefaultForm implements LicenseWizardFrdFormView {
- public static final String COMMON_LICENSES_ID = "k-lwsf-common";
- public static final String OTHER_LICENSES_ID = "k-lwsf-other";
- public static final String RADIO_FIELD_NAME = "k-lwsf-radio";
- private final ComboBox cb;
- // private final Event0 onChange;
- private final Session session;
- public LicenseWizardFrdForm(final I18nTranslationService i18n, final Session session) {
- this.session = session;
- // this.onChange = new Event0("onChange");
- setFrame(true);
- super.setPaddings(10);
- super.setHeight(LicenseWizardView.HEIGHT);
+ public class LicenseData extends BaseModel {
- final Label intro = new Label();
- intro.setHtml(i18n.t("Select other kind of licenses:") + DefaultFormUtils.brbr());
+ private static final String LONGNAME = "longname";
+ private static final String SHORTNAME = "shortname";
+ private static final String URL = "url";
- final Store store = new SimpleStore(new String[] { "shortname", "longname", "url" }, getNonCCLicenses());
- store.load();
+ public LicenseData(final LicenseDTO license) {
+ this(license.getShortName(), license.getLongName(), license.getUrl());
+ }
- final Template template = new Template("<div class=\"x-combo-list-item\">" + "<img src=\"{url}\"> "
- + "{longname}<div class=\"x-clear\"></div></div>");
-
- super.setHideLabels(true);
-
- cb = new ComboBox();
- cb.setMinChars(1);
- // cb.setFieldLabel("Other licenses");
- cb.setLabelSeparator("");
- cb.setStore(store);
- cb.setDisplayField("longname");
- cb.setValueField("shortname");
- cb.setMode(ComboBox.LOCAL);
- cb.setTriggerAction(ComboBox.ALL);
- cb.setEmptyText(i18n.t("Select license"));
- cb.setTypeAhead(true);
- cb.setSelectOnFocus(true);
- cb.setEditable(false);
- cb.setWidth(300);
- cb.setResizable(true);
- cb.setTpl(template);
- cb.setTitle("Licenses");
- cb.addListener(new ComboBoxListenerAdapter() {
- @Override
- public void onSelect(final ComboBox comboBox, final Record record, final int index) {
- // onChange.fire();
- }
- });
- add(intro);
- add(cb);
+ public LicenseData(final String shortname, final String longname, final String url) {
+ set(SHORTNAME, shortname);
+ set(LONGNAME, longname);
+ set(URL, url);
}
- private String[][] getNonCCLicenses() {
- final ArrayList<LicenseDTO> licensesNonCCList = new ArrayList<LicenseDTO>();
- final List<LicenseDTO> licenses = session.getLicenses();
- for (final LicenseDTO license : licenses) {
- if (!license.isCC()) {
- licensesNonCCList.add(license);
- }
- }
- final String[][] licensesArray = new String[licensesNonCCList.size()][3];
- for (int i = 0; i < licensesNonCCList.size(); i++) {
- final LicenseDTO license = licensesNonCCList.get(i);
- licensesArray[i][0] = license.getShortName();
- licensesArray[i][1] = license.getLongName();
- licensesArray[i][2] = license.getImageUrl();
- }
- return licensesArray;
+ public String getLongname() {
+ return get(LONGNAME);
}
- @Override
- public String getSelectedLicense() {
- return cb.getValueAsString();
+ public String getShortname() {
+ return get(SHORTNAME);
}
- @Override
- public void onChange(final Listener0 slot) {
- // onChange.add(slot);
+ public String getUrl() {
+ return get(URL);
}
+ }
- @Override
- public void reset() {
- super.reset();
+ public static final String COMMON_LICENSES_ID = "k-lwsf-common";
+ public static final String OTHER_LICENSES_ID = "k-lwsf-other";
+ public static final String RADIO_FIELD_NAME = "k-lwsf-radio";
+ private final ComboBox<LicenseData> cb;
+
+ private SimpleCallback onChange;
+ private final Session session;
+
+ @Inject
+ public LicenseWizardFrdForm(final I18nTranslationService i18n, final Session session) {
+ this.session = session;
+
+ // this.onChange = new Event0("onChange");
+ setFrame(true);
+ super.setPadding(10);
+ // super.setHeight(LicenseWizardView.HEIGHT);
+ super.setAutoHeight(true);
+ final Label intro = new Label();
+ intro.setText(i18n.t("Select other kind of licenses:"));
+
+ // final ListStore<LicenseDTO> store = new ListStore<LicenseDTO>();
+ // store.add( Arrays.asList( new String[] { "shortname", "longname", "url"
+ // });
+ // getNonCCLicenses());
+ // store.load();
+
+ // final Template template = new
+ // Template("<div class=\"x-combo-list-item\">" + "<img src=\"{url}\"> "
+ // + "{longname}<div class=\"x-clear\"></div></div>");
+
+ super.setHideLabels(true);
+
+ cb = new ComboBox<LicenseData>();
+ cb.setMinChars(1);
+ // cb.setFieldLabel("Other licenses");
+ cb.setLabelSeparator("");
+ cb.setStore(createStore());
+ cb.setDisplayField(LicenseData.LONGNAME);
+ cb.setValueField(LicenseData.SHORTNAME);
+ // cb.setMode(Mode.LOCAL);
+ cb.setTriggerAction(TriggerAction.ALL);
+ cb.setEmptyText(i18n.t("Select license"));
+ cb.setTypeAhead(true);
+ cb.setSelectOnFocus(true);
+ cb.setEditable(false);
+ cb.setWidth(300);
+ // cb.setResizable(true);
+ // cb.setTpl(template);
+ cb.setTitle("Licenses");
+ cb.addListener(Events.Select, new Listener<BaseEvent>() {
+ @Override
+ public void handleEvent(final BaseEvent be) {
+ onChange.onCallback();
+ }
+ });
+ add(intro);
+ add(cb);
+ }
+
+ @Override
+ public Widget asWidget() {
+ return this.getFormPanel();
+ }
+
+ private ListStore<LicenseData> createStore() {
+ final ListStore<LicenseData> list = new ListStore<LicenseData>();
+
+ for (final LicenseDTO license : session.getLicenses()) {
+ if (!license.isCC()) {
+ list.add(new LicenseData(license));
+ }
}
+ return list;
+ }
- @Override
- public void setFlags(final boolean isCopyleft, final boolean isAppropiateForCulturalWorks,
- final boolean isNonComercial) {
- // TODO Auto-generated method stub
- }
+ @Override
+ public String getSelectedLicense() {
+ return cb.getValue().getShortname();
+ }
+
+ @Override
+ public void onChange(final SimpleCallback onChange) {
+ this.onChange = onChange;
+ }
+
+ @Override
+ public void reset() {
+ super.reset();
+ }
+
+ @Override
+ public void setFlags(final boolean isCopyleft, final boolean isAppropiateForCulturalWorks,
+ final boolean isNonComercial) {
+
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardFrdFormView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardFrdFormView.java 2011-05-06 14:45:24 UTC (rev 1355)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardFrdFormView.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -17,19 +17,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-package org.ourproject.kune.workspace.client.licensewizard.pages;
+package cc.kune.gspace.client.licensewizard.pages;
-import org.ourproject.kune.platf.client.View;
+import cc.kune.common.client.utils.SimpleCallback;
-import com.calclab.suco.client.events.Listener0;
+import com.google.gwt.user.client.ui.IsWidget;
-public interface LicenseWizardFrdFormView extends View {
+public interface LicenseWizardFrdFormView extends IsWidget {
- String getSelectedLicense();
+ String getSelectedLicense();
- void onChange(Listener0 slot);
+ void onChange(SimpleCallback callback);
- void reset();
+ void reset();
- void setFlags(boolean isCopyleft, boolean isAppropiateForCulturalWorks, boolean isNonComercial);
+ void setFlags(boolean isCopyleft, boolean isAppropiateForCulturalWorks, boolean isNonComercial);
}
Modified: trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardSndForm.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardSndForm.java 2011-05-06 14:45:24 UTC (rev 1355)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardSndForm.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -17,54 +17,64 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-package org.ourproject.kune.workspace.client.licensewizard.pages;
+package cc.kune.gspace.client.licensewizard.pages;
-import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm;
-import org.ourproject.kune.platf.client.ui.dialogs.DefaultFormUtils;
-import org.ourproject.kune.workspace.client.licensewizard.LicenseWizardView;
-
+import cc.kune.core.client.ui.DefaultForm;
+import cc.kune.core.client.ui.DefaultFormUtils;
import cc.kune.core.shared.i18n.I18nTranslationService;
-import com.gwtext.client.widgets.form.FieldSet;
-import com.gwtext.client.widgets.form.Label;
-import com.gwtext.client.widgets.form.Radio;
+import com.extjs.gxt.ui.client.widget.form.FieldSet;
+import com.extjs.gxt.ui.client.widget.form.Radio;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
public class LicenseWizardSndForm extends DefaultForm implements LicenseWizardSndFormView {
- public static final String COMMON_LICENSES_ID = "k-lwsf-common";
- public static final String OTHER_LICENSES_ID = "k-lwsf-other";
- public static final String RADIO_FIELD_NAME = "k-lwsf-radio";
- private final Radio commonLicensesRadio;
- private final Radio otherLicensesRadio;
+ public static final String COMMON_LICENSES_ID = "k-lwsf-common";
+ public static final String OTHER_LICENSES_ID = "k-lwsf-other";
+ public static final String RADIO_FIELD_NAME = "k-lwsf-radio";
+ private final Radio commonLicensesRadio;
+ private final Radio otherLicensesRadio;
- public LicenseWizardSndForm(I18nTranslationService i18n) {
- setFrame(true);
- super.setPaddings(10);
- super.setHeight(LicenseWizardView.HEIGHT);
+ @Inject
+ public LicenseWizardSndForm(final I18nTranslationService i18n) {
+ setFrame(true);
+ super.setPadding(10);
+ // super.setHeight(LicenseWizardView.HEIGHT);
+ super.setAutoHeight(true);
+ final Label intro = new Label();
+ intro.setText(i18n.t("Select the license type:"));
- Label intro = new Label();
- intro.setHtml(i18n.t("Select the license type:") + DefaultFormUtils.brbr());
+ final FieldSet fieldSet = new FieldSet();
+ // fieldSet.setTitle("license type");
+ fieldSet.addStyleName("margin-left: 105px");
+ fieldSet.setWidth(250);
+ commonLicensesRadio = DefaultFormUtils.createRadio(fieldSet,
+ i18n.t("Common licenses for cultural works"), RADIO_FIELD_NAME,
+ i18n.t("Select a Creative Commons license (recommended for cultural works)"), COMMON_LICENSES_ID);
+ otherLicensesRadio = DefaultFormUtils.createRadio(fieldSet, i18n.t("Other kind of licenses"),
+ RADIO_FIELD_NAME,
+ i18n.t("Use the GNU licenses (recommended for free software works) and other kind of licenses"),
+ OTHER_LICENSES_ID);
+ add(intro);
+ add(commonLicensesRadio);
+ add(otherLicensesRadio);
- final FieldSet fieldSet = new FieldSet("license type");
- fieldSet.setStyle("margin-left: 105px");
- fieldSet.setWidth(250);
- commonLicensesRadio = DefaultFormUtils.createRadio(fieldSet, i18n.t("Common licenses for cultural works"),
- RADIO_FIELD_NAME, i18n.t("Select a Creative Commons license (recommended for cultural works)"),
- COMMON_LICENSES_ID);
- otherLicensesRadio = DefaultFormUtils.createRadio(fieldSet, i18n.t("Other kind of licenses"), RADIO_FIELD_NAME,
- i18n.t("Use the GNU licenses (recommended for free software works) and other kind of licenses"),
- OTHER_LICENSES_ID);
- add(intro);
- add(commonLicensesRadio);
- add(otherLicensesRadio);
- }
+ }
- public boolean isCommonLicensesSelected() {
- return commonLicensesRadio.getValue();
- }
+ @Override
+ public Widget asWidget() {
+ return null;
+ }
- @Override
- public void reset() {
- super.reset();
- commonLicensesRadio.setChecked(true);
- }
+ @Override
+ public boolean isCommonLicensesSelected() {
+ return commonLicensesRadio.getValue();
+ }
+
+ @Override
+ public void reset() {
+ super.reset();
+ commonLicensesRadio.setValue(true);
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardSndFormView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardSndFormView.java 2011-05-06 14:45:24 UTC (rev 1355)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardSndFormView.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -17,13 +17,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-package org.ourproject.kune.workspace.client.licensewizard.pages;
+package cc.kune.gspace.client.licensewizard.pages;
-import org.ourproject.kune.platf.client.View;
+import com.google.gwt.user.client.ui.IsWidget;
-public interface LicenseWizardSndFormView extends View {
+public interface LicenseWizardSndFormView extends IsWidget {
- boolean isCommonLicensesSelected();
+ boolean isCommonLicensesSelected();
- void reset();
+ void reset();
}
Modified: trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardTrdForm.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardTrdForm.java 2011-05-06 14:45:24 UTC (rev 1355)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardTrdForm.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -17,158 +17,179 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-package org.ourproject.kune.workspace.client.licensewizard.pages;
+package cc.kune.gspace.client.licensewizard.pages;
-import org.ourproject.kune.platf.client.services.Images;
-import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm;
-import org.ourproject.kune.platf.client.ui.dialogs.DefaultFormUtils;
-import org.ourproject.kune.workspace.client.licensewizard.LicenseWizardView;
-
+import cc.kune.common.client.tooltip.Tooltip;
+import cc.kune.common.client.utils.SimpleCallback;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.ui.DefaultForm;
import cc.kune.core.shared.i18n.I18nTranslationService;
-import com.calclab.suco.client.events.Listener0;
-import com.gwtext.client.widgets.PaddedPanel;
-import com.gwtext.client.widgets.form.Checkbox;
-import com.gwtext.client.widgets.form.Field;
-import com.gwtext.client.widgets.form.FieldSet;
-import com.gwtext.client.widgets.form.Label;
-import com.gwtext.client.widgets.form.Radio;
-import com.gwtext.client.widgets.form.event.CheckboxListenerAdapter;
+import com.extjs.gxt.ui.client.Style.Orientation;
+import com.extjs.gxt.ui.client.event.BaseEvent;
+import com.extjs.gxt.ui.client.event.Events;
+import com.extjs.gxt.ui.client.event.Listener;
+import com.extjs.gxt.ui.client.widget.form.FieldSet;
+import com.extjs.gxt.ui.client.widget.form.Radio;
+import com.extjs.gxt.ui.client.widget.form.RadioGroup;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
public class LicenseWizardTrdForm extends DefaultForm implements LicenseWizardTrdFormView {
- public static final String RADIO_COMMERCIAL_FIELD_NAME = "k-lwtf-comm-radio";
- public static final String RADIO_MODIF_FIELD_NAME = "k-lwtf-mod-radio";
- public static final String RADIO_NOT_COMM_ID = "k-lwtf-not-perm-comm";
- public static final String RADIO_NOT_PERMIT_MOD_ID = "k-lwtf-not-mod";
- public static final String RADIO_PERMIT_COMMERCIAL_ID = "k-lwtf-perm-comm";
- public static final String RADIO_PERMIT_MOD_ID = "k-lwtf-mod-perm";
- public static final String RADIO_PERMIT_MOD_SA_ID = "k-lwtf-mod-perm-sa";
- private final LicenseWizardFlags info;
- private Radio notPermitComercialLicenseRadio;
- // private final Event0 onChange;
- private Radio notPermitModRadio;
- private Radio permitComercialRadio;
- private Radio permitModRadio;
- private Radio permitModSaRadio;
+ public static final String RADIO_COMMERCIAL_FIELD_NAME = "k-lwtf-comm-radio";
+ public static final String RADIO_MODIF_FIELD_NAME = "k-lwtf-mod-radio";
+ public static final String RADIO_NOT_COMM_ID = "k-lwtf-not-perm-comm";
+ public static final String RADIO_NOT_PERMIT_MOD_ID = "k-lwtf-not-mod";
+ public static final String RADIO_PERMIT_COMMERCIAL_ID = "k-lwtf-perm-comm";
+ public static final String RADIO_PERMIT_MOD_ID = "k-lwtf-mod-perm";
+ public static final String RADIO_PERMIT_MOD_SA_ID = "k-lwtf-mod-perm-sa";
+ private RadioGroup commertialGroup;
+ private final LicenseWizardFlags info;
- public LicenseWizardTrdForm(final Images images, final I18nTranslationService i18n) {
- super.setFrame(true);
- super.setHeight(LicenseWizardView.HEIGHT);
- super.setPaddings(10);
+ private RadioGroup modificationsGroup;
+ private Radio notPermitComercialLicenseRadio;
+ private Radio notPermitModRadio;
+ private SimpleCallback onChange;
+ private Radio permitComercialRadio;
+ private Radio permitModRadio;
+ private Radio permitModSaRadio;
- // this.onChange = new Event0("onChange");
+ @Inject
+ public LicenseWizardTrdForm(final I18nTranslationService i18n, final CoreResources res) {
+ super.setFrame(true);
+ super.setPadding(10);
+ super.setAutoHeight(true);
- final Label intro = new Label();
- intro.setHtml(i18n.t("With a Creative Commons license, you keep your copyright but allow people to copy and distribute your work provided they give you credit — and only on the conditions you specify here. What do you want to do?")
- + DefaultFormUtils.brbr());
+ final Label intro = new Label();
+ intro.setText(i18n.t("With a Creative Commons license, you keep your copyright but allow people to copy and distribute your work provided they give you credit — and only on the conditions you specify here. What do you want to do?"));
- final Label commercialQuestion = new Label();
- commercialQuestion.setHtml(i18n.t("Allow any uses of your work, including commercial?") + DefaultFormUtils.br());
- final Label modificationsQuestion = new Label();
- modificationsQuestion.setHtml(i18n.t("Allow modifications of your work?") + DefaultFormUtils.br());
+ final FieldSet commercialfieldSet = new FieldSet();
+ commercialfieldSet.setHeading(i18n.t("Allow any uses of your work, including commercial?"));
+ commercialfieldSet.setCollapsible(false);
+ commercialfieldSet.setAutoHeight(true);
+ final FieldSet modificationsfieldSet = new FieldSet();
+ modificationsfieldSet.setHeading(i18n.t("Allow modifications of your work?"));
+ modificationsfieldSet.setCollapsible(false);
+ modificationsfieldSet.setAutoHeight(true);
- final FieldSet commercialfieldSet = new FieldSet(i18n.t("Allow any uses of your work, including commercial?"));
- commercialfieldSet.setFrame(false);
- commercialfieldSet.setCollapsible(false);
- commercialfieldSet.setAutoHeight(true);
- final FieldSet modificationsfieldSet = new FieldSet(i18n.t("Allow modifications of your work?"));
- modificationsfieldSet.setFrame(false);
- modificationsfieldSet.setCollapsible(false);
- modificationsfieldSet.setAutoHeight(true);
+ createRadios(i18n, commercialfieldSet, modificationsfieldSet);
+ createRadioListeners();
- createRadios(i18n, commercialfieldSet, modificationsfieldSet);
- createRadioListeners();
+ info = new LicenseWizardFlags(res, i18n);
- info = new LicenseWizardFlags(images, i18n);
+ add(intro);
+ add(commercialfieldSet);
+ add(modificationsfieldSet);
+ add(info);
+ }
- add(intro);
- add(commercialfieldSet);
- add(modificationsfieldSet);
- add(new PaddedPanel(info, 0, 0, 0, 0));
- }
+ @Override
+ public Widget asWidget() {
+ return super.getFormPanel();
+ }
- private void createRadioListeners() {
- final Radio[] radios = { permitModRadio, permitModSaRadio, notPermitModRadio, permitComercialRadio,
- notPermitComercialLicenseRadio };
- for (final Radio radio : radios) {
- radio.addListener(new CheckboxListenerAdapter() {
- @Override
- public void onChange(final Field field, final Object newVal, final Object oldVal) {
- // onChange.fire();
- }
+ private Radio createRadio(final RadioGroup radioGroup, final String radioLabel,
+ final String radioFieldName, final String radioTip, final String id) {
+ final Radio radio = new Radio();
+ radio.setName(radioFieldName);
+ radio.setHideLabel(true);
+ radio.setId(id);
+ radioGroup.add(radio);
- @Override
- public void onCheck(final Checkbox field, final boolean checked) {
- // onChange.fire();
- }
- });
- }
+ if (radioTip != null) {
+ Tooltip.to(radio, radioTip);
}
+ radio.setBoxLabel(radioLabel);
+ return radio;
+ }
- private void createRadios(final I18nTranslationService i18n, final FieldSet commercialfieldSet,
- final FieldSet modificationsfieldSet) {
- permitComercialRadio = DefaultFormUtils.createRadio(
- commercialfieldSet,
- i18n.t("Yes"),
- RADIO_COMMERCIAL_FIELD_NAME,
- i18n.t("The licensor permits others to copy, distribute, display, and perform the work, including for commercial purposes"),
- RADIO_PERMIT_COMMERCIAL_ID);
- notPermitComercialLicenseRadio = DefaultFormUtils.createRadio(
- commercialfieldSet,
- i18n.t("No"),
- RADIO_COMMERCIAL_FIELD_NAME,
- i18n.t("The licensor permits others to copy, distribute, display, and perform the work for non-commercial purposes only"),
- RADIO_NOT_COMM_ID);
- permitModRadio = DefaultFormUtils.createRadio(
- modificationsfieldSet,
- i18n.t("Yes"),
- RADIO_MODIF_FIELD_NAME,
- i18n.t("The licensor permits others to copy, distribute, display and perform the work, as well as make derivative works based on it"),
- RADIO_PERMIT_MOD_ID);
- permitModSaRadio = DefaultFormUtils.createRadio(
- modificationsfieldSet,
- i18n.t("Yes, as long as other share alike"),
- RADIO_MODIF_FIELD_NAME,
- i18n.t("The licensor permits others to distribute derivative works only under the same license or one compatible with the one that governs the licensor's work"),
- RADIO_PERMIT_MOD_SA_ID);
- notPermitModRadio = DefaultFormUtils.createRadio(
- modificationsfieldSet,
- i18n.t("No"),
- RADIO_MODIF_FIELD_NAME,
- i18n.t("The licensor permits others to copy, distribute, display and perform only unaltered copies of the work — not derivative works based on it"),
- RADIO_NOT_PERMIT_MOD_ID);
- }
+ private void createRadioListeners() {
+ final Listener<BaseEvent> listener = new Listener<BaseEvent>() {
+ @Override
+ public void handleEvent(final BaseEvent be) {
+ onChange.onCallback();
+ }
+ };
+ commertialGroup.addListener(Events.Change, listener);
+ modificationsGroup.addListener(Events.Change, listener);
+ }
- @Override
- public boolean isAllowComercial() {
- return permitComercialRadio.getValue();
- }
+ private void createRadios(final I18nTranslationService i18n, final FieldSet commercialfieldSet,
+ final FieldSet modificationsfieldSet) {
+ commertialGroup = new RadioGroup();
+ modificationsGroup = new RadioGroup();
+ commertialGroup.setOrientation(Orientation.VERTICAL);
+ modificationsGroup.setOrientation(Orientation.VERTICAL);
+ permitComercialRadio = createRadio(
+ commertialGroup,
+ i18n.t("Yes"),
+ RADIO_COMMERCIAL_FIELD_NAME,
+ i18n.t("The licensor permits others to copy, distribute, display, and perform the work, including for commercial purposes"),
+ RADIO_PERMIT_COMMERCIAL_ID);
+ notPermitComercialLicenseRadio = createRadio(
+ commertialGroup,
+ i18n.t("No"),
+ RADIO_COMMERCIAL_FIELD_NAME,
+ i18n.t("The licensor permits others to copy, distribute, display, and perform the work for non-commercial purposes only"),
+ RADIO_NOT_COMM_ID);
+ permitModRadio = createRadio(
+ modificationsGroup,
+ i18n.t("Yes"),
+ RADIO_MODIF_FIELD_NAME,
+ i18n.t("The licensor permits others to copy, distribute, display and perform the work, as well as make derivative works based on it"),
+ RADIO_PERMIT_MOD_ID);
+ permitModSaRadio = createRadio(
+ modificationsGroup,
+ i18n.t("Yes, as long as other share alike"),
+ RADIO_MODIF_FIELD_NAME,
+ i18n.t("The licensor permits others to distribute derivative works only under the same license or one compatible with the one that governs the licensor's work"),
+ RADIO_PERMIT_MOD_SA_ID);
+ notPermitModRadio = createRadio(
+ modificationsGroup,
+ i18n.t("No"),
+ RADIO_MODIF_FIELD_NAME,
+ i18n.t("The licensor permits others to copy, distribute, display and perform only unaltered copies of the work — not derivative works based on it"),
+ RADIO_NOT_PERMIT_MOD_ID);
+ commertialGroup.add(permitComercialRadio);
+ commertialGroup.add(notPermitComercialLicenseRadio);
+ modificationsGroup.add(permitModRadio);
+ modificationsGroup.add(permitModSaRadio);
+ modificationsGroup.add(notPermitModRadio);
+ commercialfieldSet.add(commertialGroup);
+ modificationsfieldSet.add(modificationsGroup);
+ }
- @Override
- public boolean isAllowModif() {
- return permitModRadio.getValue();
- }
+ @Override
+ public boolean isAllowComercial() {
+ return permitComercialRadio.getValue();
+ }
- @Override
- public boolean isAllowModifShareAlike() {
- return permitModSaRadio.getValue();
- }
+ @Override
+ public boolean isAllowModif() {
+ return permitModRadio.getValue();
+ }
- @Override
- public void onChange(final Listener0 slot) {
- // onChange.add(slot);
- }
+ @Override
+ public boolean isAllowModifShareAlike() {
+ return permitModSaRadio.getValue();
+ }
- @Override
- public void reset() {
- super.reset();
- permitComercialRadio.setChecked(true);
- permitModSaRadio.setChecked(true);
- }
+ @Override
+ public void onChange(final SimpleCallback onChange) {
+ this.onChange = onChange;
+ }
- @Override
- public void setFlags(final boolean isCopyleft, final boolean isAppropiateForCulturalWorks,
- final boolean isNonComercial) {
- info.setVisible(isCopyleft, isAppropiateForCulturalWorks, isNonComercial);
- }
+ @Override
+ public void reset() {
+ super.reset();
+ permitComercialRadio.setValue(true);
+ permitModSaRadio.setValue(true);
+ }
+
+ @Override
+ public void setFlags(final boolean isCopyleft, final boolean isAppropiateForCulturalWorks,
+ final boolean isNonComercial) {
+ info.setVisible(isCopyleft, isAppropiateForCulturalWorks, isNonComercial);
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardTrdFormView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardTrdFormView.java 2011-05-06 14:45:24 UTC (rev 1355)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/pages/LicenseWizardTrdFormView.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -17,22 +17,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-package org.ourproject.kune.workspace.client.licensewizard.pages;
+package cc.kune.gspace.client.licensewizard.pages;
-import org.ourproject.kune.platf.client.View;
+import cc.kune.common.client.utils.SimpleCallback;
-import com.calclab.suco.client.events.Listener0;
+import com.google.gwt.user.client.ui.IsWidget;
-public interface LicenseWizardTrdFormView extends View {
- boolean isAllowComercial();
+public interface LicenseWizardTrdFormView extends IsWidget {
+ boolean isAllowComercial();
- boolean isAllowModif();
+ boolean isAllowModif();
- boolean isAllowModifShareAlike();
+ boolean isAllowModifShareAlike();
- void onChange(Listener0 slot);
+ void onChange(SimpleCallback callback);
- void reset();
+ void reset();
- void setFlags(boolean isCopyleft, boolean isAppropiateForCulturalWorks, boolean isNonComercial);
+ void setFlags(boolean isCopyleft, boolean isAppropiateForCulturalWorks, boolean isNonComercial);
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPanel.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPanel.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -22,7 +22,6 @@
import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
import cc.kune.common.client.notify.NotifyLevelImages;
import cc.kune.common.client.ui.dialogs.tabbed.AbstractTabbedDialogPanel;
-import cc.kune.common.client.utils.TextUtils;
import cc.kune.core.client.resources.CoreMessages;
import cc.kune.core.client.ws.entheader.EntityHeader;
import cc.kune.core.shared.i18n.I18nTranslationService;
@@ -42,12 +41,12 @@
@Inject
public GroupOptionsPanel(final EntityHeader entityHeader, final I18nTranslationService i18n,
final NotifyLevelImages images, final GroupOptionsCollection entityOptionsGroup) {
- super(GROUP_OP_PANEL_ID, "", WIDTH, HEIGHT + 80, WIDTH, HEIGHT + 80, false, images,
- GROUP_OPTIONS_ERROR_ID, i18n.t("Close"), null, null, null);
+ super(GROUP_OP_PANEL_ID, "", WIDTH, HEIGHT + 80, false, images, GROUP_OPTIONS_ERROR_ID,
+ i18n.t("Close"), null, null, null);
this.entityHeader = entityHeader;
this.entityPreferencesGroup = entityOptionsGroup;
super.setIconCls("k-options-icon");
- super.setTitle(i18n.t(CoreMessages.GROUP_OPTIONS_DIALOG_TITLE) + TextUtils.IN_DEVELOPMENT_P);
+ super.setTitle(i18n.t(CoreMessages.GROUP_OPTIONS_DIALOG_TITLE));
}
@Override
Modified: trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPanel.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPanel.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -21,7 +21,6 @@
import cc.kune.common.client.notify.NotifyLevelImages;
import cc.kune.common.client.ui.dialogs.tabbed.AbstractTabbedDialogPanel;
-import cc.kune.common.client.utils.TextUtils;
import cc.kune.core.client.resources.CoreMessages;
import cc.kune.core.client.ws.entheader.EntityHeader;
import cc.kune.core.shared.i18n.I18nTranslationService;
@@ -41,11 +40,11 @@
@Inject
public UserOptionsPanel(final EntityHeader entityHeader, final I18nTranslationService i18n,
final NotifyLevelImages images, final UserOptionsCollection userOptionsGroup) {
- super(USER_OP_PANEL_ID, "", WIDTH, HEIGHT + 80, WIDTH, HEIGHT + 80, false, images,
- USER_OPTIONS_ERROR_ID, i18n.t("Close"), null, null, null);
+ super(USER_OP_PANEL_ID, "", WIDTH, HEIGHT + 80, false, images, USER_OPTIONS_ERROR_ID,
+ i18n.t("Close"), null, null, null);
this.userPreferencesGroup = userOptionsGroup;
super.setIconCls("k-options-icon");
- super.setTitle(i18n.t(CoreMessages.USER_OPTIONS_DIALOG_TITLE) + TextUtils.IN_DEVELOPMENT_P);
+ super.setTitle(i18n.t(CoreMessages.USER_OPTIONS_DIALOG_TITLE));
}
@Override
Modified: trunk/src/main/java/cc/kune/gspace/client/options/license/EntityOptionsDefLicensePanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/license/EntityOptionsDefLicensePanel.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/gspace/client/options/license/EntityOptionsDefLicensePanel.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -52,6 +52,8 @@
flow.add(licenseImage);
licenseImage.addStyleName("kune-pointer");
change = new Button(i18n.t("Change"));
+ change.addStyleName("k-button");
+ flow.add(change);
initWidget(flow);
flow.setHeight(String.valueOf(EntityOptionsView.HEIGHT) + "px");
flow.setWidth(String.valueOf(EntityOptionsView.WIDTH) + "px");
Modified: trunk/src/main/java/cc/kune/gspace/client/options/license/EntityOptionsDefLicensePresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/license/EntityOptionsDefLicensePresenter.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/gspace/client/options/license/EntityOptionsDefLicensePresenter.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -19,86 +19,95 @@
*/
package cc.kune.gspace.client.options.license;
+import cc.kune.common.client.utils.SimpleResponseCallback;
import cc.kune.core.client.state.Session;
import cc.kune.core.shared.domain.utils.StateToken;
import cc.kune.core.shared.dto.LicenseDTO;
+import cc.kune.gspace.client.licensewizard.LicenseChangeAction;
+import cc.kune.gspace.client.licensewizard.LicenseChooseCallback;
+import cc.kune.gspace.client.licensewizard.LicenseWizard;
import cc.kune.gspace.client.options.EntityOptions;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.IsWidget;
+import com.google.inject.Provider;
public abstract class EntityOptionsDefLicensePresenter {
- private final EntityOptions entityOptions;
- // private final Provider<LicenseChangeAction> licChangeAction;
- // private final Provider<LicenseWizard> licenseWizard;
- protected final Session session;
- private EntityOptionsDefLicenseView view;
+ private final EntityOptions entityOptions;
+ private final Provider<LicenseChangeAction> licChangeAction;
+ private final Provider<LicenseWizard> licenseWizard;
+ protected final Session session;
+ private EntityOptionsDefLicenseView view;
- public EntityOptionsDefLicensePresenter(final EntityOptions entityOptions, final Session session) {
- // final Provider<LicenseWizard> licenseWizard, final
- // Provider<LicenseChangeAction> licChangeAction) {
- this.entityOptions = entityOptions;
- this.session = session;
- // this.licenseWizard = licenseWizard;
- // this.licChangeAction = licChangeAction;
- }
+ public EntityOptionsDefLicensePresenter(final EntityOptions entityOptions, final Session session,
+ final Provider<LicenseWizard> licenseWizard, final Provider<LicenseChangeAction> licChangeAction) {
+ this.entityOptions = entityOptions;
+ this.session = session;
+ this.licenseWizard = licenseWizard;
+ this.licChangeAction = licChangeAction;
+ }
- protected abstract boolean applicable();
+ protected abstract boolean applicable();
- protected abstract LicenseDTO getCurrentDefLicense();
+ protected abstract LicenseDTO getCurrentDefLicense();
- protected abstract StateToken getOperationToken();
+ protected abstract StateToken getOperationToken();
- public IsWidget getView() {
- return view;
- }
+ public IsWidget getView() {
+ return view;
+ }
- protected void init(final EntityOptionsDefLicenseView view) {
- this.view = view;
- entityOptions.addTab(view, view.getTabTitle());
- setState();
- view.getChange().addClickHandler(new ClickHandler() {
- @Override
- public void onClick(final ClickEvent event) {
- onLicenseClick();
- }
+ protected void init(final EntityOptionsDefLicenseView view) {
+ this.view = view;
+ entityOptions.addTab(view, view.getTabTitle());
+ setState();
+ view.getChange().addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ onChange();
+ }
+ });
+ view.getLicenseImage().addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ onLicenseClick();
+ }
+ });
+ }
+
+ public void onChange() {
+ licenseWizard.get().start(new LicenseChooseCallback() {
+
+ @Override
+ public void onSelected(final LicenseDTO license) {
+ licChangeAction.get().changeLicense(getOperationToken(), license, new SimpleResponseCallback() {
+
+ @Override
+ public void onCancel() {
+ }
+
+ @Override
+ public void onSuccess() {
+ setLicense(license);
+ }
});
- view.getLicenseImage().addClickHandler(new ClickHandler() {
- @Override
- public void onClick(final ClickEvent event) {
- // onChange();
- }
- });
- }
+ }
+ });
+ }
- // public void onChange() {
- // licenseWizard.get().start(new Listener<LicenseDTO>() {
- // @Override
- // public void onEvent(final LicenseDTO license) {
- // licChangeAction.get().changeLicense(getOperationToken(), license, new
- // Listener0() {
- // @Override
- // public void onEvent() {
- // setLicense(license);
- // }
- // });
- // }
- // });
- // }
+ public void onLicenseClick() {
+ view.openWindow(getCurrentDefLicense().getUrl());
+ }
- public void onLicenseClick() {
- view.openWindow(getCurrentDefLicense().getUrl());
- }
+ private void setLicense(final LicenseDTO license) {
+ view.setLicense(license);
+ }
- private void setLicense(final LicenseDTO license) {
- view.setLicense(license);
+ protected void setState() {
+ if (applicable()) {
+ setLicense(getCurrentDefLicense());
}
-
- protected void setState() {
- if (applicable()) {
- setLicense(getCurrentDefLicense());
- }
- }
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/license/GroupOptionsDefLicensePresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/license/GroupOptionsDefLicensePresenter.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/gspace/client/options/license/GroupOptionsDefLicensePresenter.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -25,39 +25,42 @@
import cc.kune.core.client.state.UserSignInEvent.UserSignInHandler;
import cc.kune.core.shared.domain.utils.StateToken;
import cc.kune.core.shared.dto.LicenseDTO;
+import cc.kune.gspace.client.licensewizard.LicenseChangeAction;
+import cc.kune.gspace.client.licensewizard.LicenseWizard;
import cc.kune.gspace.client.options.GroupOptions;
import com.google.inject.Inject;
+import com.google.inject.Provider;
-public class GroupOptionsDefLicensePresenter extends EntityOptionsDefLicensePresenter implements GroupOptionsDefLicense {
+public class GroupOptionsDefLicensePresenter extends EntityOptionsDefLicensePresenter implements
+ GroupOptionsDefLicense {
- @Inject
- public GroupOptionsDefLicensePresenter(final GroupOptions entityOptions, final StateManager stateManager,
- final Session session, final GroupOptionsDefLicenseView view) {
- // , final Provider<LicenseWizard> licenseWizard,
- // final Provider<LicenseChangeAction> licChangeAction) {
- super(entityOptions, session);// , licenseWizard, licChangeAction);
- init(view);
- session.onUserSignIn(true, new UserSignInHandler() {
- @Override
- public void onUserSignIn(final UserSignInEvent event) {
- setState();
- }
- });
- }
+ @Inject
+ public GroupOptionsDefLicensePresenter(final GroupOptions entityOptions,
+ final StateManager stateManager, final Session session, final GroupOptionsDefLicenseView view,
+ final Provider<LicenseWizard> licenseWizard, final Provider<LicenseChangeAction> licChangeAction) {
+ super(entityOptions, session, licenseWizard, licChangeAction);
+ init(view);
+ session.onUserSignIn(true, new UserSignInHandler() {
+ @Override
+ public void onUserSignIn(final UserSignInEvent event) {
+ setState();
+ }
+ });
+ }
- @Override
- protected boolean applicable() {
- return session.isCurrentStateAGroup();
- }
+ @Override
+ protected boolean applicable() {
+ return session.isCurrentStateAGroup();
+ }
- @Override
- protected LicenseDTO getCurrentDefLicense() {
- return session.getCurrentState().getGroup().getDefaultLicense();
- }
+ @Override
+ protected LicenseDTO getCurrentDefLicense() {
+ return session.getCurrentState().getGroup().getDefaultLicense();
+ }
- @Override
- protected StateToken getOperationToken() {
- return session.getCurrentStateToken();
- }
+ @Override
+ protected StateToken getOperationToken() {
+ return session.getCurrentStateToken();
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/license/UserOptionsDefLicensePresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/license/UserOptionsDefLicensePresenter.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/cc/kune/gspace/client/options/license/UserOptionsDefLicensePresenter.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -24,40 +24,42 @@
import cc.kune.core.client.state.UserSignInEvent.UserSignInHandler;
import cc.kune.core.shared.domain.utils.StateToken;
import cc.kune.core.shared.dto.LicenseDTO;
+import cc.kune.gspace.client.licensewizard.LicenseChangeAction;
+import cc.kune.gspace.client.licensewizard.LicenseWizard;
import cc.kune.gspace.client.options.UserOptions;
import com.google.inject.Inject;
+import com.google.inject.Provider;
-public class UserOptionsDefLicensePresenter extends EntityOptionsDefLicensePresenter implements UserOptionsDefLicense {
+public class UserOptionsDefLicensePresenter extends EntityOptionsDefLicensePresenter implements
+ UserOptionsDefLicense {
- @Inject
- public UserOptionsDefLicensePresenter(final UserOptions entityOptions, final Session session,
- final UserOptionsDefLicenseView view)
- // final Provider<LicenseWizard> licenseWizard, final
- // Provider<LicenseChangeAction> licChangeAction) {
- {
- super(entityOptions, session); // , licenseWizard, licChangeAction);
- init(view);
- session.onUserSignIn(true, new UserSignInHandler() {
- @Override
- public void onUserSignIn(final UserSignInEvent event) {
- setState();
- }
- });
- }
+ @Inject
+ public UserOptionsDefLicensePresenter(final UserOptions entityOptions, final Session session,
+ final UserOptionsDefLicenseView view, final Provider<LicenseWizard> licenseWizard,
+ final Provider<LicenseChangeAction> licChangeAction) {
+ super(entityOptions, session, licenseWizard, licChangeAction);
+ init(view);
+ session.onUserSignIn(true, new UserSignInHandler() {
+ @Override
+ public void onUserSignIn(final UserSignInEvent event) {
+ setState();
+ }
+ });
+ }
- @Override
- protected boolean applicable() {
- return session.isLogged();
- }
+ @Override
+ protected boolean applicable() {
+ return session.isLogged();
+ }
- @Override
- protected LicenseDTO getCurrentDefLicense() {
- return session.getCurrentState().getGroup().getDefaultLicense();
- }
+ @Override
+ protected LicenseDTO getCurrentDefLicense() {
+ return session.getCurrentState().getGroup().getDefaultLicense();
+ }
- @Override
- protected StateToken getOperationToken() {
- return session.getCurrentUser().getStateToken();
- }
+ @Override
+ protected StateToken getOperationToken() {
+ return session.getCurrentUser().getStateToken();
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -37,243 +37,269 @@
public class WizardDialog implements WizardDialogView {
- private final Button backButton;
- private final Button cancelButton;
- private final BasicDialog dialog;
- private final Button finishButton;
- private final I18nTranslationService i18n;
- private final Button nextButton;
- private final DeckPanel deck;
- private final Panel mainPanel;
+ private final Button backButton;
+ private final Button cancelButton;
+ private final DeckPanel deck;
+ private final BasicDialog dialog;
+ private final Button finishButton;
+ private final I18nTranslationService i18n;
+ private final Panel mainPanel;
+ private final Button nextButton;
- public WizardDialog(String dialogId, final String caption, final boolean modal, final boolean minimizable,
- final int width, final int height, final int minWidth, final int minHeight, final String backId,
- final String nextId, final String finishId, final String cancelId, final String closeId,
- final I18nTranslationService i18n, final WizardListener listener) {
- dialog = new BasicDialog(dialogId, caption, modal, false, width, height, minWidth, minHeight);
- this.i18n = i18n;
- dialog.setCollapsible(minimizable);
- dialog.setShadow(true);
- dialog.setPlain(true);
- dialog.setCollapsible(false);
- dialog.setResizable(false);
- dialog.setId(dialogId);
+ public WizardDialog(final String dialogId, final String caption, final boolean modal,
+ final boolean minimizable, final int width, final int height, final int minWidth,
+ final int minHeight, final String backId, final String nextId, final String finishId,
+ final String cancelId, final String closeId, final I18nTranslationService i18n,
+ final WizardListener listener) {
+ dialog = new BasicDialog(dialogId, caption, modal, false, width, height, minWidth, minHeight);
+ this.i18n = i18n;
+ dialog.setCollapsible(minimizable);
+ dialog.setShadow(true);
+ dialog.setPlain(true);
+ dialog.setCollapsible(false);
+ dialog.setResizable(false);
+ dialog.setId(dialogId);
- backButton = new Button(i18n.tWithNT("« Back", "used in button"), new ButtonListenerAdapter() {
- @Override
- public void onClick(Button button, EventObject e) {
- listener.onBack();
- }
- });
- backButton.setId(backId);
- dialog.addButton(backButton);
+ backButton = new Button(i18n.tWithNT("« Back", "used in button"), new ButtonListenerAdapter() {
+ @Override
+ public void onClick(final Button button, final EventObject e) {
+ listener.onBack();
+ }
+ });
+ backButton.setId(backId);
+ dialog.addButton(backButton);
- nextButton = new Button(i18n.tWithNT("Next »", "used in button"), new ButtonListenerAdapter() {
- @Override
- public void onClick(Button button, EventObject e) {
- listener.onNext();
- }
- });
- nextButton.setId(nextId);
- dialog.addButton(nextButton);
+ nextButton = new Button(i18n.tWithNT("Next »", "used in button"), new ButtonListenerAdapter() {
+ @Override
+ public void onClick(final Button button, final EventObject e) {
+ listener.onNext();
+ }
+ });
+ nextButton.setId(nextId);
+ dialog.addButton(nextButton);
- cancelButton = new Button(i18n.tWithNT("Cancel", "used in button"), new ButtonListenerAdapter() {
- @Override
- public void onClick(Button button, EventObject e) {
- listener.onCancel();
- }
- });
- cancelButton.setId(cancelId);
- dialog.addButton(cancelButton);
+ cancelButton = new Button(i18n.tWithNT("Cancel", "used in button"), new ButtonListenerAdapter() {
+ @Override
+ public void onClick(final Button button, final EventObject e) {
+ listener.onCancel();
+ }
+ });
+ cancelButton.setId(cancelId);
+ dialog.addButton(cancelButton);
- finishButton = new Button(i18n.tWithNT("Finish", "used in button"), new ButtonListenerAdapter() {
- @Override
- public void onClick(Button button, EventObject e) {
- listener.onFinish();
- }
- });
- finishButton.setId(finishId);
- dialog.addButton(finishButton);
+ finishButton = new Button(i18n.tWithNT("Finish", "used in button"), new ButtonListenerAdapter() {
+ @Override
+ public void onClick(final Button button, final EventObject e) {
+ listener.onFinish();
+ }
+ });
+ finishButton.setId(finishId);
+ dialog.addButton(finishButton);
- dialog.addListener(new WindowListenerAdapter() {
- @Override
- public void onHide(Component component) {
- listener.onClose();
- }
- });
- mainPanel = new Panel();
- mainPanel.setLayout(new FitLayout());
- deck = new DeckPanel();
- mainPanel.add(deck);
- }
+ dialog.addListener(new WindowListenerAdapter() {
+ @Override
+ public void onHide(final Component component) {
+ listener.onClose();
+ }
+ });
+ mainPanel = new Panel();
+ mainPanel.setLayout(new FitLayout());
+ deck = new DeckPanel();
+ mainPanel.add(deck);
+ }
- public WizardDialog(String dialogId, final String caption, final boolean modal, final boolean minimizable,
- final int width, final int height, final WizardListener listener, final I18nTranslationService i18n,
- final String backId, final String nextId, final String finishId, final String cancelId, final String closeId) {
- this(dialogId, caption, modal, minimizable, width, height, width, height, backId, nextId, finishId, cancelId,
- closeId, i18n, listener);
- }
+ public WizardDialog(final String dialogId, final String caption, final boolean modal,
+ final boolean minimizable, final int width, final int height, final WizardListener listener,
+ final I18nTranslationService i18n, final String backId, final String nextId,
+ final String finishId, final String cancelId, final String closeId) {
+ this(dialogId, caption, modal, minimizable, width, height, width, height, backId, nextId, finishId,
+ cancelId, closeId, i18n, listener);
+ }
- public void add(View view) {
- deck.add(toWidget(view));
- doLayoutIfNeeded();
- }
+ @Override
+ public void add(final View view) {
+ deck.add(toWidget(view));
+ doLayoutIfNeeded();
+ }
- public void center() {
- dialog.center();
- }
+ @Override
+ public void center() {
+ dialog.center();
+ }
- public void clear() {
- dialog.clear();
- }
+ @Override
+ public void clear() {
+ dialog.clear();
+ }
- public void hide() {
- dialog.hide();
+ private void doLayoutIfNeeded() {
+ if (dialog.isRendered()) {
+ dialog.doLayout();
+ mainPanel.syncSize();
+ mainPanel.doLayout();
}
+ }
- public boolean isCurrentPage(View view) {
- int visibleWidgetIndex = deck.getVisibleWidget();
- if (visibleWidgetIndex == -1) {
- return false;
- } else {
- return deck.getWidget(visibleWidgetIndex).equals(toWidget(view));
- }
+ private int getWidgetCount(final View view) {
+ if (view instanceof Widget) {
+ return deck.getWidgetIndex((Widget) view);
+ } else if (view instanceof DefaultForm) {
+ return deck.getWidgetIndex(((DefaultForm) view).getFormPanel());
}
+ return -1;
+ }
- public void mask(final String message) {
- dialog.getEl().mask(message, "x-mask-loading");
- }
+ @Override
+ public void hide() {
+ dialog.hide();
+ }
- public void maskProcessing() {
- mask(i18n.t("Processing"));
+ @Override
+ public boolean isCurrentPage(final View view) {
+ final int visibleWidgetIndex = deck.getVisibleWidget();
+ if (visibleWidgetIndex == -1) {
+ return false;
+ } else {
+ return deck.getWidget(visibleWidgetIndex).equals(toWidget(view));
}
+ }
- public void remove(View view) {
- int count = getWidgetCount(view);
- if (count != -1) {
- deck.remove(count);
- }
- }
+ @Override
+ public void mask(final String message) {
+ dialog.getEl().mask(message, "x-mask-loading");
+ }
- public void setBottomToolbar(Toolbar toolbar) {
- dialog.setBottomToolbar(toolbar);
- }
+ @Override
+ public void maskProcessing() {
+ mask(i18n.t("Processing"));
+ }
- public void setEnabled(boolean back, boolean next, boolean cancel, boolean finish) {
- setEnabledBackButton(back);
- setEnabledNextButton(next);
- setEnabledCancelButton(cancel);
- setEnabledFinishButton(finish);
+ @Override
+ public void remove(final View view) {
+ final int count = getWidgetCount(view);
+ if (count != -1) {
+ deck.remove(count);
}
+ }
- public void setEnabledBackButton(final boolean enabled) {
- if (enabled) {
- backButton.enable();
- } else {
- backButton.disable();
- }
- }
+ public void setBottomToolbar1(final Toolbar toolbar) {
+ dialog.setBottomToolbar(toolbar);
+ }
- public void setEnabledCancelButton(final boolean enabled) {
- if (enabled) {
- cancelButton.enable();
- } else {
- cancelButton.disable();
- }
- }
+ @Override
+ public void setEnabled(final boolean back, final boolean next, final boolean cancel,
+ final boolean finish) {
+ setEnabledBackButton(back);
+ setEnabledNextButton(next);
+ setEnabledCancelButton(cancel);
+ setEnabledFinishButton(finish);
+ }
- public void setEnabledFinishButton(final boolean enabled) {
- if (enabled) {
- finishButton.enable();
- } else {
- finishButton.disable();
- }
+ @Override
+ public void setEnabledBackButton(final boolean enabled) {
+ if (enabled) {
+ backButton.enable();
+ } else {
+ backButton.disable();
}
+ }
- public void setEnabledNextButton(final boolean enabled) {
- if (enabled) {
- nextButton.enable();
- } else {
- nextButton.disable();
- }
+ @Override
+ public void setEnabledCancelButton(final boolean enabled) {
+ if (enabled) {
+ cancelButton.enable();
+ } else {
+ cancelButton.disable();
}
+ }
- public void setFinishText(final String text) {
- finishButton.setText(text);
+ @Override
+ public void setEnabledFinishButton(final boolean enabled) {
+ if (enabled) {
+ finishButton.enable();
+ } else {
+ finishButton.disable();
}
+ }
- public void setIconCls(String iconCls) {
- dialog.setIconCls(iconCls);
+ @Override
+ public void setEnabledNextButton(final boolean enabled) {
+ if (enabled) {
+ nextButton.enable();
+ } else {
+ nextButton.disable();
}
+ }
- public void setVisible(boolean back, boolean next, boolean cancel, boolean finish) {
- setVisibleBackButton(back);
- setVisibleNextButton(next);
- setVisibleCancelButton(cancel);
- setVisibleFinishButton(finish);
- }
+ @Override
+ public void setFinishText(final String text) {
+ finishButton.setText(text);
+ }
- public void setVisibleBackButton(final boolean visible) {
- backButton.setVisible(visible);
- }
+ public void setIconCls(final String iconCls) {
+ dialog.setIconCls(iconCls);
+ }
- public void setVisibleCancelButton(final boolean visible) {
- cancelButton.setVisible(visible);
- }
+ @Override
+ public void setVisible(final boolean back, final boolean next, final boolean cancel,
+ final boolean finish) {
+ setVisibleBackButton(back);
+ setVisibleNextButton(next);
+ setVisibleCancelButton(cancel);
+ setVisibleFinishButton(finish);
+ }
- public void setVisibleFinishButton(final boolean visible) {
- finishButton.setVisible(visible);
- }
+ @Override
+ public void setVisibleBackButton(final boolean visible) {
+ backButton.setVisible(visible);
+ }
- public void setVisibleNextButton(final boolean visible) {
- nextButton.setVisible(visible);
- }
+ @Override
+ public void setVisibleCancelButton(final boolean visible) {
+ cancelButton.setVisible(visible);
+ }
- public void show() {
- dialog.show();
- }
+ @Override
+ public void setVisibleFinishButton(final boolean visible) {
+ finishButton.setVisible(visible);
+ }
- public void show(View view) {
- int count = getWidgetCount(view);
- if (count != -1) {
- deck.showWidget(count);
- dialog.add(mainPanel);
- doLayoutIfNeeded();
- } else {
- OldNotifyUser.error("Widget not found in deck of WizardDialog");
- }
+ @Override
+ public void setVisibleNextButton(final boolean visible) {
+ nextButton.setVisible(visible);
+ }
- }
+ @Override
+ public void show() {
+ dialog.show();
+ }
- public void unMask() {
- dialog.getEl().unmask();
+ @Override
+ public void show(final View view) {
+ final int count = getWidgetCount(view);
+ if (count != -1) {
+ deck.showWidget(count);
+ dialog.add(mainPanel);
+ doLayoutIfNeeded();
+ } else {
+ OldNotifyUser.error("Widget not found in deck of WizardDialog");
}
- private void doLayoutIfNeeded() {
- if (dialog.isRendered()) {
- dialog.doLayout();
- mainPanel.syncSize();
- mainPanel.doLayout();
- }
- }
+ }
- private int getWidgetCount(View view) {
- if (view instanceof Widget) {
- return deck.getWidgetIndex((Widget) view);
- } else if (view instanceof DefaultForm) {
- return deck.getWidgetIndex(((DefaultForm) view).getFormPanel());
- }
- return -1;
+ private Widget toWidget(final View view) {
+ if (view instanceof Widget) {
+ return (Widget) view;
+ } else if (view instanceof DefaultForm) {
+ return ((DefaultForm) view).getFormPanel();
+ } else {
+ OldNotifyUser.error("Trying to add a unknown element in WizardDialog");
+ return null;
}
+ }
- private Widget toWidget(View view) {
- if (view instanceof Widget) {
- return (Widget) view;
- } else if (view instanceof DefaultForm) {
- return ((DefaultForm) view).getFormPanel();
- } else {
- OldNotifyUser.error("Trying to add a unknown element in WizardDialog");
- return null;
- }
- }
+ @Override
+ public void unMask() {
+ dialog.getEl().unmask();
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -22,7 +22,7 @@
import org.cobogw.gwt.user.client.CSS;
import org.ourproject.kune.platf.client.ui.rte.insertlink.LinkInfo;
-import cc.kune.core.client.ui.utils.ContentPosition;
+import cc.kune.core.client.ui.ContentPosition;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.DOM;
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 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPresenter.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -21,7 +21,7 @@
import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialogPresenter;
-import cc.kune.core.client.ui.utils.ContentPosition;
+import cc.kune.core.client.ui.ContentPosition;
import com.calclab.suco.client.events.Listener;
import com.calclab.suco.client.events.Listener0;
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertElementAbstractPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertElementAbstractPanel.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertElementAbstractPanel.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -23,7 +23,7 @@
import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm;
import org.ourproject.kune.platf.client.ui.rte.insertimg.ImageInfo;
-import cc.kune.core.client.ui.utils.ContentPosition;
+import cc.kune.core.client.ui.ContentPosition;
import com.gwtext.client.data.Record;
import com.gwtext.client.data.SimpleStore;
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPanel.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPanel.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -23,7 +23,7 @@
import org.ourproject.kune.platf.client.ui.rte.insertimg.ImageInfo;
import org.ourproject.kune.platf.client.ui.rte.insertimg.InsertImageDialogView;
-import cc.kune.core.client.ui.utils.ContentPosition;
+import cc.kune.core.client.ui.ContentPosition;
import com.gwtext.client.data.Record;
import com.gwtext.client.data.SimpleStore;
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractPanel.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractPanel.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -23,7 +23,7 @@
import org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg.InsertElementAbstractPanel;
import org.ourproject.kune.platf.client.ui.rte.insertmedia.InsertMediaDialogView;
-import cc.kune.core.client.ui.utils.ContentPosition;
+import cc.kune.core.client.ui.ContentPosition;
import com.gwtext.client.widgets.Component;
import com.gwtext.client.widgets.Panel;
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseChangeAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseChangeAction.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseChangeAction.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -1,63 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 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.licensewizard;
-
-import org.ourproject.kune.platf.client.ui.noti.OldNotifyUser;
-
-import cc.kune.core.client.rpcservices.GroupServiceAsync;
-import cc.kune.core.client.state.Session;
-import cc.kune.core.client.state.StateManager;
-import cc.kune.core.shared.domain.utils.StateToken;
-import cc.kune.core.shared.dto.LicenseDTO;
-import cc.kune.core.shared.i18n.I18nTranslationService;
-
-import com.calclab.suco.client.events.Listener0;
-import com.calclab.suco.client.ioc.Provider;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-public class LicenseChangeAction {
- private final StateManager stateManager;
- private final Provider<GroupServiceAsync> groupService;
- private final Session session;
- private final I18nTranslationService i18n;
-
- public LicenseChangeAction(final Provider<GroupServiceAsync> groupService, final Session session,
- final I18nTranslationService i18n, final StateManager stateManager) {
- this.groupService = groupService;
- this.session = session;
- this.i18n = i18n;
- this.stateManager = stateManager;
- }
-
- public void changeLicense(final StateToken token, final LicenseDTO license, final Listener0 onSuccess) {
- OldNotifyUser.showProgressProcessing();
- groupService.get().changeDefLicense(session.getUserHash(), token, license, new AsyncCallback<Void>() {
- public void onFailure(final Throwable caught) {
- OldNotifyUser.hideProgress();
- OldNotifyUser.error(i18n.t("Error changing default group license"));
- }
-
- public void onSuccess(final Void result) {
- stateManager.reload();
- onSuccess.onEvent();
- }
- });
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizard.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizard.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizard.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -1,31 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 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.licensewizard;
-
-
-import cc.kune.core.shared.dto.LicenseDTO;
-
-import com.calclab.suco.client.events.Listener;
-
-public interface LicenseWizard {
-
- void start(Listener<LicenseDTO> listener);
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPanel.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPanel.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -1,64 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 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.licensewizard;
-
-import org.ourproject.kune.platf.client.ui.dialogs.WizardDialog;
-import org.ourproject.kune.platf.client.ui.dialogs.WizardListener;
-import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-
-import cc.kune.core.shared.i18n.I18nTranslationService;
-
-public class LicenseWizardPanel extends WizardDialog implements LicenseWizardView {
-
- public static final String LIC_WIZ_DIALOG = "k-lwp-diag";
- public static final String BACK_BTN_ID = "k-lwp-back-btn";
- public static final String NEXT_BTN_ID = "k-lwp-next-btn";
- public static final String FINISH_BTN_ID = "k-lwp-finish-btn";
- public static final String CLOSE_BTN_ID = "k-lwp-close-btn";
- public static final String CANCEL_BTN_ID = "k-lwp-cancel-btn";
-
- public LicenseWizardPanel(final LicenseWizardPresenter presenter, final WorkspaceSkeleton ws,
- I18nTranslationService i18n) {
- super(LIC_WIZ_DIALOG, i18n.t("License wizard"), true, false, WIDTH, HEIGHT, WIDTH, HEIGHT, BACK_BTN_ID,
- NEXT_BTN_ID, FINISH_BTN_ID, CANCEL_BTN_ID, CLOSE_BTN_ID, i18n, new WizardListener() {
- public void onBack() {
- presenter.onBack();
- }
-
- public void onCancel() {
- presenter.onCancel();
- }
-
- public void onClose() {
- presenter.onClose();
- }
-
- public void onFinish() {
- presenter.onChange();
- }
-
- public void onNext() {
- presenter.onNext();
- }
- });
- super.setFinishText(i18n.t("Select"));
- super.setIconCls("k-copyleft-icon");
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenter.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenter.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -1,218 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 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.licensewizard;
-
-import java.util.List;
-
-import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.ui.noti.OldNotifyUser;
-import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardFirstFormView;
-import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardFrdFormView;
-import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardSndFormView;
-import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardTrdFormView;
-
-import cc.kune.core.client.state.Session;
-import cc.kune.core.shared.dto.LicenseDTO;
-
-import com.allen_sauer.gwt.log.client.Log;
-import com.calclab.suco.client.events.Listener;
-import com.calclab.suco.client.events.Listener0;
-
-public class LicenseWizardPresenter implements LicenseWizard {
-
- private LicenseWizardView view;
- private final LicenseWizardFirstFormView fstForm;
- private final LicenseWizardSndFormView sndForm;
- private final LicenseWizardTrdFormView trdForm;
- private final LicenseWizardFrdFormView frdForm;
- private final Session session;
- private Listener<LicenseDTO> selectLicenseListener;
- private final String ccVers;
-
- public LicenseWizardPresenter(LicenseWizardFirstFormView firstForm, LicenseWizardSndFormView sndForm,
- LicenseWizardTrdFormView trdForm, LicenseWizardFrdFormView frdForm, Session session) {
- this.fstForm = firstForm;
- this.sndForm = sndForm;
- this.trdForm = trdForm;
- this.frdForm = frdForm;
- this.session = session;
- ccVers = "-" + session.getCurrentCCversion();
- }
-
- public View getView() {
- return view;
- }
-
- public void init(final LicenseWizardView view) {
- this.view = view;
- fstForm.onCopyLeftLicenseSelected(new Listener0() {
- public void onEvent() {
- onCopyLeftLicenseSelected();
- }
- });
- fstForm.onAnotherLicenseSelected(new Listener0() {
- public void onEvent() {
- onAnotherLicenseSelecterd();
- }
- });
- trdForm.onChange(new Listener0() {
- public void onEvent() {
- onCreativeCommonsChanged();
- }
- });
- frdForm.onChange(new Listener0() {
- public void onEvent() {
- if (frdForm.getSelectedLicense().length() > 0) {
- view.setEnabled(true, false, true, true);
- }
- }
- });
- view.add(fstForm);
- view.add(sndForm);
- view.add(trdForm);
- view.add(frdForm);
- }
-
- public void onBack() {
- if (view.isCurrentPage(sndForm)) {
- showFst();
- } else if (in(trdForm)) {
- showSnd();
- } else if (in(frdForm)) {
- showSnd();
- } else {
- Log.error("Programatic error in LicenseWizardPresenter");
- }
- }
-
- public void onCancel() {
- view.hide();
- }
-
- public void onChange() {
- String licenseShortName;
- if (in(fstForm)) {
- licenseShortName = "by-sa" + ccVers;
- } else if (in(trdForm)) {
- if (trdForm.isAllowComercial()) {
- licenseShortName = trdForm.isAllowModif() ? "by" + ccVers : trdForm.isAllowModifShareAlike() ? "by-sa"
- + ccVers : "by-nd" + ccVers;
- } else {
- licenseShortName = trdForm.isAllowModif() ? "by-nc" + ccVers
- : trdForm.isAllowModifShareAlike() ? "by-nc-sa" + ccVers : "by-nc-nd" + ccVers;
- }
- } else if (in(sndForm)) {
- licenseShortName = "by-sa" + ccVers;
- OldNotifyUser.error("Programatic error in LicenseWizardPresenter");
- } else {
- licenseShortName = frdForm.getSelectedLicense();
- }
- view.hide();
- selectLicenseListener.onEvent(getLicenseFromShortName(licenseShortName));
- }
-
- public void onClose() {
- view.hide();
- }
-
- public void onNext() {
- if (in(fstForm)) {
- view.clear();
- showSnd();
- } else if (in(sndForm)) {
- if (sndForm.isCommonLicensesSelected()) {
- showTrd();
- } else {
- showFrd();
- }
- } else {
- Log.error("Programatic error in LicenseWizardPresenter");
- }
- }
-
- public void start(Listener<LicenseDTO> selectLicenseListener) {
- this.selectLicenseListener = selectLicenseListener;
- reset();
- view.show();
- view.center();
- }
-
- void onAnotherLicenseSelecterd() {
- view.setEnabled(false, true, true, false);
- }
-
- void onCopyLeftLicenseSelected() {
- view.setEnabled(false, false, true, true);
- }
-
- private LicenseDTO getLicenseFromShortName(final String shortName) {
- List<LicenseDTO> licenses = session.getLicenses();
- for (int i = 0; i < licenses.size(); i++) {
- final LicenseDTO licenseDTO = licenses.get(i);
- if (licenseDTO.getShortName().equals(shortName)) {
- return licenseDTO;
- }
- }
- Log.error("Internal error: License not found");
- throw new IndexOutOfBoundsException("License not found");
- }
-
- private boolean in(View page) {
- return view.isCurrentPage(page);
- }
-
- private void onCreativeCommonsChanged() {
- boolean isCopyleft = trdForm.isAllowComercial() && trdForm.isAllowModifShareAlike();
- boolean isAppropiateForCulturalWorks = trdForm.isAllowComercial()
- && (trdForm.isAllowModif() || trdForm.isAllowModifShareAlike());
- trdForm.setFlags(isCopyleft, isAppropiateForCulturalWorks, !trdForm.isAllowComercial());
- }
-
- private void reset() {
- view.clear();
- view.setEnabled(false, false, true, true);
- view.show(fstForm);
- fstForm.reset();
- sndForm.reset();
- trdForm.reset();
- frdForm.reset();
- }
-
- private void showFrd() {
- view.show(frdForm);
- view.setEnabled(true, false, true, false);
- }
-
- private void showFst() {
- view.clear();
- view.show(fstForm);
- view.setEnabled(false, true, true, true);
- }
-
- private void showSnd() {
- view.show(sndForm);
- view.setEnabled(true, true, true, false);
- }
-
- private void showTrd() {
- view.show(trdForm);
- view.setEnabled(true, false, true, true);
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardView.java 2011-05-06 20:13:51 UTC (rev 1356)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardView.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -1,28 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 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.licensewizard;
-
-import org.ourproject.kune.platf.client.ui.dialogs.WizardDialogView;
-
-public interface LicenseWizardView extends WizardDialogView {
-
- int WIDTH = 400;
- int HEIGHT = 450;
-}
Copied: trunk/src/test/java/cc/kune/gspace/client/licensewizard (from rev 1355, trunk/src/test/java/org/ourproject/kune/workspace/client/licensewizard)
Modified: trunk/src/test/java/cc/kune/gspace/client/licensewizard/LicenseWizardPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenterTest.java 2011-05-06 14:45:24 UTC (rev 1355)
+++ trunk/src/test/java/cc/kune/gspace/client/licensewizard/LicenseWizardPresenterTest.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -17,67 +17,66 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-package org.ourproject.kune.workspace.client.licensewizard;
+package cc.kune.gspace.client.licensewizard;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
-import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardFirstFormView;
-import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardFrdFormView;
-import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardSndFormView;
-import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardTrdFormView;
import cc.kune.core.client.state.Session;
+import cc.kune.gspace.client.licensewizard.pages.LicenseWizardFirstFormView;
+import cc.kune.gspace.client.licensewizard.pages.LicenseWizardFrdFormView;
+import cc.kune.gspace.client.licensewizard.pages.LicenseWizardSndFormView;
+import cc.kune.gspace.client.licensewizard.pages.LicenseWizardTrdFormView;
public class LicenseWizardPresenterTest {
- private LicenseWizardView view;
- private LicenseWizardPresenter licenseWizard;
- private LicenseWizardFirstFormView firstForm;
- private LicenseWizardSndFormView sndForm;
- private LicenseWizardTrdFormView trdForm;
- private LicenseWizardFrdFormView frdForm;
+ private LicenseWizardFirstFormView firstForm;
+ private LicenseWizardFrdFormView frdForm;
+ private LicenseWizardPresenter licenseWizard;
+ private LicenseWizardSndFormView sndForm;
+ private LicenseWizardTrdFormView trdForm;
+ private LicenseWizardView view;
- @Before
- public void before() {
- view = Mockito.mock(LicenseWizardView.class);
- firstForm = Mockito.mock(LicenseWizardFirstFormView.class);
- sndForm = Mockito.mock(LicenseWizardSndFormView.class);
- trdForm = Mockito.mock(LicenseWizardTrdFormView.class);
- frdForm = Mockito.mock(LicenseWizardFrdFormView.class);
- Session session = Mockito.mock(Session.class);
- licenseWizard = new LicenseWizardPresenter(firstForm, sndForm, trdForm, frdForm, session);
- licenseWizard.init(view);
- }
+ @Before
+ public void before() {
+ view = Mockito.mock(LicenseWizardView.class);
+ firstForm = Mockito.mock(LicenseWizardFirstFormView.class);
+ sndForm = Mockito.mock(LicenseWizardSndFormView.class);
+ trdForm = Mockito.mock(LicenseWizardTrdFormView.class);
+ frdForm = Mockito.mock(LicenseWizardFrdFormView.class);
+ final Session session = Mockito.mock(Session.class);
+ licenseWizard = new LicenseWizardPresenter(null, view, null, firstForm, sndForm, trdForm, frdForm,
+ session);
+ }
- @Test
- public void onAnotherSelected() {
- licenseWizard.onAnotherLicenseSelecterd();
- Mockito.verify(view).setEnabled(false, true, true, false);
- Mockito.when(view.isCurrentPage(firstForm)).thenReturn(true);
- licenseWizard.onNext();
- Mockito.verify(view).show(sndForm);
- Mockito.verify(view).setEnabled(true, true, true, false);
- Mockito.when(view.isCurrentPage(sndForm)).thenReturn(true);
- licenseWizard.onBack();
- Mockito.verify(view).show(firstForm);
- Mockito.verify(view).setEnabled(false, true, true, true);
- }
+ @Test
+ public void onAnotherSelected() {
+ licenseWizard.onAnotherLicenseSelecterd();
+ Mockito.verify(view).setEnabled(false, true, true, false);
+ Mockito.when(view.isCurrentPage(firstForm)).thenReturn(true);
+ licenseWizard.onNext();
+ Mockito.verify(view).show(sndForm);
+ Mockito.verify(view).setEnabled(true, true, true, false);
+ Mockito.when(view.isCurrentPage(sndForm)).thenReturn(true);
+ licenseWizard.onBack();
+ Mockito.verify(view).show(firstForm);
+ Mockito.verify(view).setEnabled(false, true, true, true);
+ }
- @Test
- public void onCopyleftSelected() {
- licenseWizard.onCopyLeftLicenseSelected();
- Mockito.verify(view).setEnabled(false, false, true, true);
- }
+ @Test
+ public void onCopyleftSelected() {
+ licenseWizard.onCopyLeftLicenseSelected();
+ Mockito.verify(view).setEnabled(false, false, true, true);
+ }
- @Test
- public void onShowResetWidget() {
- licenseWizard.start(null);
- Mockito.verify(view).clear();
- Mockito.verify(view).center();
- Mockito.verify(view).setEnabled(false, false, true, true);
- Mockito.verify(view).show(firstForm);
- Mockito.verify(firstForm).reset();
- Mockito.verify(view).show();
- }
+ @Test
+ public void onShowResetWidget() {
+ licenseWizard.start(null);
+ Mockito.verify(view).clear();
+ Mockito.verify(view).setEnabled(false, false, true, true);
+ Mockito.verify(view).show(firstForm);
+ Mockito.verify(firstForm).reset();
+ Mockito.verify(view).show();
+ }
}
Modified: trunk/src/test/java/cc/kune/gspace/client/licensewizard/MockProvider.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/licensewizard/MockProvider.java 2011-05-06 14:45:24 UTC (rev 1355)
+++ trunk/src/test/java/cc/kune/gspace/client/licensewizard/MockProvider.java 2011-05-07 15:55:38 UTC (rev 1357)
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-package org.ourproject.kune.workspace.client.licensewizard;
+package cc.kune.gspace.client.licensewizard;
import org.mockito.Mockito;
More information about the kune-commits
mailing list