r850 - in trunk/src/main/java/org/ourproject/kune/workspace/client/ui: ctx ctx/nav newtmp newtmp/sitebar/sitelogo newtmp/sitebar/sitenewgroup newtmp/sitebar/siteoptions newtmp/sitebar/sitepublic newtmp/sitebar/sitesearch newtmp/sitebar/sitesign newtmp/sitebar/siteusermenu
Author: vjrj Date: 2008-09-08 02:56:46 +0200 (Mon, 08 Sep 2008) New Revision: 850 Added: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextNavigator.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextNavigatorItem.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextNavigatorPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextNavigatorPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextNavigatorView.java Removed: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextItems.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextItemsImages.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextItemsPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextItemsPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextItemsView.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextTopBar.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ControlsPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ItemsPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/bullet_arrow_right.png trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/chat-blue.png trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/chat-green.png trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/folder-go-up-light.png trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/folder-go-up.png trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/folder.png trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/folder_add.png trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/folderpathmenu.png trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/go-up-light.png trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/go-up.png trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/page.png trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/page_add.png trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/page_white.png trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/page_white_add.png trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/entitylogo/ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/licensefoot/ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/title/ Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitelogo/SiteLogoPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitenewgroup/SiteNewGroupLinkPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitepublic/SitePublicSpaceLinkPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesearch/SiteSearchPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignInLinkPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignOutLinkPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignOutLinkPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java Log: Refactorization Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav (from rev 841, trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextItems.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItems.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextItems.java 2008-09-08 00:56:46 UTC (rev 850) @@ -1,45 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 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.ui.ctx.items; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.dto.AccessRightsDTO; -import org.ourproject.kune.platf.client.dto.ContainerDTO; -import org.ourproject.kune.platf.client.dto.StateToken; - -import com.calclab.suco.client.signal.Slot; -import com.google.gwt.user.client.ui.AbstractImagePrototype; - -public interface ContextItems { - - public void canCreate(String buttonTitle, String promptMessage, Slot<String> slot); - - public View getView(); - - public void registerType(String typeName, AbstractImagePrototype pageWhite); - - public void setControlsVisible(boolean visible); - - public void setParentTreeVisible(boolean visible); - - public void showContainer(StateToken state, ContainerDTO container, AccessRightsDTO rights); - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextItemsImages.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsImages.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextItemsImages.java 2008-09-08 00:56:46 UTC (rev 850) @@ -1,87 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 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.ui.ctx.items; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.user.client.ui.AbstractImagePrototype; -import com.google.gwt.user.client.ui.ImageBundle; - -/** - * - * http://code.google.com/p/google-web-toolkit/wiki/ImageBundleDesign - * - */ -public interface ContextItemsImages extends ImageBundle { - - public static class App { - private static ContextItemsImages ourInstance = null; - - public static synchronized ContextItemsImages getInstance() { - if (ourInstance == null) { - ourInstance = (ContextItemsImages) GWT.create(ContextItemsImages.class); - } - return ourInstance; - } - } - - @Resource("bullet_arrow_right.png") - AbstractImagePrototype bulletArrowRight(); - - @Resource("chat-blue.png") - AbstractImagePrototype chatBlue(); - - @Resource("chat-green.png") - AbstractImagePrototype chatGreen(); - - @Resource("folder.png") - AbstractImagePrototype folder(); - - @Resource("folder_add.png") - AbstractImagePrototype folderAdd(); - - @Resource("folder-go-up.png") - AbstractImagePrototype folderGoUp(); - - @Resource("folder-go-up-light.png") - AbstractImagePrototype folderGoUpLight(); - - @Resource("folderpathmenu.png") - AbstractImagePrototype folderpathmenu(); - - @Resource("go-up.png") - AbstractImagePrototype goUp(); - - @Resource("go-up-light.png") - AbstractImagePrototype goUpLight(); - - @Resource("page.png") - AbstractImagePrototype page(); - - @Resource("page_add.png") - AbstractImagePrototype pageAdd(); - - @Resource("page_white.png") - AbstractImagePrototype pageWhite(); - - @Resource("page_white_add.png") - AbstractImagePrototype pageWhiteAdd(); - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextItemsPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPanel.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextItemsPanel.java 2008-09-08 00:56:46 UTC (rev 850) @@ -1,129 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 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.ui.ctx.items; - -import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO; -import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.platf.client.ui.HorizontalLine; -import org.ourproject.kune.platf.client.ui.IconLabel; - -import com.calclab.suco.client.signal.Slot; -import com.google.gwt.user.client.ui.AbstractImagePrototype; -import com.google.gwt.user.client.ui.ClickListener; -import com.google.gwt.user.client.ui.DockPanel; -import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; -import com.gwtext.client.widgets.MessageBox; - -public class ContextItemsPanel extends DockPanel implements ContextItemsView { - private final VerticalPanel controls; - private final ItemsPanel items; - private final ContextTopBar topBar; - private final I18nTranslationService i18n; - - public ContextItemsPanel(final ContextItemsPresenter presenter, final I18nTranslationService i18n, - final StateManager stateManager) { - this.i18n = i18n; - topBar = new ContextTopBar(presenter, i18n, stateManager); - addTopBar(topBar); - - items = new ItemsPanel(presenter); - add(items, DockPanel.NORTH); - final HTML expand = new HTML("<b></b>"); - add(expand, DockPanel.CENTER); - controls = new VerticalPanel(); - add(controls, DockPanel.SOUTH); - controls.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); - final HorizontalLine horizontalLine = new HorizontalLine(); - controls.add(horizontalLine); - - // setHeight("100%"); - expand.setHeight("15px"); - setCellHeight(expand, "15px"); - addStyleName("kune-NavigationBar"); - controls.setWidth("100%"); - controls.setCellWidth(horizontalLine, "100%"); - horizontalLine.setWidth("100%"); - } - - public void addCommand(final String buttonText, final String promptMessage, final Slot<String> slot) { - final IconLabel iconLabel = new IconLabel(Images.App.getInstance().addGreen(), buttonText); - iconLabel.addClickListener(new ClickListener() { - public void onClick(final Widget sender) { - promptName(promptMessage, slot); - } - }); - iconLabel.addStyleName("kune-ContextItemsPanel-LabelLink"); - controls.add(iconLabel); - - } - - public void addItem(final String name, final String type, final String event, final boolean editable) { - items.add(name, type, event, editable); - } - - public void clear() { - items.clear(); - } - - public void promptName(final String title, final Slot<String> slot) { - MessageBox.prompt(title, i18n.t("Please enter a name:"), new MessageBox.PromptCallback() { - public void execute(final String btnID, final String text) { - slot.onEvent(text); - } - }); - } - - public void registerType(final String typeName, final AbstractImagePrototype image) { - items.registerType(typeName, image); - } - - public void selectItem(final int index) { - } - - public void setAbsolutePath(final ContainerSimpleDTO[] absolutePath) { - topBar.setAbsolutePath(absolutePath); - } - - public void setControlsVisible(final boolean visible) { - controls.setVisible(visible); - } - - public void setCurrentName(final String name) { - topBar.currentFolder.setText(name); - } - - public void setParentButtonEnabled(final boolean isEnabled) { - topBar.btnGoParent.setVisible(isEnabled); - topBar.btnGoParentDisabled.setVisible(!isEnabled); - } - - public void setParentTreeVisible(final boolean visible) { - topBar.firstRow.setVisible(visible); - } - - private void addTopBar(final Widget widget) { - add(topBar, DockPanel.NORTH); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextItemsPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPresenter.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextItemsPresenter.java 2008-09-08 00:56:46 UTC (rev 850) @@ -1,129 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 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.ui.ctx.items; - -import java.util.List; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.dto.AccessRightsDTO; -import org.ourproject.kune.platf.client.dto.ContainerDTO; -import org.ourproject.kune.platf.client.dto.ContentDTO; -import org.ourproject.kune.platf.client.dto.StateDTO; -import org.ourproject.kune.platf.client.dto.StateToken; -import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; -import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; -import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.state.Session; -import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.sitebar.Site; - -import com.calclab.suco.client.container.Provider; -import com.calclab.suco.client.signal.Slot; -import com.google.gwt.user.client.ui.AbstractImagePrototype; - -public class ContextItemsPresenter implements ContextItems { - protected ContextItemsView view; - private final I18nTranslationService i18n; - private final StateManager stateManager; - private final Session session; - private final Provider<ContentServiceAsync> contentServiceProvider; - - public ContextItemsPresenter(final I18nTranslationService i18n, final StateManager stateManager, - final Session session, final Provider<ContentServiceAsync> contentServiceProvider) { - this.i18n = i18n; - this.stateManager = stateManager; - this.session = session; - this.contentServiceProvider = contentServiceProvider; - } - - public void canCreate(final String buttonText, final String promptMessage, final Slot<String> slot) { - view.addCommand(buttonText, promptMessage, slot); - } - - public View getView() { - return view; - } - - public void init(final ContextItemsView view) { - this.view = view; - } - - public void onGoUp() { - final StateDTO state = session.getCurrentState(); - final StateToken token = state.getStateToken(); - token.setDocument(null); - token.setFolder(state.getFolder().getParentFolderId().toString()); - stateManager.setState(token); - } - - public void onTitleRename(final String newName, final String token) { - Site.showProgressSaving(); - final StateDTO currentState = session.getCurrentState(); - contentServiceProvider.get().rename(session.getUserHash(), currentState.getGroup().getShortName(), token, - newName, new AsyncCallbackSimple<String>() { - public void onSuccess(final String result) { - stateManager.reloadContextAndTitles(); - Site.hideProgress(); - } - }); - } - - public void registerType(final String typeName, final AbstractImagePrototype image) { - view.registerType(typeName, image); - } - - public void setControlsVisible(final boolean visible) { - view.setControlsVisible(visible); - } - - public void setParentTreeVisible(final boolean visible) { - view.setParentTreeVisible(visible); - } - - public void showContainer(final StateToken state, final ContainerDTO container, final AccessRightsDTO rights) { - state.setDocument(null); - if (container.getParentFolderId() == null) { - // We translate root folder names (documents, chat room, - // etcetera) - view.setCurrentName(i18n.t(container.getName())); - } else { - view.setCurrentName(container.getName()); - } - view.clear(); - final List<ContainerDTO> folders = container.getChilds(); - for (int index = 0; index < folders.size(); index++) { - final ContainerDTO child = folders.get(index); - state.setFolder(child.getId().toString()); - view.addItem(child.getName(), child.getTypeId(), state.getEncoded(), rights.isEditable()); - } - - state.setFolder(container.getId().toString()); - final List<ContentDTO> contents = container.getContents(); - for (int index = 0; index < contents.size(); index++) { - final ContentDTO dto = contents.get(index); - state.setDocument(dto.getId().toString()); - view.addItem(dto.getTitle(), dto.getTypeId(), state.getEncoded(), rights.isEditable()); - } - view.setParentButtonEnabled(container.getParentFolderId() != null); - view.setControlsVisible(rights.isEditable()); - view.setAbsolutePath(container.getAbsolutePath()); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextItemsView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsView.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextItemsView.java 2008-09-08 00:56:46 UTC (rev 850) @@ -1,51 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 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.ui.ctx.items; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO; - -import com.calclab.suco.client.signal.Slot; -import com.google.gwt.user.client.ui.AbstractImagePrototype; - -public interface ContextItemsView extends View { - - void addCommand(String buttonTitle, String promptMessage, Slot<String> slot); - - void addItem(String name, String type, String event, boolean editable); - - void clear(); - - void registerType(String typeName, AbstractImagePrototype image); - - void selectItem(int index); - - void setAbsolutePath(ContainerSimpleDTO[] absolutePath); - - void setControlsVisible(boolean isVisible); - - void setCurrentName(String name); - - void setParentButtonEnabled(boolean isEnabled); - - void setParentTreeVisible(boolean b); - -} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextNavigator.java (from rev 845, trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigator.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigator.java 2008-09-08 00:11:31 UTC (rev 845) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextNavigator.java 2008-09-08 00:56:46 UTC (rev 850) @@ -0,0 +1,46 @@ +/* + * + * Copyright (C) 2007-2008 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.ui.ctx.nav; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.actions.ActionDescriptor; +import org.ourproject.kune.platf.client.dto.StateDTO; +import org.ourproject.kune.platf.client.dto.StateToken; + +public interface ContextNavigator { + + void addAction(String contentTypeId, ActionDescriptor<StateToken> action); + + void editItem(StateToken stateToken); + + View getView(); + + void registerDraggableType(String typeId); + + void registerDroppableType(String typeId); + + void removeAction(String contentTypeId, ActionDescriptor<StateToken> action); + + void selectItem(StateToken stateToken); + + void setState(StateDTO state); + +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextNavigatorItem.java (from rev 845, trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorItem.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorItem.java 2008-09-08 00:11:31 UTC (rev 845) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextNavigatorItem.java 2008-09-08 00:56:46 UTC (rev 850) @@ -0,0 +1,68 @@ +package org.ourproject.kune.workspace.client.ui.ctx.nav; + +import org.ourproject.kune.platf.client.actions.ActionCollection; +import org.ourproject.kune.platf.client.dto.ContentStatusDTO; +import org.ourproject.kune.platf.client.dto.StateToken; + +public class ContextNavigatorItem { + private final String id; + private final String parentId; + private final String iconUrl; + private final String text; + private final ContentStatusDTO contentStatusDTO; + private final StateToken token; + private final ActionCollection<StateToken> actionCollection; + private final boolean allowDrag; + private final boolean allowDrop; + + public ContextNavigatorItem(final String id, final String parentId, final String iconUrl, final String text, + final ContentStatusDTO contentStatusDTO, final StateToken token, final boolean allowDrag, + final boolean allowDrop, final ActionCollection<StateToken> actionCollection) { + this.id = id; + this.parentId = parentId; + this.iconUrl = iconUrl; + this.text = text; + this.contentStatusDTO = contentStatusDTO; + this.token = token; + this.allowDrag = allowDrag; + this.allowDrop = allowDrop; + this.actionCollection = actionCollection; + } + + public ActionCollection<StateToken> getActionCollection() { + return actionCollection; + } + + public ContentStatusDTO getContentStatus() { + return contentStatusDTO; + } + + public String getIconUrl() { + return iconUrl; + } + + public String getId() { + return id; + } + + public String getParentId() { + return parentId; + } + + public StateToken getStateToken() { + return token; + } + + public String getText() { + return text; + } + + public boolean isDraggable() { + return allowDrag; + } + + public boolean isDroppable() { + return allowDrop; + } + +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextNavigatorPanel.java (from rev 845, trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorPanel.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorPanel.java 2008-09-08 00:11:31 UTC (rev 845) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextNavigatorPanel.java 2008-09-08 00:56:46 UTC (rev 850) @@ -0,0 +1,325 @@ +/* + * + * Copyright (C) 2007-2008 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.ui.ctx.nav; + +import java.util.HashMap; + +import org.ourproject.kune.platf.client.actions.ActionCollection; +import org.ourproject.kune.platf.client.actions.ActionDescriptor; +import org.ourproject.kune.platf.client.actions.ActionManager; +import org.ourproject.kune.platf.client.dto.StateToken; +import org.ourproject.kune.platf.client.services.I18nTranslationService; +import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.workspace.client.skel.Toolbar; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; + +import com.allen_sauer.gwt.log.client.Log; +import com.calclab.suco.client.provider.Provider; +import com.google.gwt.user.client.Command; +import com.google.gwt.user.client.DeferredCommand; +import com.gwtext.client.core.EventObject; +import com.gwtext.client.data.Node; +import com.gwtext.client.widgets.Button; +import com.gwtext.client.widgets.Editor; +import com.gwtext.client.widgets.Panel; +import com.gwtext.client.widgets.ToolbarButton; +import com.gwtext.client.widgets.event.ButtonListenerAdapter; +import com.gwtext.client.widgets.event.EditorListenerAdapter; +import com.gwtext.client.widgets.form.TextField; +import com.gwtext.client.widgets.menu.BaseItem; +import com.gwtext.client.widgets.menu.Item; +import com.gwtext.client.widgets.menu.Menu; +import com.gwtext.client.widgets.menu.MenuItem; +import com.gwtext.client.widgets.menu.event.BaseItemListenerAdapter; +import com.gwtext.client.widgets.tree.TreeEditor; +import com.gwtext.client.widgets.tree.TreeNode; +import com.gwtext.client.widgets.tree.TreePanel; +import com.gwtext.client.widgets.tree.event.TreeNodeListenerAdapter; +import com.gwtext.client.widgets.tree.event.TreePanelListenerAdapter; + +public class ContextNavigatorPanel implements ContextNavigatorView { + + private TreePanel treePanel; + private TreeEditor treeEditor; + private final HashMap<String, Menu> contextMenus; + private final HashMap<String, Menu> toolbarMenus; + private final WorkspaceSkeleton ws; + private final Provider<ActionManager> actionManagerProvider; + private final StateManager stateManager; + + public ContextNavigatorPanel(final ContextNavigatorPresenter presenter, final I18nTranslationService i18n, + final StateManager stateManager, final WorkspaceSkeleton ws, + final Provider<ActionManager> actionManagerProvider) { + this.stateManager = stateManager; + this.ws = ws; + this.actionManagerProvider = actionManagerProvider; + + contextMenus = new HashMap<String, Menu>(); + toolbarMenus = new HashMap<String, Menu>(); + } + + public void addItem(final ContextNavigatorItem item) { + final String nodeId = item.getId(); + if (treePanel.getNodeById(nodeId) == null) { + final TreeNode child = new TreeNode(item.getText()); + child.setId(nodeId); + final String icon = item.getIconUrl(); + if (icon != null) { + child.setIcon(icon); + } + child.setHref("#" + item.getStateToken().toString()); + child.setAllowDrag(item.isDraggable()); + child.setAllowDrop(item.isDroppable()); + switch (item.getContentStatus()) { + case publicVisible: + child.enable(); + break; + case markForDelection: + child.setCls("k-linethrough"); + case nonPublicVisible: + child.disable(); + break; + } + contextMenus.put(nodeId, createItemMenu(item.getActionCollection(), item.getStateToken())); + final TreeNode parent = treePanel.getNodeById(item.getParentId()); + if (parent != null) { + Log.info("Adding child node: " + nodeId + " to folder: " + item.getParentId()); + if (!item.getStateToken().hasAll()) { + child.setExpandable(true); + child.addListener(new TreeNodeListenerAdapter() { + public void onExpand(final Node node) { + treePanel.getNodeById(node.getId()).select(); + stateManager.gotoToken(node.getAttribute("href").substring(1)); + } + }); + } else { + child.setLeaf(true); + } + parent.appendChild(child); + } else { + Log.error("Error building file tree, parent folder not found"); + } + } else { + // the node already created + if (contextMenus.get(nodeId) == null && item.getActionCollection() != null) { + contextMenus.put(nodeId, createItemMenu(item.getActionCollection(), item.getStateToken())); + } + } + + } + + public void clear() { + if (treePanel != null) { + treePanel.clear(); + } + contextMenus.clear(); + toolbarMenus.clear(); + } + + public void editItem(final String id) { + treeEditor.startEdit(getNode(id)); + } + + public void selectItem(final String id) { + final TreeNode item = getNode(id); + if (item != null) { + item.select(); + item.ensureVisible(); + if (item.getChildNodes().length > 0) { + item.expand(); + } + } else { + Log.error("Error building file tree, current token not found"); + } + } + + public void setBottomActions(final StateToken stateToken, final ActionCollection<StateToken> actions) { + final Toolbar toolBar = ws.getEntityWorkspace().getContextBottomBar(); + setToolbarActions(toolBar, stateToken, actions); + } + + public void setRootItem(final String id, final String text, final StateToken stateToken) { + if (treePanel == null || treePanel.getNodeById(id) == null) { + createTreePanel(id); + } + } + + public void setTopActions(final StateToken stateToken, final ActionCollection<StateToken> actions) { + final Toolbar toolBar = ws.getEntityWorkspace().getContextTopBar(); + setToolbarActions(toolBar, stateToken, actions); + } + + private Menu createItemMenu(final ActionCollection<StateToken> actionCollection, final StateToken stateToken) { + if (actionCollection != null) { + final Menu menu = new Menu(); + // Remove if when retrieved rights of siblings + for (final ActionDescriptor<StateToken> action : actionCollection) { + final Item item = new Item(action.getText()); + item.setIcon(action.getIconUrl()); + menu.addItem(item); + item.addListener(new BaseItemListenerAdapter() { + public void onClick(final BaseItem item, final EventObject e) { + DeferredCommand.addCommand(new Command() { + public void execute() { + actionManagerProvider.get().doAction(action, stateToken); + } + }); + } + }); + } + return menu; + } + return null; + } + + private Menu createToolbarMenu(final Toolbar bar, final String iconUrl, final String menuTitle) { + final Menu menu = new Menu(); + final ToolbarButton toolbarMenu = new ToolbarButton(menuTitle); + if (iconUrl != null) { + toolbarMenu.setIcon(iconUrl); + } + toolbarMenu.addListener(new ButtonListenerAdapter() { + @Override + public void onClick(final Button button, final EventObject e) { + menu.showAt(e.getXY()); + } + }); + toolbarMenus.put(menuTitle, menu); + bar.add(toolbarMenu); + return menu; + } + + private void createTreePanel(final String rootId) { + if (treePanel != null) { + clear(); + } + treePanel = new TreePanel(); + treePanel.setAnimate(true); + treePanel.setBorder(false); + treePanel.setRootVisible(false); + treePanel.setUseArrows(true); + final TreeNode root = new TreeNode(); + root.setAllowDrag(false); + root.setExpanded(true); + root.setId(rootId); + root.expand(); + treePanel.addListener(new TreePanelListenerAdapter() { + public void onContextMenu(final TreeNode node, final EventObject e) { + final Menu menu = contextMenus.get(node.getId()); + if (menu != null) { + menu.showAt(e.getXY()); + } else { + Log.info("Empty item menu"); + } + } + }); + treePanel.setLines(false); + treePanel.setEnableDD(true); + treePanel.setRootNode(root); + final TextField field = new TextField(); + treeEditor = new TreeEditor(treePanel, field); + treeEditor.addListener(new EditorListenerAdapter() { + // public boolean doBeforeComplete(final Editor source, final Object + // value, final Object startValue) { + // return false; + // } + + public void onComplete(final Editor source, final Object value, final Object startValue) { + // TODO Auto-generated method stub + } + }); + final Panel panel = new Panel(); + panel.setBorder(false); + panel.add(treePanel); + ws.getEntityWorkspace().setContext(panel); + } + + private void doAction(final ActionDescriptor<StateToken> action, final StateToken stateToken) { + actionManagerProvider.get().doAction(action, stateToken); + } + + private TreeNode getNode(final String id) { + final TreeNode node = treePanel.getNodeById(id); + if (node == null) { + Log.error("Id: " + id + " not found in context navigator"); + } + return node; + } + + private void setToolbarActions(final Toolbar toolBar, final StateToken stateToken, + final ActionCollection<StateToken> actions) { + toolBar.removeAll(); + for (final ActionDescriptor<StateToken> action : actions) { + Log.info("Procesing action: " + action.getText()); + if (!action.isMenuAction()) { + final ToolbarButton button = new ToolbarButton(); + final String text = action.getText(); + if (text != null) { + button.setText(text); + } + button.addListener(new ButtonListenerAdapter() { + @Override + public void onClick(final Button button, final EventObject e) { + doAction(action, stateToken); + } + }); + button.setIcon(action.getIconUrl()); + button.setTooltip(action.getToolTip()); + toolBar.add(button); + } else { + // Menu action + final Item item = new Item(action.getText(), new BaseItemListenerAdapter() { + @Override + public void onClick(BaseItem item, EventObject e) { + doAction(action, stateToken); + } + }); + item.setIcon(action.getIconUrl()); + + final String menuTitle = action.getParentMenuTitle(); + final String menuSubTitle = action.getParentSubMenuTitle(); + final String subMenuKey = menuTitle + "-" + menuSubTitle; + Menu menu = toolbarMenus.get(menuTitle); + Menu subMenu = toolbarMenus.get(subMenuKey); + if (menuSubTitle != null) { + if (subMenu == null) { + subMenu = new Menu(); + final MenuItem subMenuItem = new MenuItem(menuSubTitle, subMenu); + if (menu == null) { + menu = createToolbarMenu(toolBar, action.getParentMenuIconUrl(), menuTitle); + } + menu.addItem(subMenuItem); + toolBar.doLayoutIfNeeded(); + toolbarMenus.put(subMenuKey, subMenu); + } + subMenu.addItem(item); + } else { + // Menu action without submenu + if (menu == null) { + menu = createToolbarMenu(toolBar, action.getParentMenuIconUrl(), menuTitle); + } + menu.addItem(item); + toolBar.doLayoutIfNeeded(); + } + } + } + } +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextNavigatorPresenter.java (from rev 845, trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorPresenter.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorPresenter.java 2008-09-08 00:11:31 UTC (rev 845) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextNavigatorPresenter.java 2008-09-08 00:56:46 UTC (rev 850) @@ -0,0 +1,274 @@ +/* + * + * Copyright (C) 2007-2008 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.ui.ctx.nav; + +import java.util.ArrayList; +import java.util.HashMap; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.actions.ActionCollection; +import org.ourproject.kune.platf.client.actions.ActionDescriptor; +import org.ourproject.kune.platf.client.dto.AccessRightsDTO; +import org.ourproject.kune.platf.client.dto.ContainerDTO; +import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO; +import org.ourproject.kune.platf.client.dto.ContentDTO; +import org.ourproject.kune.platf.client.dto.ContentStatusDTO; +import org.ourproject.kune.platf.client.dto.StateDTO; +import org.ourproject.kune.platf.client.dto.StateToken; +import org.ourproject.kune.platf.client.dto.UserInfoDTO; +import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; +import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; +import org.ourproject.kune.platf.client.state.Session; +import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; +import org.ourproject.kune.workspace.client.site.Site; + +import com.calclab.suco.client.provider.Provider; +import com.calclab.suco.client.signal.Slot; +import com.calclab.suco.client.signal.Slot0; +import com.calclab.suco.client.signal.Slot2; + +public class ContextNavigatorPresenter implements ContextNavigator { + + private ContextNavigatorView view; + private final StateManager stateManager; + private final Session session; + private final Provider<ContentServiceAsync> contentServiceProvider; + private final I18nUITranslationService i18n; + private final HashMap<String, ActionCollection<StateToken>> actions; + private final ArrayList<String> draggables; + private final ArrayList<String> droppables; + + public ContextNavigatorPresenter(final StateManager stateManager, final Session session, + final Provider<ContentServiceAsync> contentServiceProvider, final I18nUITranslationService i18n) { + this.stateManager = stateManager; + this.session = session; + this.contentServiceProvider = contentServiceProvider; + this.i18n = i18n; + actions = new HashMap<String, ActionCollection<StateToken>>(); + draggables = new ArrayList<String>(); + droppables = new ArrayList<String>(); + } + + public void addAction(final String contentTypeId, final ActionDescriptor<StateToken> action) { + ActionCollection<StateToken> actionColl = actions.get(contentTypeId); + if (actionColl == null) { + actionColl = new ActionCollection<StateToken>(); + actions.put(contentTypeId, actionColl); + } + actionColl.add(action); + } + + public void editItem(final StateToken stateToken) { + view.editItem(genId(stateToken)); + } + + public View getView() { + return view; + } + + public void init(final ContextNavigatorView view) { + this.view = view; + stateManager.onGroupChanged(new Slot2<String, String>() { + public void onEvent(final String oldGroup, final String newGroup) { + if (oldGroup != null) { + view.clear(); + } + } + }); + stateManager.onToolChanged(new Slot2<String, String>() { + public void onEvent(final String oldTool, final String newTool) { + if (oldTool != null) { + view.clear(); + } + } + }); + session.onUserSignIn(new Slot<UserInfoDTO>() { + public void onEvent(final UserInfoDTO parameter) { + view.clear(); + } + }); + session.onUserSignOut(new Slot0() { + public void onEvent() { + view.clear(); + } + }); + } + + public void onTitleRename(final String newName, final String token) { + Site.showProgressSaving(); + final StateDTO currentState = session.getCurrentState(); + contentServiceProvider.get().rename(session.getUserHash(), currentState.getGroup().getShortName(), token, + newName, new AsyncCallbackSimple<String>() { + public void onSuccess(final String result) { + stateManager.reloadContextAndTitles(); + Site.hideProgress(); + } + }); + } + + public void registerDraggableType(final String type) { + draggables.add(type); + } + + public void registerDroppableType(final String type) { + droppables.add(type); + } + + public void removeAction(final String contentTypeId, final ActionDescriptor<StateToken> action) { + actions.get(contentTypeId).remove(action); + } + + public void selectItem(final StateToken stateToken) { + view.selectItem(genId(stateToken)); + } + + public void setState(final StateDTO state) { + final StateToken stateToken = state.getStateToken().clone(); + final String treeId = genId(stateToken); + + final ContainerDTO container = state.getFolder(); + createTreePath(stateToken, container.getAbsolutePath()); + + boolean visible = false; + AccessRightsDTO rights = null; + + String containerTreeId; + + if (state.hasDocument()) { + rights = state.getContentRights(); + visible = rights.isVisible(); + containerTreeId = genId(stateToken.clone().setDocument(null)); + } else { + rights = state.getFolderRights(); + visible = rights.isVisible(); + final Long folderId = container.getParentFolderId(); + containerTreeId = genId(stateToken.clone().setDocument(null).setFolder( + folderId == null ? null : folderId.toString())); + } + + // here check deletion mark + + final ActionCollection<StateToken> topActions = new ActionCollection<StateToken>(); + final ActionCollection<StateToken> itemActions = new ActionCollection<StateToken>(); + final ActionCollection<StateToken> bottomActions = new ActionCollection<StateToken>(); + + boolean add = false; + for (final ActionDescriptor<StateToken> action : actions.get(state.getTypeId())) { + switch (action.getAccessRol()) { + case Administrator: + add = rights.isAdministrable(); + break; + case Editor: + add = rights.isEditable(); + break; + case Viewer: + add = rights.isVisible(); + break; + } + if (add) { + switch (action.getActionPosition()) { + case topbarAndItemMenu: + itemActions.add(action); + case topbar: + topActions.add(action); + break; + case bootombarAndItemMenu: + itemActions.add(action); + case bottombar: + bottomActions.add(action); + break; + case itemMenu: + itemActions.add(action); + break; + } + } + } + + view.setTopActions(stateToken, topActions); + view.setBottomActions(stateToken, bottomActions); + + final ContextNavigatorItem item = new ContextNavigatorItem(treeId, containerTreeId, "images/nav/page.png", + state.getTitle(), visible ? ContentStatusDTO.publicVisible : ContentStatusDTO.nonPublicVisible, + stateToken, isDraggable(state.getTypeId(), rights.isAdministrable()), isDroppable(state.getTypeId(), + rights.isAdministrable()), itemActions); + view.addItem(item); + + for (final ContentDTO content : container.getContents()) { + final StateToken siblingToken = stateToken.clone().setDocument(content.getId().toString()); + final StateToken siblingParentToken = stateToken.clone().setDocument(null); + // TODO: rights not correct + final ContextNavigatorItem sibling = new ContextNavigatorItem(genId(siblingToken), + genId(siblingParentToken), "images/nav/page.png", content.getTitle(), + ContentStatusDTO.publicVisible, siblingToken, isDraggable(content.getTypeId(), rights + .isAdministrable()), isDroppable(content.getTypeId(), rights.isAdministrable()), null); + view.addItem(sibling); + + } + + for (final ContainerDTO siblingFolder : container.getChilds()) { + final StateToken siblingToken = stateToken.clone().setDocument(null).setFolder( + siblingFolder.getId().toString()); + final StateToken siblingParentToken = stateToken.clone().setDocument(null).setFolder( + siblingFolder.getParentFolderId().toString()); + // TODO: rights not correct + final ContextNavigatorItem sibling = new ContextNavigatorItem(genId(siblingToken), + genId(siblingParentToken), "", siblingFolder.getName(), ContentStatusDTO.publicVisible, + siblingToken, isDraggable(container.getTypeId(), rights.isAdministrable()), isDroppable(container + .getTypeId(), rights.isAdministrable()), null); + view.addItem(sibling); + } + view.selectItem(treeId); + } + + private void createTreePath(final StateToken state, final ContainerSimpleDTO[] absolutePath) { + for (int i = 0; i < absolutePath.length; i++) { + final ContainerSimpleDTO folder = absolutePath[i]; + final String parentFolderId = folder.getParentFolderId() == null ? null : folder.getParentFolderId() + .toString(); + final StateToken folderStateToken = state.clone().setDocument(null).setFolder(folder.getId().toString()); + final StateToken parentStateToken = state.clone().setDocument(null).setFolder(parentFolderId); + if (folder.getParentFolderId() != null) { + // Bad rights, draggable/droppable + final ContextNavigatorItem parent = new ContextNavigatorItem(genId(folderStateToken), + genId(parentStateToken), "", folder.getName(), ContentStatusDTO.publicVisible, + folderStateToken, false, true, null); + view.addItem(parent); + } else { + // create root folder + view.setRootItem(genId(folderStateToken), i18n.t("contents"), folderStateToken); + } + } + } + + private String genId(final StateToken token) { + return "k-" + token.toString().replace(StateToken.SEPARATOR, "-"); + } + + private boolean isDraggable(final String typeId, final boolean administrable) { + return administrable && draggables.contains(typeId); + } + + private boolean isDroppable(final String typeId, final boolean administrable) { + return administrable && droppables.contains(typeId); + } + +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextNavigatorView.java (from rev 845, trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorView.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorView.java 2008-09-08 00:11:31 UTC (rev 845) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextNavigatorView.java 2008-09-08 00:56:46 UTC (rev 850) @@ -0,0 +1,43 @@ +/* + * + * Copyright (C) 2007-2008 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.ui.ctx.nav; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.actions.ActionCollection; +import org.ourproject.kune.platf.client.dto.StateToken; + +public interface ContextNavigatorView extends View { + + void addItem(ContextNavigatorItem contextNavigatorItem); + + void clear(); + + void editItem(String id); + + void selectItem(String id); + + void setBottomActions(StateToken stateToken, ActionCollection<StateToken> actions); + + void setRootItem(String id, String text, StateToken stateToken); + + void setTopActions(StateToken stateToken, ActionCollection<StateToken> actions); + +} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextTopBar.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextTopBar.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ContextTopBar.java 2008-09-08 00:56:46 UTC (rev 850) @@ -1,123 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 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.ui.ctx.items; - -import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO; -import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.platf.client.ui.KuneUiUtils; -import org.ourproject.kune.platf.client.ui.RoundedBorderDecorator; - -import com.google.gwt.user.client.Command; -import com.google.gwt.user.client.ui.ClickListener; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.Image; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.MenuBar; -import com.google.gwt.user.client.ui.PushButton; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; - -class ContextTopBar extends VerticalPanel { - - public final Label currentFolder; - public final PushButton btnGoParent; - public final Image btnGoParentDisabled; - public final HorizontalPanel firstRow; - private final ContextItemsImages img; - private final MenuBar pathSubmenu; - private final I18nTranslationService i18n; - private final StateManager stateManager; - - public ContextTopBar(final ContextItemsPresenter presenter, final I18nTranslationService i18n, - final StateManager stateManager) { - this.i18n = i18n; - this.stateManager = stateManager; - img = ContextItemsImages.App.getInstance(); - firstRow = new HorizontalPanel(); - final HorizontalPanel secondRow = new HorizontalPanel(); - final HorizontalPanel iconBarHP = new HorizontalPanel(); - final HorizontalPanel currentFolderHP = new HorizontalPanel(); - btnGoParent = new PushButton(img.folderGoUp().createImage(), img.folderGoUpLight().createImage()); - btnGoParent.addClickListener(new ClickListener() { - public void onClick(final Widget sender) { - presenter.onGoUp(); - } - }); - - KuneUiUtils.setQuickTip(btnGoParent, i18n.t("Go to parent folder")); - btnGoParentDisabled = img.folderGoUpLight().createImage(); - final MenuBar pathMenu = new MenuBar(); - pathSubmenu = new MenuBar(true); - // Layout - add(firstRow); - add(secondRow); - firstRow.add(iconBarHP); - secondRow.add(currentFolderHP); - // iconBarHP.add(btnGoParent); - final RoundedBorderDecorator buttonRounded = new RoundedBorderDecorator(pathMenu, RoundedBorderDecorator.ALL, - RoundedBorderDecorator.SIMPLE); - iconBarHP.add(buttonRounded); - pathMenu.addItem(img.folderpathmenu().getHTML(), true, pathSubmenu); - KuneUiUtils.setQuickTip(pathMenu, i18n.t("Navigation tree")); - currentFolderHP.add(btnGoParent); - currentFolderHP.add(btnGoParentDisabled); - currentFolder = new Label("Current Container"); - currentFolderHP.add(currentFolder); - - // Set properties - addStyleName("kune-NavigationBar"); - firstRow.addStyleName("topBar"); - firstRow.addStyleName("topBar-margin"); - secondRow.addStyleName("topBar"); - firstRow.setWidth("100%"); - secondRow.setWidth("100%"); - setCellWidth(firstRow, "100%"); - setCellWidth(secondRow, "100%"); - firstRow.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); - iconBarHP.addStyleName("kune-topBar-iconBar"); - iconBarHP.setCellVerticalAlignment(btnGoParent, VerticalPanel.ALIGN_MIDDLE); - iconBarHP.setCellVerticalAlignment(buttonRounded, VerticalPanel.ALIGN_MIDDLE); - pathMenu.setStyleName("pathMenu"); - buttonRounded.setColor("AAA"); - btnGoParent.addStyleName("kune-pointer"); - } - - public void setAbsolutePath(final ContainerSimpleDTO[] absolutePath) { - pathSubmenu.clearItems(); - String indent = ""; - for (int i = 0; i < absolutePath.length; i++) { - final ContainerSimpleDTO folder = absolutePath[i]; - String folderName = folder.getName(); - if (i == 0) { - // We translate root folders - folderName = i18n.t(folderName); - } - pathSubmenu.addItem(indent + img.folder().getHTML() + " " + folderName, true, new Command() { - public void execute() { - stateManager.gotoContainer(folder.getId()); - } - }); - indent = indent + "  "; - } - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ControlsPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ControlsPanel.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ControlsPanel.java 2008-09-08 00:56:46 UTC (rev 850) @@ -1,29 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 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.ui.ctx.items; - -import com.google.gwt.user.client.ui.VerticalPanel; - -class ControlsPanel extends VerticalPanel { - - public ControlsPanel() { - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ItemsPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ItemsPanel.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/ItemsPanel.java 2008-09-08 00:56:46 UTC (rev 850) @@ -1,60 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 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.ui.ctx.items; - -import java.util.HashMap; - -import org.ourproject.kune.platf.client.ui.EditableClickListener; -import org.ourproject.kune.platf.client.ui.EditableIconLabel; - -import com.google.gwt.user.client.ui.AbstractImagePrototype; -import com.google.gwt.user.client.ui.VerticalPanel; - -class ItemsPanel extends VerticalPanel { - private final HashMap<String, AbstractImagePrototype> fileIcons; - private final ContextItemsPresenter presenter; - - public ItemsPanel(final ContextItemsPresenter presenter) { - this.presenter = presenter; - addStyleName("kune-NavigationBar"); - addStyleName("Items"); - fileIcons = new HashMap<String, AbstractImagePrototype>(); - } - - public void add(final String name, final String type, final String token, final boolean editable) { - // IconHyperlink item = new IconHyperlink((AbstractImagePrototype) - // fileIcons.get(type), name, event); - EditableIconLabel item = new EditableIconLabel(fileIcons.get(type), name, token, true, - new EditableClickListener() { - public void onEdited(String text) { - presenter.onTitleRename(text, token); - } - }); - item.setEditable(editable); - item.addStyleName("Items"); - item.addStyleName("kune-floatleft"); - add(item); - } - - public void registerType(final String typeName, final AbstractImagePrototype image) { - fileIcons.put(typeName, image); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/bullet_arrow_right.png =================================================================== (Binary files differ) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/chat-blue.png =================================================================== (Binary files differ) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/chat-green.png =================================================================== (Binary files differ) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/folder-go-up-light.png =================================================================== (Binary files differ) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/folder-go-up.png =================================================================== (Binary files differ) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/folder.png =================================================================== (Binary files differ) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/folder_add.png =================================================================== (Binary files differ) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/folderpathmenu.png =================================================================== (Binary files differ) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/go-up-light.png =================================================================== (Binary files differ) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/go-up.png =================================================================== (Binary files differ) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/page.png =================================================================== (Binary files differ) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/page_add.png =================================================================== (Binary files differ) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/page_white.png =================================================================== (Binary files differ) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/nav/page_white_add.png =================================================================== (Binary files differ) Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitelogo/SiteLogoPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitelogo/SiteLogoPanel.java 2008-09-08 00:56:38 UTC (rev 849) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitelogo/SiteLogoPanel.java 2008-09-08 00:56:46 UTC (rev 850) @@ -1,7 +1,7 @@ package org.ourproject.kune.workspace.client.ui.newtmp.sitebar.sitelogo; -import org.ourproject.kune.workspace.client.ui.newtmp.skel.SiteBar; -import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; +import org.ourproject.kune.workspace.client.skel.SiteBar; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import com.google.gwt.user.client.ui.Image; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitenewgroup/SiteNewGroupLinkPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitenewgroup/SiteNewGroupLinkPanel.java 2008-09-08 00:56:38 UTC (rev 849) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitenewgroup/SiteNewGroupLinkPanel.java 2008-09-08 00:56:46 UTC (rev 850) @@ -1,8 +1,8 @@ package org.ourproject.kune.workspace.client.ui.newtmp.sitebar.sitenewgroup; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; -import org.ourproject.kune.workspace.client.sitebar.SiteToken; -import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; +import org.ourproject.kune.workspace.client.site.SiteToken; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import com.google.gwt.user.client.ui.Hyperlink; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPanel.java 2008-09-08 00:56:38 UTC (rev 849) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPanel.java 2008-09-08 00:56:46 UTC (rev 850) @@ -2,7 +2,7 @@ import org.ourproject.kune.workspace.client.i18n.I18nTranslator; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; -import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import com.calclab.suco.client.provider.Provider; import com.google.gwt.user.client.Window; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitepublic/SitePublicSpaceLinkPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitepublic/SitePublicSpaceLinkPanel.java 2008-09-08 00:56:38 UTC (rev 849) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitepublic/SitePublicSpaceLinkPanel.java 2008-09-08 00:56:46 UTC (rev 850) @@ -3,9 +3,9 @@ import org.ourproject.kune.platf.client.services.Images; import org.ourproject.kune.platf.client.ui.IconLabel; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; -import org.ourproject.kune.workspace.client.sitebar.Site; -import org.ourproject.kune.workspace.client.ui.newtmp.skel.SiteBar; -import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; +import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.workspace.client.skel.SiteBar; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.ClickListener; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesearch/SiteSearchPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesearch/SiteSearchPanel.java 2008-09-08 00:56:38 UTC (rev 849) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesearch/SiteSearchPanel.java 2008-09-08 00:56:46 UTC (rev 850) @@ -2,9 +2,9 @@ import org.ourproject.kune.platf.client.services.Images; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; -import org.ourproject.kune.workspace.client.sitebar.Site; -import org.ourproject.kune.workspace.client.ui.newtmp.skel.SiteBar; -import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; +import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.workspace.client.skel.SiteBar; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.FocusListener; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignInLinkPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignInLinkPanel.java 2008-09-08 00:56:38 UTC (rev 849) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignInLinkPanel.java 2008-09-08 00:56:46 UTC (rev 850) @@ -1,8 +1,8 @@ package org.ourproject.kune.workspace.client.ui.newtmp.sitebar.sitesign; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; -import org.ourproject.kune.workspace.client.sitebar.SiteToken; -import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; +import org.ourproject.kune.workspace.client.site.SiteToken; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import com.google.gwt.user.client.ui.Hyperlink; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignOutLinkPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignOutLinkPanel.java 2008-09-08 00:56:38 UTC (rev 849) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignOutLinkPanel.java 2008-09-08 00:56:46 UTC (rev 850) @@ -1,8 +1,8 @@ package org.ourproject.kune.workspace.client.ui.newtmp.sitebar.sitesign; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; -import org.ourproject.kune.workspace.client.sitebar.Site; -import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; +import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.Label; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignOutLinkPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignOutLinkPresenter.java 2008-09-08 00:56:38 UTC (rev 849) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignOutLinkPresenter.java 2008-09-08 00:56:46 UTC (rev 850) @@ -8,8 +8,8 @@ import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException; import org.ourproject.kune.platf.client.services.KuneErrorHandler; import org.ourproject.kune.platf.client.state.Session; -import org.ourproject.kune.workspace.client.sitebar.Site; -import org.ourproject.kune.workspace.client.sitebar.rpc.UserServiceAsync; +import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.workspace.client.site.rpc.UserServiceAsync; import com.calclab.suco.client.provider.Provider; import com.calclab.suco.client.signal.Slot; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java 2008-09-08 00:56:38 UTC (rev 849) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java 2008-09-08 00:56:46 UTC (rev 850) @@ -3,7 +3,7 @@ import org.ourproject.kune.platf.client.dto.GroupDTO; import org.ourproject.kune.platf.client.ui.MenuItemCollection; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; -import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.PushButton;
participants (1)
-
vjrj