r999 - in trunk/src: main/java/org/ourproject/kune/app/public/css main/java/org/ourproject/kune/platf/client/services main/java/org/ourproject/kune/platf/client/ui main/java/org/ourproject/kune/platf/client/ui/dialogs main/java/org/ourproject/kune/workspace/client/licensewizard main/java/org/ourproject/kune/workspace/client/licensewizard/pages main/java/org/ourproject/kune/workspace/client/newgroup main/java/org/ourproject/kune/workspace/client/options/license test/java/org/ourproject/kune/wo
Author: vjrj Date: 2008-12-18 19:31:33 +0100 (Thu, 18 Dec 2008) New Revision: 999 Added: trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardFlags.java trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardTrdForm.java trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardTrdFormView.java Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/all.css trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/WindowUtils.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultForm.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultFormUtils.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialogView.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/LicenseWizardFirstForm.java trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardSndForm.java trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/license/EntityOptionsDefLicensePanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/license/EntityOptionsDefLicensePresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/license/EntityOptionsDefLicenseView.java trunk/src/test/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenterTest.java Log: Incomplete - task New License Wizard Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/all.css =================================================================== --- trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-12-18 18:31:33 UTC (rev 999) @@ -41,4 +41,4 @@ padding: 1px 0px 1px 1px; text-decoration:none; } -*/.k-textlinethrough{text-decoration:line-through;color:red;}.k-textnormal{text-decoration:inherit;color:green;}.k-textunderline{text-decoration:underline;color:gray;}.x-tool-kmenu{background-position:0 -75px;}.x-tool-kmenu-over{background-position:-15px -75px;}.k-border-openbox{border-bottom:1px #D0D0D0 solid;border-right:1px #D0D0D0 solid;border-left:1px #D0D0D0 solid;}/* SiteToastMessages */.k-stm-info-icon{background-image:url(img/info.gif)!important;}.k-stm-imp-icon{background-image:url(img/alert.gif)!important;}.k-stm-verimp-icon{background-image:url(img/important.gif)!important;}.k-stm-error-icon{background-image:url(img/error.gif)!important;}.k-error-tb{background:#FFB380 none repeat scroll 0 50%;color:#250;}.k-infod-head{font-size:108%;margin-bottom:10px;}.gwt-DisclosurePanel{}.gwt-DisclosurePanel-open{}.gwt-DisclosurePanel-closed{}.gwt-DisclosurePanel .header,.gwt-DisclosurePanel .header a,.gwt-DisclosurePanel .header td{text-decoration:none;/* Remove underline from header */color:#000;cursor:pointer;cursor:hand;}.gwt-DisclosurePanel .content{border-left:3px solid #e8eef7;padding:4px 0 4px 8px;margin-left:6px;}.k-basic-thumb{background:#FAFAFA none repeat scroll 0 50%;border:1px solid #EBEBEB;padding:3px;margin:3px;}.k-basic-thumb td{padding:2px 3px;border:none;}.k-text-gray{color:gray;}.k-elp-limg{margin-top:4px;margin-left:5px;cursor:pointer;overflow:hidden;}.k-tsp-tag{float:right;margin-right:5px;cursor:pointer;color:#00F;}.k-tsp-cloud{vertical-align:bottom;}.k-options-icon{background-image:url(img/emblem-system.gif)!important;}.k-deflicense-icon{background-image:url(img/copyleft.png)!important;}.k-info-icon{background-image:url(img/info.gif)!important;}.x-toolbar-body table{/* width: 100%; */}.k-preview-msg{background:#FCA;}.k-preview-msg-lab{background:#FCA;padding:0 5px;}.k-eil-edit{border:thin solid #000;} \ No newline at end of file +*/.k-textlinethrough{text-decoration:line-through;color:red;}.k-textnormal{text-decoration:inherit;color:green;}.k-textunderline{text-decoration:underline;}.k-info-links{text-decoration:underline;color:gray;cursor:pointer;}.x-tool-kmenu{background-position:0 -75px;}.x-tool-kmenu-over{background-position:-15px -75px;}.k-border-openbox{border-bottom:1px #D0D0D0 solid;border-right:1px #D0D0D0 solid;border-left:1px #D0D0D0 solid;}/* SiteToastMessages */.k-stm-info-icon{background-image:url(img/info.gif)!important;}.k-stm-imp-icon{background-image:url(img/alert.gif)!important;}.k-stm-verimp-icon{background-image:url(img/important.gif)!important;}.k-stm-error-icon{background-image:url(img/error.gif)!important;}.k-error-tb{background:#FFB380 none repeat scroll 0 50%;color:#250;}.k-infod-head{font-size:108%;margin-bottom:10px;}.gwt-DisclosurePanel{}.gwt-DisclosurePanel-open{}.gwt-DisclosurePanel-closed{}.gwt-DisclosurePanel .header,.gwt-DisclosurePanel .header a,.gwt-DisclosurePanel .header td{text-decoration:none;/* Remove underline from header */color:#000;cursor:pointer;cursor:hand;}.gwt-DisclosurePanel .content{border-left:3px solid #e8eef7;padding:4px 0 4px 8px;margin-left:6px;}.k-basic-thumb{background:#FAFAFA none repeat scroll 0 50%;border:1px solid #EBEBEB;padding:3px;margin:3px;}.k-basic-thumb td{padding:2px 3px;border:none;}.k-text-gray{color:gray;}.k-elp-limg{margin-top:4px;margin-left:5px;cursor:pointer;overflow:hidden;}.k-tsp-tag{float:right;margin-right:5px;cursor:pointer;color:#00F;}.k-tsp-cloud{vertical-align:bottom;}.k-options-icon{background-image:url(img/emblem-system.gif)!important;}.k-deflicense-icon{background-image:url(img/copyleft.png)!important;}.k-info-icon{background-image:url(img/info.gif)!important;}.x-toolbar-body table{/* width: 100%; */}.k-preview-msg{background:#FCA;}.k-preview-msg-lab{background:#FCA;padding:0 5px;}.k-eil-edit{border:thin solid #000;} \ No newline at end of file Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css =================================================================== --- trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2008-12-18 18:31:33 UTC (rev 999) @@ -709,9 +709,14 @@ .k-textunderline { text-decoration: underline; - color: gray; } +.k-info-links { + text-decoration: underline; + color:gray; + cursor: pointer; +} + .x-tool-kmenu { background-position: 0 -75px; } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-12-18 18:31:33 UTC (rev 999) @@ -56,6 +56,8 @@ import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardFirstFormView; import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardSndForm; import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardSndFormView; +import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardTrdForm; +import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardTrdFormView; import org.ourproject.kune.workspace.client.nohomepage.NoHomePage; import org.ourproject.kune.workspace.client.nohomepage.NoHomePagePanel; import org.ourproject.kune.workspace.client.nohomepage.NoHomePagePresenter; @@ -496,7 +498,7 @@ public LicenseWizard create() { final LicenseWizardPresenter presenter = new LicenseWizardPresenter( $(LicenseWizardFirstFormView.class), $(LicenseWizardSndFormView.class), - $$(GroupServiceAsync.class)); + $(LicenseWizardTrdFormView.class), $$(GroupServiceAsync.class)); final LicenseWizardPanel panel = new LicenseWizardPanel(presenter, $(WorkspaceSkeleton.class), $(I18nTranslationService.class)); presenter.init(panel); @@ -517,5 +519,12 @@ return new LicenseWizardSndForm($(I18nTranslationService.class)); } }); + + register(Singleton.class, new Factory<LicenseWizardTrdFormView>(LicenseWizardTrdFormView.class) { + @Override + public LicenseWizardTrdFormView create() { + return new LicenseWizardTrdForm($(Images.class), $(I18nTranslationService.class)); + } + }); } } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabel.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabel.java 2008-12-18 18:31:33 UTC (rev 999) @@ -163,6 +163,10 @@ mouseWheelListeners.add(listener); } + public void setStyleNameToText(final String styleName) { + DOM.setElementProperty(textLabel.<com.google.gwt.user.client.Element> cast(), "className", styleName); + } + public HorizontalAlignmentConstant getHorizontalAlignment() { return horzAlign; } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/WindowUtils.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/WindowUtils.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/WindowUtils.java 2008-12-18 18:31:33 UTC (rev 999) @@ -1,4 +1,3 @@ - /* * Copyright 2006 Robert Hanson <iamroberthanson AT gmail.com> * @@ -15,6 +14,8 @@ * limitations under the License. */package org.ourproject.kune.platf.client.ui; +import com.google.gwt.user.client.Window; + public class WindowUtils { public static Location getLocation() { Location result = new Location(); @@ -29,36 +30,40 @@ return result; } - private static native String getQueryString() /*-{ - return $wnd.location.search; - }-*/; + public static void open(String url) { + Window.open(url, "_blank", ""); + } - private static native String getProtocol() /*-{ - return $wnd.location.protocol; - }-*/; + private static native String getHash() /*-{ + return $wnd.location.hash; + }-*/; - private static native String getPort() /*-{ - return $wnd.location.port; - }-*/; + private static native String getHost() /*-{ + return $wnd.location.host; + }-*/; - private static native String getPath() /*-{ - return $wnd.location.pathname; - }-*/; + private static native String getHostName() /*-{ + return $wnd.location.hostname; + }-*/; private static native String getHref() /*-{ - return $wnd.location.href; - }-*/; + return $wnd.location.href; + }-*/; - private static native String getHostName() /*-{ - return $wnd.location.hostname; - }-*/; + private static native String getPath() /*-{ + return $wnd.location.pathname; + }-*/; - private static native String getHost() /*-{ - return $wnd.location.host; - }-*/; + private static native String getPort() /*-{ + return $wnd.location.port; + }-*/; - private static native String getHash() /*-{ - return $wnd.location.hash; - }-*/; + private static native String getProtocol() /*-{ + return $wnd.location.protocol; + }-*/; + private static native String getQueryString() /*-{ + return $wnd.location.search; + }-*/; + } \ No newline at end of file Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultForm.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultForm.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultForm.java 2008-12-18 18:31:33 UTC (rev 999) @@ -105,10 +105,18 @@ form.setAutoWidth(autoWidth); } + public void setFrame(boolean frame) { + form.setFrame(frame); + } + public void setHeight(int height) { form.setHeight(height); } + public void setPaddings(int padding) { + form.setPaddings(padding); + } + public void setWidth(int width) { form.setWidth(width); } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultFormUtils.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultFormUtils.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultFormUtils.java 2008-12-18 18:31:33 UTC (rev 999) @@ -16,10 +16,10 @@ return "<br/><br/>"; } - public static Radio createRadio(final FieldSet fieldSet, final String radioLabel, final String radioTip, - final String id) { + public static Radio createRadio(final FieldSet fieldSet, final String radioLabel, final String radioFieldName, + final String radioTip, final String id) { Radio radio = new Radio(); - radio.setName("k-def-radio-field"); + radio.setName(radioFieldName); radio.setAutoCreate(true); radio.setHideLabel(true); radio.setId(id); 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 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java 2008-12-18 18:31:33 UTC (rev 999) @@ -21,8 +21,9 @@ import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.services.I18nTranslationService; +import org.ourproject.kune.workspace.client.site.Site; -import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.user.client.ui.DeckPanel; import com.google.gwt.user.client.ui.Widget; import com.gwtext.client.core.EventObject; import com.gwtext.client.widgets.Button; @@ -31,6 +32,7 @@ import com.gwtext.client.widgets.Toolbar; import com.gwtext.client.widgets.event.ButtonListenerAdapter; import com.gwtext.client.widgets.event.WindowListenerAdapter; +import com.gwtext.client.widgets.layout.FitLayout; public class WizardDialog implements WizardDialogView { @@ -40,6 +42,8 @@ private final Button finishButton; private final I18nTranslationService i18n; private final Button nextButton; + private final DeckPanel deck; + private final Panel mainPanel; 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, @@ -96,6 +100,10 @@ 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, @@ -106,15 +114,7 @@ } public void add(View view) { - if (view instanceof Widget) { - dialog.add((Widget) view); - } else if (view instanceof Panel) { - dialog.add((Panel) view); - } else if (view instanceof DefaultForm) { - dialog.add(((DefaultForm) view).getFormPanel()); - } else { - Log.error("Trying to add a unknown element in WizardDialog"); - } + deck.add(toWidget(view)); doLayoutIfNeeded(); } @@ -135,6 +135,15 @@ dialog.hide(); } + public boolean isCurrentPage(View view) { + int visibleWidgetIndex = deck.getVisibleWidget(); + if (visibleWidgetIndex == -1) { + return false; + } else { + return deck.getWidget(visibleWidgetIndex).equals(toWidget(view)); + } + } + public void mask(final String message) { dialog.getEl().mask(message, "x-mask-loading"); } @@ -144,7 +153,10 @@ } public void remove(View view) { - dialog.remove((Widget) view); + int count = getWidgetCount(view); + if (count != -1) { + deck.remove(count); + } } public void setBottomToolbar(Toolbar toolbar) { @@ -225,6 +237,18 @@ dialog.show(); } + public void show(View view) { + int count = getWidgetCount(view); + if (count != -1) { + deck.showWidget(count); + dialog.add(mainPanel); + doLayoutIfNeeded(); + } else { + Site.error("Widget not found in deck of WizardDialog"); + } + + } + public void unMask() { dialog.getEl().unmask(); } @@ -232,6 +256,28 @@ 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(View view) { + if (view instanceof Widget) { + return (Widget) view; + } else if (view instanceof DefaultForm) { + return ((DefaultForm) view).getFormPanel(); + } else { + Site.error("Trying to add a unknown element in WizardDialog"); + return null; + } + } } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialogView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialogView.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialogView.java 2008-12-18 18:31:33 UTC (rev 999) @@ -12,6 +12,8 @@ void hide(); + boolean isCurrentPage(View view); + void mask(final String message); void maskProcessing(); @@ -42,6 +44,8 @@ void show(); + void show(View view); + void unMask(); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPanel.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPanel.java 2008-12-18 18:31:33 UTC (rev 999) @@ -16,8 +16,8 @@ public LicenseWizardPanel(final LicenseWizardPresenter presenter, final WorkspaceSkeleton ws, I18nTranslationService i18n) { - super(LIC_WIZ_DIALOG, i18n.t("License wizard"), true, false, 400, 300, 400, 300, BACK_BTN_ID, NEXT_BTN_ID, - FINISH_BTN_ID, CANCEL_BTN_ID, CLOSE_BTN_ID, i18n, new WizardListener() { + 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(); } @@ -38,8 +38,7 @@ presenter.onNext(); } }); - super.setFinishText(i18n.t("Change")); + super.setFinishText(i18n.t("Select")); super.setIconCls("k-deflicense-icon"); - } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenter.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenter.java 2008-12-18 18:31:33 UTC (rev 999) @@ -4,7 +4,9 @@ import org.ourproject.kune.platf.client.rpc.GroupServiceAsync; import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardFirstFormView; import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardSndFormView; +import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardTrdFormView; +import com.allen_sauer.gwt.log.client.Log; import com.calclab.suco.client.ioc.Provider; import com.calclab.suco.client.listener.Listener0; @@ -14,11 +16,13 @@ private final LicenseWizardFirstFormView firstForm; private final LicenseWizardSndFormView sndForm; private final Provider<GroupServiceAsync> groupService; + private final LicenseWizardTrdFormView trdForm; public LicenseWizardPresenter(LicenseWizardFirstFormView firstForm, LicenseWizardSndFormView sndForm, - Provider<GroupServiceAsync> groupService) { + LicenseWizardTrdFormView trdForm, Provider<GroupServiceAsync> groupService) { this.firstForm = firstForm; this.sndForm = sndForm; + this.trdForm = trdForm; this.groupService = groupService; } @@ -38,12 +42,24 @@ onAnotherLicenseSelecterd(); } }); + trdForm.onChange(new Listener0() { + public void onEvent() { + onCreativeCommonsChanged(); + } + }); + view.add(firstForm); + view.add(sndForm); + view.add(trdForm); } public void onBack() { - view.clear(); - view.add(firstForm); - view.setEnabled(false, true, true, true); + if (view.isCurrentPage(sndForm)) { + showFst(); + } else if (view.isCurrentPage(trdForm)) { + showSnd(); + } else { + Log.error("Programatic error in LicenseWizardPresenter"); + } } public void onCancel() { @@ -60,9 +76,14 @@ } public void onNext() { - view.clear(); - view.add(sndForm); - view.setEnabled(true, false, true, true); + if (view.isCurrentPage(firstForm)) { + view.clear(); + showSnd(); + } else if (view.isCurrentPage(sndForm)) { + showTrd(); + } else { + Log.error("Programatic error in LicenseWizardPresenter"); + } } public void show() { @@ -79,10 +100,35 @@ view.setEnabled(false, false, true, true); } + 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.add(firstForm); + view.show(firstForm); firstForm.reset(); + sndForm.reset(); + trdForm.reset(); } + + private void showFst() { + view.clear(); + view.show(firstForm); + 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); + } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardView.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardView.java 2008-12-18 18:31:33 UTC (rev 999) @@ -3,4 +3,7 @@ import org.ourproject.kune.platf.client.ui.dialogs.WizardDialogView; public interface LicenseWizardView extends WizardDialogView { + + int WIDTH = 400; + int HEIGHT = 450; } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardFirstForm.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardFirstForm.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardFirstForm.java 2008-12-18 18:31:33 UTC (rev 999) @@ -4,6 +4,7 @@ import org.ourproject.kune.platf.client.ui.TextUtils; 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 com.calclab.suco.client.listener.Event0; import com.calclab.suco.client.listener.Listener0; @@ -17,6 +18,7 @@ private static final String POINT = "» "; public static final String RADIO_COPYLEFT_ID = "k-lwff-copyleft"; public static final String RADIO_ANOTHER_ID = "k-lwff-another"; + private static final String RADIO_FIELD_NAME = "k-lwff-radio"; private final Event0 onCopyLeftLicenseSelected; private final Event0 onAnotherLicenseSelected; private final Radio copyleftRadio; @@ -25,18 +27,21 @@ public LicenseWizardFirstForm(I18nTranslationService i18n) { this.onCopyLeftLicenseSelected = new Event0("onCopyLeftLicenseSelected"); this.onAnotherLicenseSelected = new Event0("onAnotherLicenseSelected"); + super.setFrame(true); + super.setPaddings(10); + super.setHeight(LicenseWizardView.HEIGHT); Label intro = new Label(); intro.setHtml(i18n.t("Select a license to share your group contents with other people:") + DefaultFormUtils.brbr()); - final FieldSet fieldSet = new FieldSet(i18n.t("Group type")); + 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)."), null, - RADIO_COPYLEFT_ID); + 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 use)."), null, RADIO_ANOTHER_ID); + i18n.t("Use another kind of license (advanced use)."), RADIO_FIELD_NAME, null, RADIO_ANOTHER_ID); copyleftRadio.addListener(new CheckboxListenerAdapter() { @Override public void onCheck(Checkbox field, boolean checked) { @@ -67,8 +72,9 @@ + i18n.t("We recommend [%s] licenses, specially for practical works.", TextUtils.generateHtmlLink( "http://en.wikipedia.org/wiki/Copyleft", i18n.t("copyleft"))) + DefaultFormUtils.br()); // FIXME - whyALicense.setHtml(POINT + TextUtils.generateHtmlLink("FIXME", i18n.t("Do we need a license?")) - + DefaultFormUtils.br()); + whyALicense.setHtml(POINT + + TextUtils.generateHtmlLink("http://mirrors.creativecommons.org/getcreative/", + i18n.t("Do we need a license?")) + DefaultFormUtils.br()); youCanChangeTheLicenseLater.setHtml(POINT + i18n.t("You can change this license later or select a per content license.") + DefaultFormUtils.br()); Added: trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardFlags.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardFlags.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardFlags.java 2008-12-18 18:31:33 UTC (rev 999) @@ -0,0 +1,69 @@ +package org.ourproject.kune.workspace.client.licensewizard.pages; + +import org.ourproject.kune.platf.client.services.I18nTranslationService; +import org.ourproject.kune.platf.client.services.Images; +import org.ourproject.kune.platf.client.ui.IconLabel; +import org.ourproject.kune.platf.client.ui.WindowUtils; + +import com.google.gwt.user.client.ui.ClickListener; +import com.google.gwt.user.client.ui.Widget; +import com.gwtext.client.widgets.Panel; + +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 LicenseWizardFlags(Images images, 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(boolean isCopyleft) { + copyleft.setVisible(isCopyleft); + nonCopyleft.setVisible(!isCopyleft); + } + + public void setCulturalWorks(boolean isAppropiateForCulturalWorks) { + culturalWorks.setVisible(isAppropiateForCulturalWorks); + nonCulturalWorks.setVisible(!isAppropiateForCulturalWorks); + } + + public void setNonComercial(boolean isNonComercial) { + nonCommercialReasons.setVisible(isNonComercial); + } + + public void setVisible(boolean isCopyleft, boolean isAppropiateForCulturalWorks, boolean isNonComercial) { + setCopyleft(isCopyleft); + setCulturalWorks(isAppropiateForCulturalWorks); + setNonComercial(isNonComercial); + } + + private void addLink(IconLabel label, final String url) { + label.addClickListener(new ClickListener() { + public void onClick(Widget sender) { + openWindow(url); + } + + private void openWindow(String url) { + WindowUtils.open(url); + } + }); + label.setStyleNameToText("k-info-links"); + } +} Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardSndForm.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardSndForm.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardSndForm.java 2008-12-18 18:31:33 UTC (rev 999) @@ -3,6 +3,7 @@ import org.ourproject.kune.platf.client.services.I18nTranslationService; 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 com.calclab.suco.client.listener.Event0; import com.calclab.suco.client.listener.Listener0; @@ -15,6 +16,7 @@ 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 Event0 onCommonLicensesSelected; private final Event0 onOtherLicensesSelected; private final Radio commonLicensesRadio; @@ -23,16 +25,23 @@ public LicenseWizardSndForm(I18nTranslationService i18n) { this.onCommonLicensesSelected = new Event0("onCommonLicensesSelected"); this.onOtherLicensesSelected = new Event0("onOtherLicensesSelected"); + setFrame(true); + super.setPaddings(10); + super.setHeight(LicenseWizardView.HEIGHT); Label intro = new Label(); intro.setHtml(i18n.t("Select the type of license:") + DefaultFormUtils.brbr()); - final FieldSet fieldSet = new FieldSet(i18n.t("Group type")); + final FieldSet fieldSet = new FieldSet("license type"); fieldSet.setStyle("margin-left: 105px"); fieldSet.setWidth(250); - commonLicensesRadio = DefaultFormUtils.createRadio(fieldSet, i18n.t("Common licenses"), null, - COMMON_LICENSES_ID); - otherLicensesRadio = DefaultFormUtils.createRadio(fieldSet, i18n.t("Other kind of licenses"), null, + commonLicensesRadio = DefaultFormUtils.createRadio(fieldSet, i18n.t("Common licenses"), 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 other kind of licenses like the FSF licenses (recommended for free software works) and other kind of licenses"), OTHER_LICENSES_ID); commonLicensesRadio.addListener(new CheckboxListenerAdapter() { @Override Added: trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardTrdForm.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardTrdForm.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardTrdForm.java 2008-12-18 18:31:33 UTC (rev 999) @@ -0,0 +1,149 @@ +package org.ourproject.kune.workspace.client.licensewizard.pages; + +import org.ourproject.kune.platf.client.services.I18nTranslationService; +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 com.calclab.suco.client.listener.Event0; +import com.calclab.suco.client.listener.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; + +public class LicenseWizardTrdForm extends DefaultForm implements LicenseWizardTrdFormView { + public static final String RADIO_PERMIT_COMMERCIAL_ID = "k-lwtf-perm-comm"; + public static final String RADIO_NOT_COMM_ID = "k-lwtf-not-perm-comm"; + public static final String RADIO_COMMERCIAL_FIELD_NAME = "k-lwtf-comm-radio"; + 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"; + public static final String RADIO_NOT_PERMIT_MOD_ID = "k-lwtf-not-mod"; + public static final String RADIO_MODIF_FIELD_NAME = "k-lwtf-mod-radio"; + private Radio permitComercialRadio; + private Radio permitModRadio; + private Radio permitModSaRadio; + private final LicenseWizardFlags info; + private Radio notPermitModRadio; + private Radio notPermitComercialLicenseRadio; + private final Event0 onChange; + + public LicenseWizardTrdForm(Images images, I18nTranslationService i18n) { + super.setFrame(true); + super.setHeight(LicenseWizardView.HEIGHT); + super.setPaddings(10); + + this.onChange = new Event0("onChange"); + + 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()); + + Label commercialQuestion = new Label(); + commercialQuestion.setHtml(i18n.t("Allow any uses of your work, including commercial?") + DefaultFormUtils.br()); + Label modificationsQuestion = new Label(); + modificationsQuestion.setHtml(i18n.t("Allow modifications of your work?") + DefaultFormUtils.br()); + + 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(); + + info = new LicenseWizardFlags(images, i18n); + + add(intro); + add(commercialfieldSet); + add(modificationsfieldSet); + add(new PaddedPanel(info, 0, 0, 0, 0)); + } + + public boolean isAllowComercial() { + return permitComercialRadio.getValue(); + } + + public boolean isAllowModif() { + return permitModRadio.getValue(); + } + + public boolean isAllowModifShareAlike() { + return permitModSaRadio.getValue(); + } + + public void onChange(final Listener0 slot) { + onChange.add(slot); + } + + @Override + public void reset() { + super.reset(); + permitComercialRadio.setChecked(true); + permitModSaRadio.setChecked(true); + } + + public void setFlags(boolean isCopyleft, boolean isAppropiateForCulturalWorks, boolean isNonComercial) { + info.setVisible(isCopyleft, isAppropiateForCulturalWorks, isNonComercial); + } + + private void createRadioListeners() { + Radio[] radios = { permitModRadio, permitModSaRadio, notPermitModRadio, permitComercialRadio, + notPermitComercialLicenseRadio }; + for (Radio radio : radios) { + radio.addListener(new CheckboxListenerAdapter() { + @Override + public void onChange(Field field, Object newVal, Object oldVal) { + onChange.fire(); + } + + @Override + public void onCheck(Checkbox field, boolean checked) { + onChange.fire(); + } + }); + } + } + + private void createRadios(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); + } +} Added: trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardTrdFormView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardTrdFormView.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardTrdFormView.java 2008-12-18 18:31:33 UTC (rev 999) @@ -0,0 +1,19 @@ +package org.ourproject.kune.workspace.client.licensewizard.pages; + +import org.ourproject.kune.platf.client.View; + +import com.calclab.suco.client.listener.Listener0; + +public interface LicenseWizardTrdFormView extends View { + boolean isAllowComercial(); + + boolean isAllowModif(); + + boolean isAllowModifShareAlike(); + + void onChange(Listener0 slot); + + void reset(); + + void setFlags(boolean isCopyleft, boolean isAppropiateForCulturalWorks, boolean isNonComercial); +} Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java 2008-12-18 18:31:33 UTC (rev 999) @@ -283,7 +283,7 @@ form.add(groupTypeFieldSet); - projectRadio = DefaultFormUtils.createRadio(groupTypeFieldSet, i18n.t("Project"), + projectRadio = DefaultFormUtils.createRadio(groupTypeFieldSet, i18n.t("Project"), TYPEOFGROUP_FIELD, i18n.t("A project is a kind of group in which new members joining " + "is moderated by the project administrators. " + "An administrator is the person who creates the project " @@ -291,12 +291,12 @@ projectRadio.setTabIndex(5); projectRadio.setChecked(true); - orgRadio = DefaultFormUtils.createRadio(groupTypeFieldSet, i18n.t("Organization"), + orgRadio = DefaultFormUtils.createRadio(groupTypeFieldSet, i18n.t("Organization"), TYPEOFGROUP_FIELD, i18n.t("An organization works as a project, " + "but organizations must be a legal entity."), ORG_GROUP_TYPE_ID); orgRadio.setTabIndex(6); - communityRadio = DefaultFormUtils.createRadio(groupTypeFieldSet, i18n.t("Community"), + communityRadio = DefaultFormUtils.createRadio(groupTypeFieldSet, i18n.t("Community"), TYPEOFGROUP_FIELD, i18n.t("Communities are social groups of persons " + "with shared interests, which are open to new members " + "(for instance the environmental community or the LGBT community). " Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/license/EntityOptionsDefLicensePanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/license/EntityOptionsDefLicensePanel.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/license/EntityOptionsDefLicensePanel.java 2008-12-18 18:31:33 UTC (rev 999) @@ -3,12 +3,16 @@ import org.ourproject.kune.platf.client.dto.LicenseDTO; import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.ui.KuneUiUtils; +import org.ourproject.kune.platf.client.ui.WindowUtils; import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm; import org.ourproject.kune.platf.client.ui.dialogs.DefaultFormUtils; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; +import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.Image; +import com.google.gwt.user.client.ui.Widget; import com.gwtext.client.core.EventObject; +import com.gwtext.client.core.Position; import com.gwtext.client.widgets.Button; import com.gwtext.client.widgets.PaddedPanel; import com.gwtext.client.widgets.Panel; @@ -24,14 +28,21 @@ super(i18n.t("License")); super.setAutoWidth(true); super.setAutoHeight(true); + super.getFormPanel().setButtonAlign(Position.LEFT); Label intro = new Label(); - intro.setHtml(i18n.t("This is the default license of all the contents of this group (you can also select another different license per content).") + intro.setHtml(i18n.t("This is the default license of all the contents of this group (you can also select another different license per content):") + DefaultFormUtils.brbr()); licenseImage = new Image(); Panel imagePanel = new Panel(); imagePanel.setBorder(false); imagePanel.add(licenseImage); + licenseImage.addClickListener(new ClickListener() { + public void onClick(Widget arg0) { + presenter.onLicenseClick(); + } + }); + licenseImage.addStyleName("kune-pointer"); Button change = new Button(i18n.t("Change")); change.addListener(new ButtonListenerAdapter() { @@ -42,10 +53,14 @@ }); add(intro); - add(new PaddedPanel(imagePanel, 0, 110, 0, 5)); + add(new PaddedPanel(imagePanel, 0, 0, 0, 5)); addButton(change); } + public void openWindow(final String url) { + WindowUtils.open(url); + } + public void setLicense(LicenseDTO defaultLicense) { licenseImage.setUrl(defaultLicense.getImageUrl()); KuneUiUtils.setQuickTip(licenseImage, defaultLicense.getLongName()); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/license/EntityOptionsDefLicensePresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/license/EntityOptionsDefLicensePresenter.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/license/EntityOptionsDefLicensePresenter.java 2008-12-18 18:31:33 UTC (rev 999) @@ -1,6 +1,7 @@ package org.ourproject.kune.workspace.client.options.license; import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.dto.LicenseDTO; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; import org.ourproject.kune.workspace.client.licensewizard.LicenseWizard; @@ -42,7 +43,15 @@ licenseWizard.get().show(); } + public void onLicenseClick() { + view.openWindow(getCurrentDefLicense().getUrl()); + } + + private LicenseDTO getCurrentDefLicense() { + return session.getCurrentState().getGroup().getDefaultLicense(); + } + private void setState() { - view.setLicense(session.getCurrentState().getGroup().getDefaultLicense()); + view.setLicense(getCurrentDefLicense()); } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/license/EntityOptionsDefLicenseView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/license/EntityOptionsDefLicenseView.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/license/EntityOptionsDefLicenseView.java 2008-12-18 18:31:33 UTC (rev 999) @@ -5,6 +5,8 @@ public interface EntityOptionsDefLicenseView extends View { + void openWindow(String url); + void setLicense(LicenseDTO defaultLicense); } Modified: trunk/src/test/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenterTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenterTest.java 2008-12-18 02:46:10 UTC (rev 998) +++ trunk/src/test/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenterTest.java 2008-12-18 18:31:33 UTC (rev 999) @@ -6,6 +6,7 @@ import org.ourproject.kune.platf.client.rpc.GroupServiceAsync; import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardFirstFormView; import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardSndFormView; +import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardTrdFormView; import com.calclab.suco.client.ioc.Provider; @@ -16,14 +17,16 @@ private LicenseWizardFirstFormView firstForm; private LicenseWizardSndFormView sndForm; private Provider<GroupServiceAsync> groupService; + private LicenseWizardTrdFormView trdForm; @Before public void before() { view = Mockito.mock(LicenseWizardView.class); firstForm = Mockito.mock(LicenseWizardFirstFormView.class); sndForm = Mockito.mock(LicenseWizardSndFormView.class); + trdForm = Mockito.mock(LicenseWizardTrdFormView.class); groupService = MockProvider.mock(GroupServiceAsync.class); - licenseWizard = new LicenseWizardPresenter(firstForm, sndForm, groupService); + licenseWizard = new LicenseWizardPresenter(firstForm, sndForm, trdForm, groupService); licenseWizard.init(view); } @@ -32,10 +35,10 @@ licenseWizard.onAnotherLicenseSelecterd(); Mockito.verify(view).setEnabled(false, true, true, false); licenseWizard.onNext(); - Mockito.verify(view).add(sndForm); + Mockito.verify(view).show(sndForm); Mockito.verify(view).setEnabled(true, false, true, true); licenseWizard.onBack(); - Mockito.verify(view).add(firstForm); + Mockito.verify(view).show(firstForm); Mockito.verify(view).setEnabled(false, true, true, true); } @@ -51,7 +54,7 @@ Mockito.verify(view).clear(); Mockito.verify(view).center(); Mockito.verify(view).setEnabled(false, false, true, true); - Mockito.verify(view).add(firstForm); + Mockito.verify(view).show(firstForm); Mockito.verify(firstForm).reset(); Mockito.verify(view).show(); }
participants (1)
-
vjrj