Author: vjrj Date: 2008-12-31 15:06:27 +0100 (Wed, 31 Dec 2008) New Revision: 1017 Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneWindowUtils.java Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/WindowUtils.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorToolbar.java trunk/src/main/java/org/ourproject/kune/workspace/client/editor/link.png trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardFlags.java trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntitySummary.java trunk/src/main/java/org/ourproject/kune/workspace/client/skel/SummaryPanel.java trunk/src/test/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenterTest.java Log: UI small-bugs new year mini-party ;) Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneWindowUtils.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneWindowUtils.java 2008-12-26 09:41:23 UTC (rev 1016) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneWindowUtils.java 2008-12-31 14:06:27 UTC (rev 1017) @@ -0,0 +1,17 @@ +package org.ourproject.kune.platf.client.ui; + +import com.google.gwt.user.client.Window; + +public class KuneWindowUtils { + public static int getClientHeight() { + return Window.getClientHeight(); + } + + public static int getClientWidth() { + return Window.getClientWidth(); + } + + public static void open(String url) { + Window.open(url, "_blank", ""); + } +} 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-26 09:41:23 UTC (rev 1016) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/WindowUtils.java 2008-12-31 14:06:27 UTC (rev 1017) @@ -12,11 +12,12 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */package org.ourproject.kune.platf.client.ui; + */ +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(); result.setHash(getHash()); @@ -30,40 +31,36 @@ return result; } - public static void open(String url) { - Window.open(url, "_blank", ""); - } - private static native String getHash() /*-{ - return $wnd.location.hash; - }-*/; + return $wnd.location.hash; + }-*/; private static native String getHost() /*-{ - return $wnd.location.host; - }-*/; + return $wnd.location.host; + }-*/; private static native String getHostName() /*-{ - return $wnd.location.hostname; - }-*/; + return $wnd.location.hostname; + }-*/; private static native String getHref() /*-{ - return $wnd.location.href; - }-*/; + return $wnd.location.href; + }-*/; private static native String getPath() /*-{ - return $wnd.location.pathname; - }-*/; + return $wnd.location.pathname; + }-*/; private static native String getPort() /*-{ - return $wnd.location.port; - }-*/; + return $wnd.location.port; + }-*/; private static native String getProtocol() /*-{ - return $wnd.location.protocol; - }-*/; + return $wnd.location.protocol; + }-*/; private static native String getQueryString() /*-{ - return $wnd.location.search; - }-*/; + return $wnd.location.search; + }-*/; } \ No newline at end of file Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java 2008-12-26 09:41:23 UTC (rev 1016) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java 2008-12-31 14:06:27 UTC (rev 1017) @@ -123,12 +123,12 @@ rateGrid.setCellPadding(0); rateGrid.setCellSpacing(0); rateGrid.setBorderWidth(0); - rateItLabel.addStyleName("kune-Margin-Medium-r"); + rateItLabel.addStyleName("kune-Margin-Small-r"); // rateItLabel.addStyleName("kune-Margin-Medium-l"); rateItLabel.addStyleName("kune-RatePanel-Label"); rateGrid.addStyleName("kune-RatePanel-Stars"); rateGrid.addStyleName("kune-RatePanel-Stars-RateIt"); rateDesc.addStyleName("kune-RatePanel-Label"); - rateDesc.addStyleName("kune-Margin-Medium-l"); + rateDesc.addStyleName("kune-Margin-Small-l"); } } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePanel.java 2008-12-26 09:41:23 UTC (rev 1016) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePanel.java 2008-12-31 14:06:27 UTC (rev 1017) @@ -90,7 +90,7 @@ rateGrid.setBorderWidth(0); rateGrid.addStyleName("kune-RatePanel-Stars"); rateDesc.addStyleName("kune-RatePanel-Label"); - rateDesc.addStyleName("kune-Margin-Medium-lr"); + rateDesc.addStyleName("kune-Margin-Small-lr"); } private void setRate(final Star stars[]) { Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java 2008-12-26 09:41:23 UTC (rev 1016) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java 2008-12-31 14:06:27 UTC (rev 1017) @@ -145,6 +145,7 @@ contentServiceProvider.get().getContent(session.getUserHash(), stateToken, new AsyncCallbackSimple<StateAbstractDTO>() { public void onSuccess(final StateAbstractDTO state) { + clear(); setState(state, false); } }); @@ -198,6 +199,9 @@ // Do the path to our current content createTreePath(stateToken, container.getAbsolutePath(), containerRights); + // Process container childs + createChildItems(container, containerRights); + // Process our current content/container final ActionItemCollection<StateToken> actionItems = new ActionItemCollection<StateToken>(); if (isContent) { @@ -219,8 +223,6 @@ } actionsByItem.put(stateToken, actionItems); - // Process container childs - createChildItems(container, containerRights); // Finaly if (mustEditOnNextStateChange()) { @@ -274,16 +276,15 @@ } private void createChildItems(final ContainerDTO container, final AccessRightsDTO containerRights) { - for (final ContentSimpleDTO content : container.getContents()) { - addItem(content.getTitle(), content.getTypeId(), content.getMimeType(), content.getStatus(), - content.getStateToken(), content.getStateToken().copy().clearDocument(), content.getRights(), false); - } - for (final ContainerSimpleDTO siblingFolder : container.getChilds()) { addItem(siblingFolder.getName(), siblingFolder.getTypeId(), null, ContentStatusDTO.publishedOnline, siblingFolder.getStateToken(), siblingFolder.getStateToken().copy().setFolder( siblingFolder.getParentFolderId()), containerRights, false); } + for (final ContentSimpleDTO content : container.getContents()) { + addItem(content.getTitle(), content.getTypeId(), content.getMimeType(), content.getStatus(), + content.getStateToken(), content.getStateToken().copy().clearDocument(), content.getRights(), false); + } } private void createTreePath(final StateToken state, final ContainerSimpleDTO[] absolutePath, Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java 2008-12-26 09:41:23 UTC (rev 1016) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java 2008-12-31 14:06:27 UTC (rev 1017) @@ -62,14 +62,14 @@ final I18nUITranslationService i18n, StateManager stateManager, SiteSignOutLink siteSignOutLink, DeferredCommandWrapper deferredCommandWrapper) { this.toolbar = toolbar; - autoSave = isAutoSave; + this.autoSave = isAutoSave; this.i18n = i18n; this.stateManager = stateManager; this.siteSignOutLink = siteSignOutLink; this.deferredCommandWrapper = deferredCommandWrapper; - savePending = false; - editingHtml = false; - saveAndCloseConfirmed = false; + this.savePending = false; + this.editingHtml = false; + this.saveAndCloseConfirmed = false; createActions(); beforeStateChangeListener = new BeforeActionListener() { Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorToolbar.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorToolbar.java 2008-12-26 09:41:23 UTC (rev 1016) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorToolbar.java 2008-12-31 14:06:27 UTC (rev 1017) @@ -154,83 +154,15 @@ if (sender == richText) { // We use the RichTextArea's onKeyUp event to update the // toolbar status. - // This will catch any cases where the user moves the cursur - // using the - // keyboard, or uses one of the browser's built-in keyboard - // shortcuts. + // This will catch any cases where the user moves the cursor + // using the keyboard, or uses one of the browser's built-in + // keyboard shortcuts. updateStatus(); fireEdit(); } } - // private Object[][] getData() { - // return new Object[][] { - // new Object[]{"Pirates of the Caribbean", new Integer(2120), new - // Long(1180231870000l), "images/view/carribean.jpg"}, - // new Object[]{"Resident Evil", new Integer(2120), new - // Long(1180231870000l), "images/view/resident_evil.jpg"}, - // new Object[]{"Blood Diamond", new Integer(2120), new - // Long(1180231870000l), "images/view/blood_diamond.jpg"}, - // new Object[]{"No Reservations", new Integer(2120), new - // Long(1180231870000l), "images/view/no_reservations.jpg"}, - // new Object[]{"Casino Royale", new Integer(2120), new - // Long(1180231870000l), "images/view/casino_royale.jpg"}, - // new Object[]{"Good Shepherd", new Integer(2120), new - // Long(1180231870000l), "images/view/good_shepherd.jpg"}, - // new Object[]{"Ghost Rider", new Integer(2120), new - // Long(1180231870000l), "images/view/ghost_rider.jpg"}, - // new Object[]{"Batman Begins", new Integer(2120), new - // Long(1180231870000l), "images/view/batman_begins.jpg"}, - // new Object[]{"Last Samurai", new Integer(2120), new - // Long(1180231870000l), "images/view/last_samurai.jpg"}, - // new Object[]{"Italian Job", new Integer(2120), new - // Long(1180231870000l), "images/view/italian_job.jpg"}, - // new Object[]{"Mission Impossible III", new Integer(2120), new - // Long(1180231870000l), "images/view/mi3.jpg"}, - // new Object[]{"Mr & Mrs Smith", new Integer(2120), new - // Long(1180231870000l), "images/view/smith.jpg"}, - // new Object[]{"Inside Man", new Integer(2120), new - // Long(1180231870000l), "images/view/inside_man.jpg"}, - // new Object[]{"The Island", new Integer(2120), new - // Long(1180231870000l), "images/view/island.jpg"} - // }; - // } - private void showImagePanel() { - // // i18n: - // final FileUploadFormSample fileUploadFormSample = new - // FileUploadFormSample(); - // final BasicDialog dialog = new - // BasicDialog(TEXT_EDITOR_TOOLBAR_INS_IMG, "Insert image", false, - // true, 400, - // 400); - // dialog.add(fileUploadFormSample); - // dialog.show(); - // - // if (ic == null) { - // final MemoryProxy dataProxy = new MemoryProxy(getData()); - // final RecordDef recordDef = new RecordDef(new FieldDef[] { new - // StringFieldDef("name"), - // new IntegerFieldDef("size"), new DateFieldDef("lastmod", - // "timestamp"), - // new StringFieldDef("url") }); - // final ArrayReader reader = new ArrayReader(recordDef); - // final Store store = new Store(dataProxy, reader, true); - // store.load(); - // - // ic = new ImageChooser("Image Chooser", 515, 400, store); - // } - // Site.important("This is in development and very experimental..."); - // ic.show(new ImageChooserCallback() { - // public void onImageSelection(final ImageData data) { - // // Element el = DomHelper.append("images", - // // Format.format("<img src='{0}' - // // style='margin:20px;visibility:hidden;'/>", - // // data.getUrl())); - // // ExtElement extEl = new ExtElement(el); - // // extEl.show(true).frame(); - // } - // }); MessageBox.prompt("Insert image", "Enter an image URL:", new PromptCallback() { public void execute(final String btnID, final String text) { if (btnID.equals("ok") && text != null) { @@ -315,8 +247,10 @@ } if (basic != null) { - topPanel.add(subscript = createToggleButton(images.subscript(), i18n.t("Toggle Subscript"))); - topPanel.add(superscript = createToggleButton(images.superscript(), i18n.t("Toggle Superscript"))); + subscript = createToggleButton(images.subscript(), i18n.t("Toggle Subscript")); + superscript = createToggleButton(images.superscript(), i18n.t("Toggle Superscript")); + // topPanel.add(subscript); + // topPanel.add(superscript); topPanel.add(justifyLeft = createPushButton(images.alignleft(), i18n.t("Left Justify"))); topPanel.add(justifyCenter = createPushButton(images.centerpara(), i18n.t("Center"))); topPanel.add(justifyRight = createPushButton(images.alignright(), i18n.t("Right Justify"))); @@ -325,13 +259,15 @@ if (extended != null) { topPanel.add(indent = createPushButton(images.incrementindent(), i18n.t("Indent Right"))); topPanel.add(outdent = createPushButton(images.decrementindent(), i18n.t("Indent Left"))); - topPanel.add(hr = createPushButton(images.hfixedline(), i18n.t("Insert Horizontal Rule"))); + hr = createPushButton(images.hfixedline(), i18n.t("Insert Horizontal Rule")); + // topPanel.add(hr); topPanel.add(ol = createPushButton(images.defaultnumbering(), i18n.t("Insert Ordered List"))); topPanel.add(ul = createPushButton(images.defaultbullet(), i18n.t("Insert Unordered List"))); topPanel.add(insertImage = createPushButton(images.images(), i18n.t("Insert Image"))); topPanel.add(createLink = createPushButton(images.link(), i18n.t("Create Link"))); topPanel.add(removeLink = createPushButton(images.linkBreak(), i18n.t("Remove Link"))); - topPanel.add(removeFormat = createPushButton(images.removeFormat(), i18n.t("Remove Formatting"))); + removeFormat = createPushButton(images.removeFormat(), i18n.t("Remove Formatting")); + // topPanel.add(removeFormat); } if (basic != null) { @@ -341,8 +277,7 @@ topPanel.add(fontSizes = createFontSizesMenu()); // We only use these listeners for updating status, so don't - // hook them up - // unless at least basic editing is supported. + // hook them up unless at least basic editing is supported. richText.addKeyboardListener(listener); richText.addClickListener(listener); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/link.png =================================================================== (Binary files differ) Modified: 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-26 09:41:23 UTC (rev 1016) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/pages/LicenseWizardFlags.java 2008-12-31 14:06:27 UTC (rev 1017) @@ -3,7 +3,7 @@ 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 org.ourproject.kune.platf.client.ui.KuneWindowUtils; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.Widget; @@ -61,7 +61,7 @@ } private void openWindow(String url) { - WindowUtils.open(url); + KuneWindowUtils.open(url); } }); label.setStyleNameToText("k-info-links"); 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-26 09:41:23 UTC (rev 1016) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java 2008-12-31 14:06:27 UTC (rev 1017) @@ -22,7 +22,7 @@ import org.ourproject.kune.platf.client.dto.LicenseDTO; import org.ourproject.kune.platf.client.services.Images; import org.ourproject.kune.platf.client.ui.KuneUiUtils; -import org.ourproject.kune.platf.client.ui.WindowUtils; +import org.ourproject.kune.platf.client.ui.KuneWindowUtils; import org.ourproject.kune.platf.client.ui.dialogs.BasicDialogExtended; import org.ourproject.kune.platf.client.ui.dialogs.DefaultFormUtils; import org.ourproject.kune.platf.client.ui.dialogs.MessageToolbar; @@ -247,7 +247,7 @@ licenseImage = new Image("images/lic/bysa80x15.png"); licenseImage.addClickListener(new ClickListener() { public void onClick(Widget arg0) { - WindowUtils.open(license.getUrl()); + KuneWindowUtils.open(license.getUrl()); } }); licenseImage.addStyleName("kune-pointer"); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntitySummary.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntitySummary.java 2008-12-26 09:41:23 UTC (rev 1016) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntitySummary.java 2008-12-31 14:06:27 UTC (rev 1017) @@ -18,6 +18,8 @@ * */package org.ourproject.kune.workspace.client.skel; +import org.ourproject.kune.workspace.client.site.Site; + import com.google.gwt.user.client.ui.Widget; import com.gwtext.client.widgets.Component; import com.gwtext.client.widgets.Panel; @@ -90,11 +92,6 @@ // Site.info("lalalal"); // } // }, "Bla, bla, bla")); - entitySummary.add(panel); - if (entitySummary.isRendered()) { - panel.doLayout(false); - entitySummary.doLayout(false); - } panel.addListener(new ContainerListenerAdapter() { @Override public void onHide(Component component) { @@ -110,16 +107,27 @@ private void openFirst() { if (accordionLayout.getActiveItem() != null && accordionLayout.getActiveItem().isHidden()) { - Panel firstComponent = null; for (Component compo : entitySummary.getComponents()) { - if (compo.isVisible() && firstComponent == null) { - firstComponent = (Panel) compo; - firstComponent.expand(true); + Panel panel = (Panel) compo; + if (panel.isVisible()) { + // First visible + if (panel.isCollapsed()) { + // And not expanded + panel.expand(false); + Site.info("expanding: " + panel.getTitle()); + } + // Don't continue + break; } } } } }); + entitySummary.add(panel); + if (entitySummary.isRendered()) { + panel.doLayout(false); + entitySummary.doLayout(false); + } doLayoutIfNeeded(); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/skel/SummaryPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/skel/SummaryPanel.java 2008-12-26 09:41:23 UTC (rev 1016) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/skel/SummaryPanel.java 2008-12-31 14:06:27 UTC (rev 1017) @@ -39,7 +39,7 @@ Images.App.getInstance().arrowRightWhite(), IconPosition.left); expandedTitle = KuneUiUtils.genQuickTipLabel(title, null, titleTooltip, Images.App.getInstance().arrowDownWhite(), IconPosition.left); - setTitle(collapsedTitle); + setTitle(expandedTitle); super.addListener(new PanelListenerAdapter() { @Override public void onCollapse(Panel panel) { 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-26 09:41:23 UTC (rev 1016) +++ trunk/src/test/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenterTest.java 2008-12-31 14:06:27 UTC (rev 1017) @@ -3,21 +3,18 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import org.ourproject.kune.platf.client.rpc.GroupServiceAsync; +import org.ourproject.kune.platf.client.state.Session; 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 com.calclab.suco.client.ioc.Provider; - public class LicenseWizardPresenterTest { private LicenseWizardView view; private LicenseWizardPresenter licenseWizard; private LicenseWizardFirstFormView firstForm; private LicenseWizardSndFormView sndForm; - private Provider<GroupServiceAsync> groupService; private LicenseWizardTrdFormView trdForm; private LicenseWizardFrdFormView frdForm; @@ -28,8 +25,8 @@ sndForm = Mockito.mock(LicenseWizardSndFormView.class); trdForm = Mockito.mock(LicenseWizardTrdFormView.class); frdForm = Mockito.mock(LicenseWizardFrdFormView.class); - groupService = MockProvider.mock(GroupServiceAsync.class); - licenseWizard = new LicenseWizardPresenter(firstForm, sndForm, trdForm, frdForm, null); + Session session = Mockito.mock(Session.class); + licenseWizard = new LicenseWizardPresenter(firstForm, sndForm, trdForm, frdForm, session); licenseWizard.init(view); } @@ -37,9 +34,11 @@ public void onAnotherSelected() { licenseWizard.onAnotherLicenseSelecterd(); Mockito.verify(view).setEnabled(false, true, true, false); + Mockito.stub(view.isCurrentPage(firstForm)).toReturn(true); licenseWizard.onNext(); Mockito.verify(view).show(sndForm); - Mockito.verify(view).setEnabled(true, false, true, true); + Mockito.verify(view).setEnabled(true, true, true, false); + Mockito.stub(view.isCurrentPage(sndForm)).toReturn(true); licenseWizard.onBack(); Mockito.verify(view).show(firstForm); Mockito.verify(view).setEnabled(false, true, true, true);