[kune-commits] r873 - in trunk/src/main/java/org/ourproject/kune/workspace/client: component ctxnav

vjrj vjrj at ourproject.org
Thu Sep 18 04:06:13 CEST 2008


Author: vjrj
Date: 2008-09-18 04:06:07 +0200 (Thu, 18 Sep 2008)
New Revision: 873

Added:
   trunk/src/main/java/org/ourproject/kune/workspace/client/component/EntityToolbar.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/component/EntityToolbarView.java
Removed:
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbar.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbarView.java
Modified:
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorToolbar.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorView.java
Log:
TreePanel refactor and fix

Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/component/EntityToolbar.java (from rev 872, trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbar.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbar.java	2008-09-18 00:45:41 UTC (rev 872)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/component/EntityToolbar.java	2008-09-18 02:06:07 UTC (rev 873)
@@ -0,0 +1,233 @@
+package org.ourproject.kune.workspace.client.component;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionButtonSeparator;
+import org.ourproject.kune.platf.client.actions.ActionManager;
+import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionPosition;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.workspace.client.skel.Toolbar;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+import com.calclab.suco.client.provider.Provider;
+import com.google.gwt.user.client.ui.Widget;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.ToolbarButton;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+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;
+
+public class EntityToolbar implements EntityToolbarView {
+
+    protected enum ToolbarPosition {
+	content, context
+    }
+
+    private final HashMap<String, Menu> toolbarMenus;
+    private final ArrayList<Widget> removableToolbarItems;
+    private final HashMap<String, Item> menuItems;
+    private final WorkspaceSkeleton ws;
+    private final Session session;
+    private final Provider<ActionManager> actionManagerProvider;
+    private final ToolbarPosition position;
+
+    public EntityToolbar(final ToolbarPosition position, final Session session,
+	    final Provider<ActionManager> actionManagerProvider, final WorkspaceSkeleton ws) {
+	this.position = position;
+	this.session = session;
+	this.actionManagerProvider = actionManagerProvider;
+	this.ws = ws;
+	toolbarMenus = new HashMap<String, Menu>();
+	removableToolbarItems = new ArrayList<Widget>();
+	menuItems = new HashMap<String, Item>();
+
+    }
+
+    public void addButtonAction(final ActionButtonDescriptor<StateToken> action) {
+	final ActionPosition pos = action.getActionPosition();
+	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) {
+		actionManagerProvider.get().doAction(action, session.getCurrentState().getStateToken());
+	    }
+	});
+	button.setIcon(action.getIconUrl());
+	button.setTooltip(action.getToolTip());
+
+	final Toolbar toolbar = getToolbar(pos);
+	if (action.hasLeftSeparator()) {
+	    removableToolbarItems.add(add(toolbar, action.getLeftSeparator()));
+	}
+	toolbar.add(button);
+	if (action.hasRightSeparator()) {
+	    removableToolbarItems.add(add(toolbar, action.getRightSeparator()));
+	}
+	removableToolbarItems.add(button);
+    }
+
+    public void addMenuAction(final ActionMenuDescriptor<StateToken> action, final boolean enable) {
+	final String menuTitle = action.getParentMenuTitle();
+	final String menuSubTitle = action.getParentSubMenuTitle();
+	final ActionPosition pos = action.getActionPosition();
+	final String itemKey = genMenuKey(pos, menuTitle, menuSubTitle, action.getText());
+	Item item = menuItems.get(itemKey);
+	if (item == null) {
+	    item = createToolbarMenu(pos, menuTitle, menuSubTitle, action);
+	    menuItems.put(itemKey, item);
+	}
+	if (enable) {
+	    item.enable();
+	} else {
+	    item.disable();
+	}
+	doLayoutIfNeeded(pos);
+    }
+
+    public void clear() {
+	toolbarMenus.clear();
+	menuItems.clear();
+	removableToolbarItems.clear();
+	getToolbar(ActionPosition.topbar).removeAll();
+	getToolbar(ActionPosition.bottombar).removeAll();
+    }
+
+    public void clearRemovableActions() {
+	for (final Widget widget : removableToolbarItems) {
+	    widget.removeFromParent();
+	}
+	removableToolbarItems.clear();
+	doLayoutIfNeeded();
+    }
+
+    public void disableAllMenuItems() {
+	for (final Item item : menuItems.values()) {
+	    item.disable();
+	}
+	doLayoutIfNeeded();
+    }
+
+    private void add(final ActionPosition toolbar, final Widget widget) {
+	getToolbar(toolbar).add(widget);
+    }
+
+    private Widget add(final Toolbar toolbar, final ActionButtonSeparator separator) {
+	switch (separator) {
+	case fill:
+	    return toolbar.addFill();
+	case separator:
+	    return toolbar.addSeparator();
+	case spacer:
+	default:
+	    return toolbar.addSpacer();
+	}
+    }
+
+    private Item createToolbarMenu(final ActionPosition toolBarPos, final String menuTitle, final String menuSubTitle,
+	    final ActionMenuDescriptor<StateToken> action) {
+	final Item item = new Item(action.getText(), new BaseItemListenerAdapter() {
+	    @Override
+	    public void onClick(BaseItem item, EventObject e) {
+		actionManagerProvider.get().doAction(action, session.getCurrentState().getStateToken());
+	    }
+	});
+	item.setIcon(action.getIconUrl());
+
+	final String menuKey = genMenuKey(toolBarPos, menuTitle, null, null);
+	final String subMenuKey = genMenuKey(toolBarPos, menuTitle, menuSubTitle, null);
+	Menu menu = toolbarMenus.get(menuKey);
+	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(toolBarPos, action.getParentMenuIconUrl(), menuTitle, menuKey);
+		}
+		menu.addItem(subMenuItem);
+		toolbarMenus.put(subMenuKey, subMenu);
+	    }
+	    subMenu.addItem(item);
+
+	} else {
+	    // Menu action without submenu
+	    if (menu == null) {
+		menu = createToolbarMenu(toolBarPos, action.getParentMenuIconUrl(), menuTitle, menuKey);
+	    }
+	    menu.addItem(item);
+	}
+	doLayoutIfNeeded(toolBarPos);
+	return item;
+    }
+
+    private Menu createToolbarMenu(final ActionPosition barPosition, final String iconUrl, final String menuTitle,
+	    final String menuKey) {
+	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(menuKey, menu);
+	add(barPosition, toolbarMenu);
+	return menu;
+    }
+
+    private void doLayoutIfNeeded() {
+	doLayoutIfNeeded(ActionPosition.topbar);
+	doLayoutIfNeeded(ActionPosition.bottombar);
+    }
+
+    private void doLayoutIfNeeded(final ActionPosition pos) {
+	getToolbar(pos).doLayoutIfNeeded();
+    }
+
+    private String genMenuKey(final ActionPosition pos, final String menuTitle, final String menuSubTitle,
+	    final String actionText) {
+	final String basePart = "km-" + pos.toString() + "-" + menuTitle;
+	final String subMenuPart = menuSubTitle != null ? "-subm-" + menuSubTitle : "";
+	final String itemPart = actionText != null ? "-item-" + actionText : "";
+	return basePart + subMenuPart + itemPart;
+    }
+
+    private Toolbar getToolbar(final ActionPosition pos) {
+	switch (pos) {
+	case bootombarAndItemMenu:
+	case bottombar:
+	    switch (position) {
+	    case content:
+		return ws.getEntityWorkspace().getContentBottomBar();
+	    case context:
+	    default:
+		return ws.getEntityWorkspace().getContextBottomBar();
+	    }
+	case topbar:
+	case topbarAndItemMenu:
+	default:
+	    switch (position) {
+	    case content:
+		return ws.getEntityWorkspace().getContentTopBar();
+	    case context:
+	    default:
+		return ws.getEntityWorkspace().getContextTopBar();
+	    }
+	}
+    }
+}

Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/component/EntityToolbarView.java (from rev 872, trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbarView.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbarView.java	2008-09-18 00:45:41 UTC (rev 872)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/component/EntityToolbarView.java	2008-09-18 02:06:07 UTC (rev 873)
@@ -0,0 +1,19 @@
+package org.ourproject.kune.workspace.client.component;
+
+import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
+import org.ourproject.kune.platf.client.dto.StateToken;
+
+public interface EntityToolbarView {
+
+    void addButtonAction(ActionButtonDescriptor<StateToken> action);
+
+    void addMenuAction(ActionMenuDescriptor<StateToken> action, boolean enable);
+
+    void clear();
+
+    void clearRemovableActions();
+
+    void disableAllMenuItems();
+
+}

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java	2008-09-18 00:45:41 UTC (rev 872)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java	2008-09-18 02:06:07 UTC (rev 873)
@@ -34,8 +34,11 @@
 import com.google.gwt.user.client.DeferredCommand;
 import com.google.gwt.user.client.ui.ScrollPanel;
 import com.gwtext.client.core.EventObject;
+import com.gwtext.client.core.ExtElement;
 import com.gwtext.client.data.Node;
 import com.gwtext.client.data.Tree;
+import com.gwtext.client.widgets.Editor;
+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;
@@ -55,6 +58,7 @@
     private final WorkspaceSkeleton ws;
     private boolean fireOnTextChange;
     private final ContextNavigatorPresenter presenter;
+    private boolean isEditable;
 
     public ContextNavigatorPanel(final ContextNavigatorPresenter presenter, final I18nTranslationService i18n,
 	    final WorkspaceSkeleton ws) {
@@ -63,6 +67,7 @@
 
 	contextMenus = new HashMap<String, Menu>();
 	fireOnTextChange = true;
+	isEditable = false;
     }
 
     public void addItem(final ContextNavigatorItem item) {
@@ -160,6 +165,10 @@
 	}
     }
 
+    public void setEditable(final boolean editable) {
+	this.isEditable = editable;
+    }
+
     public void setFireOnTextChange(final boolean fireOnTextChange) {
 	this.fireOnTextChange = fireOnTextChange;
     }
@@ -242,7 +251,7 @@
 	    }
 	});
 	treePanel.setLines(false);
-	treePanel.setEnableDD(true);
+	treePanel.setEnableDD(isEditable);
 	treePanel.setRootNode(root);
 	// treePanel.setAutoScroll(true);
 	treePanel.setContainerScroll(true);
@@ -250,6 +259,11 @@
 
 	final TextField field = new TextField();
 	treeEditor = new TreeEditor(treePanel, field);
+	treeEditor.addListener(new EditorListenerAdapter() {
+	    public boolean doBeforeStartEdit(final Editor source, final ExtElement boundEl, final Object value) {
+		return isEditable;
+	    }
+	});
 
 	final ScrollPanel panel = new ScrollPanel();
 	// final Panel panel = new Panel();

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-09-18 00:45:41 UTC (rev 872)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java	2008-09-18 02:06:07 UTC (rev 873)
@@ -200,10 +200,17 @@
 
     public void setState(final StateDTO state) {
 	final ContainerDTO container = state.getContainer();
-
 	final StateToken stateToken = state.getStateToken();
 	final AccessRightsDTO containerRights = state.getContainerRights();
+	AccessRightsDTO rights;
 
+	if (stateToken.hasAll()) {
+	    rights = state.getContentRights();
+	} else {
+	    rights = containerRights;
+	}
+	view.setEditable(rights.isEditable());
+
 	// If root sended (container is not a root folder) process root (add
 	// childs to view)
 	final ContainerDTO root = state.getRootContainer();
@@ -221,9 +228,11 @@
 
 	// Process our current content/container
 	if (state.hasDocument()) {
+	    rights = state.getContentRights();
 	    addItem(state.getTitle(), state.getTypeId(), state.getStatus(), stateToken, container.getStateToken(),
-		    state.getContentRights(), false);
+		    rights, false);
 	} else {
+	    rights = containerRights;
 	    addItem(container.getName(), container.getTypeId(), ContentStatusDTO.publishedOnline, container
 		    .getStateToken(), container.getStateToken().clone().setFolder(container.getParentFolderId()),
 		    containerRights, false);
@@ -239,6 +248,7 @@
 	    setEditOnNextStateChange(false);
 	} else {
 	    selectItem(stateToken);
+
 	}
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorToolbar.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorToolbar.java	2008-09-18 00:45:41 UTC (rev 872)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorToolbar.java	2008-09-18 02:06:07 UTC (rev 873)
@@ -2,6 +2,7 @@
 
 import org.ourproject.kune.platf.client.actions.ActionManager;
 import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.workspace.client.component.EntityToolbar;
 import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
 
 import com.calclab.suco.client.provider.Provider;

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorView.java	2008-09-18 00:45:41 UTC (rev 872)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorView.java	2008-09-18 02:06:07 UTC (rev 873)
@@ -36,6 +36,8 @@
 
     void selectItem(String id);
 
+    void setEditable(boolean editable);
+
     void setFireOnTextChange(boolean fire);
 
     void setItemText(String id, String text);

Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbar.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbar.java	2008-09-18 00:45:41 UTC (rev 872)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbar.java	2008-09-18 02:06:07 UTC (rev 873)
@@ -1,233 +0,0 @@
-package org.ourproject.kune.workspace.client.ctxnav;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionButtonSeparator;
-import org.ourproject.kune.platf.client.actions.ActionManager;
-import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionPosition;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.workspace.client.skel.Toolbar;
-import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-
-import com.calclab.suco.client.provider.Provider;
-import com.google.gwt.user.client.ui.Widget;
-import com.gwtext.client.core.EventObject;
-import com.gwtext.client.widgets.Button;
-import com.gwtext.client.widgets.ToolbarButton;
-import com.gwtext.client.widgets.event.ButtonListenerAdapter;
-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;
-
-public class EntityToolbar implements EntityToolbarView {
-
-    protected enum ToolbarPosition {
-	content, context
-    }
-
-    private final HashMap<String, Menu> toolbarMenus;
-    private final ArrayList<Widget> removableToolbarItems;
-    private final HashMap<String, Item> menuItems;
-    private final WorkspaceSkeleton ws;
-    private final Session session;
-    private final Provider<ActionManager> actionManagerProvider;
-    private final ToolbarPosition position;
-
-    public EntityToolbar(final ToolbarPosition position, final Session session,
-	    final Provider<ActionManager> actionManagerProvider, final WorkspaceSkeleton ws) {
-	this.position = position;
-	this.session = session;
-	this.actionManagerProvider = actionManagerProvider;
-	this.ws = ws;
-	toolbarMenus = new HashMap<String, Menu>();
-	removableToolbarItems = new ArrayList<Widget>();
-	menuItems = new HashMap<String, Item>();
-
-    }
-
-    public void addButtonAction(final ActionButtonDescriptor<StateToken> action) {
-	final ActionPosition pos = action.getActionPosition();
-	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) {
-		actionManagerProvider.get().doAction(action, session.getCurrentState().getStateToken());
-	    }
-	});
-	button.setIcon(action.getIconUrl());
-	button.setTooltip(action.getToolTip());
-
-	final Toolbar toolbar = getToolbar(pos);
-	if (action.hasLeftSeparator()) {
-	    removableToolbarItems.add(add(toolbar, action.getLeftSeparator()));
-	}
-	toolbar.add(button);
-	if (action.hasRightSeparator()) {
-	    removableToolbarItems.add(add(toolbar, action.getRightSeparator()));
-	}
-	removableToolbarItems.add(button);
-    }
-
-    public void addMenuAction(final ActionMenuDescriptor<StateToken> action, final boolean enable) {
-	final String menuTitle = action.getParentMenuTitle();
-	final String menuSubTitle = action.getParentSubMenuTitle();
-	final ActionPosition pos = action.getActionPosition();
-	final String itemKey = genMenuKey(pos, menuTitle, menuSubTitle, action.getText());
-	Item item = menuItems.get(itemKey);
-	if (item == null) {
-	    item = createToolbarMenu(pos, menuTitle, menuSubTitle, action);
-	    menuItems.put(itemKey, item);
-	}
-	if (enable) {
-	    item.enable();
-	} else {
-	    item.disable();
-	}
-	doLayoutIfNeeded(pos);
-    }
-
-    public void clear() {
-	toolbarMenus.clear();
-	menuItems.clear();
-	removableToolbarItems.clear();
-	getToolbar(ActionPosition.topbar).removeAll();
-	getToolbar(ActionPosition.bottombar).removeAll();
-    }
-
-    public void clearRemovableActions() {
-	for (final Widget widget : removableToolbarItems) {
-	    widget.removeFromParent();
-	}
-	removableToolbarItems.clear();
-	doLayoutIfNeeded();
-    }
-
-    public void disableAllMenuItems() {
-	for (final Item item : menuItems.values()) {
-	    item.disable();
-	}
-	doLayoutIfNeeded();
-    }
-
-    private void add(final ActionPosition toolbar, final Widget widget) {
-	getToolbar(toolbar).add(widget);
-    }
-
-    private Widget add(final Toolbar toolbar, final ActionButtonSeparator separator) {
-	switch (separator) {
-	case fill:
-	    return toolbar.addFill();
-	case separator:
-	    return toolbar.addSeparator();
-	case spacer:
-	default:
-	    return toolbar.addSpacer();
-	}
-    }
-
-    private Item createToolbarMenu(final ActionPosition toolBarPos, final String menuTitle, final String menuSubTitle,
-	    final ActionMenuDescriptor<StateToken> action) {
-	final Item item = new Item(action.getText(), new BaseItemListenerAdapter() {
-	    @Override
-	    public void onClick(BaseItem item, EventObject e) {
-		actionManagerProvider.get().doAction(action, session.getCurrentState().getStateToken());
-	    }
-	});
-	item.setIcon(action.getIconUrl());
-
-	final String menuKey = genMenuKey(toolBarPos, menuTitle, null, null);
-	final String subMenuKey = genMenuKey(toolBarPos, menuTitle, menuSubTitle, null);
-	Menu menu = toolbarMenus.get(menuKey);
-	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(toolBarPos, action.getParentMenuIconUrl(), menuTitle, menuKey);
-		}
-		menu.addItem(subMenuItem);
-		toolbarMenus.put(subMenuKey, subMenu);
-	    }
-	    subMenu.addItem(item);
-
-	} else {
-	    // Menu action without submenu
-	    if (menu == null) {
-		menu = createToolbarMenu(toolBarPos, action.getParentMenuIconUrl(), menuTitle, menuKey);
-	    }
-	    menu.addItem(item);
-	}
-	doLayoutIfNeeded(toolBarPos);
-	return item;
-    }
-
-    private Menu createToolbarMenu(final ActionPosition barPosition, final String iconUrl, final String menuTitle,
-	    final String menuKey) {
-	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(menuKey, menu);
-	add(barPosition, toolbarMenu);
-	return menu;
-    }
-
-    private void doLayoutIfNeeded() {
-	doLayoutIfNeeded(ActionPosition.topbar);
-	doLayoutIfNeeded(ActionPosition.bottombar);
-    }
-
-    private void doLayoutIfNeeded(final ActionPosition pos) {
-	getToolbar(pos).doLayoutIfNeeded();
-    }
-
-    private String genMenuKey(final ActionPosition pos, final String menuTitle, final String menuSubTitle,
-	    final String actionText) {
-	final String basePart = "km-" + pos.toString() + "-" + menuTitle;
-	final String subMenuPart = menuSubTitle != null ? "-subm-" + menuSubTitle : "";
-	final String itemPart = actionText != null ? "-item-" + actionText : "";
-	return basePart + subMenuPart + itemPart;
-    }
-
-    private Toolbar getToolbar(final ActionPosition pos) {
-	switch (pos) {
-	case bootombarAndItemMenu:
-	case bottombar:
-	    switch (position) {
-	    case content:
-		return ws.getEntityWorkspace().getContentBottomBar();
-	    case context:
-	    default:
-		return ws.getEntityWorkspace().getContextBottomBar();
-	    }
-	case topbar:
-	case topbarAndItemMenu:
-	default:
-	    switch (position) {
-	    case content:
-		return ws.getEntityWorkspace().getContentTopBar();
-	    case context:
-	    default:
-		return ws.getEntityWorkspace().getContextTopBar();
-	    }
-	}
-    }
-}

Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbarView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbarView.java	2008-09-18 00:45:41 UTC (rev 872)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbarView.java	2008-09-18 02:06:07 UTC (rev 873)
@@ -1,19 +0,0 @@
-package org.ourproject.kune.workspace.client.ctxnav;
-
-import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
-import org.ourproject.kune.platf.client.dto.StateToken;
-
-public interface EntityToolbarView {
-
-    void addButtonAction(ActionButtonDescriptor<StateToken> action);
-
-    void addMenuAction(ActionMenuDescriptor<StateToken> action, boolean enable);
-
-    void clear();
-
-    void clearRemovableActions();
-
-    void disableAllMenuItems();
-
-}




More information about the kune-commits mailing list