[kune-commits] r804 - in trunk: script src/main/java/org/ourproject/kune/app/public/css src/main/java/org/ourproject/kune/platf/client/ui src/main/java/org/ourproject/kune/platf/client/ui/gridmenu src/main/java/org/ourproject/kune/platf/public/images src/main/java/org/ourproject/kune/workspace/client/socialnet src/main/java/org/ourproject/kune/workspace/client/tags src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel

vjrj vjrj at ourproject.org
Sun Jul 20 16:38:25 CEST 2008


Author: vjrj
Date: 2008-07-20 16:38:06 +0200 (Sun, 20 Jul 2008)
New Revision: 804

Added:
   trunk/script/generateBasicUIElements.sh
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridButton.java
   trunk/src/main/java/org/ourproject/kune/platf/public/images/accept.gif
   trunk/src/main/java/org/ourproject/kune/platf/public/images/add-green.gif
   trunk/src/main/java/org/ourproject/kune/platf/public/images/arrow-down-green.gif
   trunk/src/main/java/org/ourproject/kune/platf/public/images/arrow-up-green.gif
   trunk/src/main/java/org/ourproject/kune/platf/public/images/cancel.gif
   trunk/src/main/java/org/ourproject/kune/platf/public/images/del.gif
   trunk/src/main/java/org/ourproject/kune/platf/public/images/group-home.gif
   trunk/src/main/java/org/ourproject/kune/platf/public/images/kune-search-ico-push.gif
Modified:
   trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenu.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuItem.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanelNew.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenterNew.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryViewNew.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java
Log:
new GridMenuPanel and GroupMembersSummary

Added: trunk/script/generateBasicUIElements.sh
===================================================================
--- trunk/script/generateBasicUIElements.sh	2008-07-20 01:51:06 UTC (rev 803)
+++ trunk/script/generateBasicUIElements.sh	2008-07-20 14:38:06 UTC (rev 804)
@@ -0,0 +1,89 @@
+#!/bin/bash
+
+PARAMS=$#
+NAME=$2
+DIR=$1
+
+# CORRECT PARAMS ###############################################################
+
+  if [ $PARAMS -ne 2 ]
+  then
+  	echo "Use: $0 <packageDirDest> <ClassName>"
+    echo "$0 src/main/java/com/calclab/emiteui/client/chatuiplugin/chat ChatUI"
+    exit
+  fi
+
+# DO
+PACKAGE=`echo $DIR | cut -d "/" -f 4- | sed 's/\//\./g'`
+
+cat <<EOF > $DIR/${NAME}.java
+package $PACKAGE;
+
+public interface $NAME {
+
+}
+EOF
+
+cat <<EOF > $DIR/${NAME}Presenter.java
+package $PACKAGE;
+
+import org.ourproject.kune.platf.client.View;
+
+public class ${NAME}Presenter implements $NAME {
+
+private ${NAME}View view;
+
+public ${NAME}Presenter() {
+}
+
+public void init(${NAME}View view) {
+this.view = view;
+}
+
+
+    public View getView() {
+        return view;
+    }
+
+}
+
+EOF
+
+cat <<EOF > $DIR/${NAME}View.java
+package $PACKAGE;
+
+import org.ourproject.kune.platf.client.View;
+
+public interface ${NAME}View extends View {
+}
+
+EOF
+
+cat <<EOF > $DIR/${NAME}Panel.java
+package $PACKAGE;
+
+public class ${NAME}Panel implements ${NAME}View {
+
+public ${NAME}Panel(final ${NAME}Presenter presenter) {
+}
+}
+EOF
+
+
+cat <<EOF
+// If you use a Module, paste this
+package $PACKAGE;
+
+import $PACKAGE.${NAME}Presenter;
+import $PACKAGE.${NAME}Panel;
+import $PACKAGE.${NAME};
+
+builder.registerProvider(${NAME}.class, new Provider<${NAME}>() {
+    public ${NAME} get() {
+	final ${NAME}Presenter presenter = new ${NAME}Presenter();
+	final ${NAME}Panel panel = new ${NAME}Panel(presenter);
+	presenter.init(panel);
+	return presenter;
+    }
+}, SingletonScope.class);
+EOF


Property changes on: trunk/script/generateBasicUIElements.sh
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css	2008-07-20 01:51:06 UTC (rev 803)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css	2008-07-20 14:38:06 UTC (rev 804)
@@ -3,52 +3,52 @@
 }
 
 .k-sitebar .kune-IconHyperlink {
-  white-space: nowrap;
+    white-space: nowrap;
 }
 
 .k-sitebar .kune-IconHyperlink a:link {
-  cursor: pointer;
-  text-decoration: underline;
-  color: #B3B3B3;
+    cursor: pointer;
+    text-decoration: underline;
+    color: #B3B3B3;
 }
 
 .k-sitebar .kune-IconHyperlink a:hover {
-  text-decoration: underline;
+    text-decoration: underline;
 }
 
 .k-sitebar .kune-IconHyperlink a:visited {
-  color: #B3B3B3;
+    color: #B3B3B3;
 }
 
 .k-sitebar {
-  margin-right: 10px;
-  height: 16px;
+    margin-right: 10px;
+    height: 16px;
 }
 
 .k-sitebar .gwt-TextBox {
-  border: 1px solid #E4A374;
-  margin: 0 15px 0 3px;
-  padding-left: 3px;
-  color: #B3B3B3;
+    border: 1px solid #E4A374;
+    margin: 0 15px 0 3px;
+    padding-left: 3px;
+    color: #B3B3B3;
 }
 
 .k-sitebar .gwt-Hyperlink a {
-  white-space: nowrap;
-  color: #B3B3B3;
-  text-decoration: underline;
-  cursor: pointer;
+    white-space: nowrap;
+    color: #B3B3B3;
+    text-decoration: underline;
+    cursor: pointer;
 }
 
 .k-sitebar .gwt-PushButton {
-  cursor: pointer;
+    cursor: pointer;
 }
 
 .k-sitebar-LabelLink {
-  white-space: nowrap;
-  color: #B3B3B3;
-  margin-left: 3px;
-  cursor: pointer;
-  text-decoration: underline;
+    white-space: nowrap;
+    color: #B3B3B3;
+    margin-left: 3px;
+    cursor: pointer;
+    text-decoration: underline;
 }
 
 .k-entity-summary {
@@ -249,38 +249,72 @@
 .ytb-spacer {
     width: 2px;
 }
-
 /* Drop down */
-
 .k-dropdownouter {
+    background-color: gray;
 }
 
-.k-dropdownouter-def {
+.k-dropdownouter-members {
+}
+
+.k-dropdownouter-members-def {
+    background-color: #DF5244;
+}
+
+.k-dropdownouter-members-green {
+    background-color: #008000;
+}
+
+.k-dropdownouter-part {
+}
+
+.k-dropdownouter-part-def {
+    background-color: #CA5842;
+}
+
+.k-dropdownouter-part-green {
+    background-color: #00AA00;
+}
+
+.k-dropdownouter-tags {
+}
+
+.k-dropdownouter-tags-def {
     background-color: #87501E;
 }
 
-.k-dropdownouter-green {
-	   background-color: #00D400;
+.k-dropdownouter-tags-green {
+    background-color: #00D400;
 }
 
+.k-dropdownouter-summary {
+}
+
+.k-dropdownouter-summary-def {
+    background-color: #9F734B;
+}
+
+.k-dropdownouter-summary-green {
+    background-color: #4CE14C;
+}
+
 .k-dropdowninner {
-  margin: 0 3px 1px 3px;
-  background: green;
-  background-color: #FFF;
-  padding: 3px;
+    margin: 0 3px 1px 3px;
+    background: green;
+    background-color: #FFF;
+    /* padding: 3px; */
 }
 
 .k-dropdownlabel {
-  color: #FFF;
-  cursor: pointer;
+    color: #FFF;
+    cursor: pointer;
 }
 
 .k-dropdownlabel .gwt-Label {
-  margin: 0 5px 0 0;
-  width: 100%;
+    margin: 0 5px 0 0;
+    width: 100%;
 }
 
 .k-dropdownlabel img {
-  margin: 0 3px 0 1px;
+    margin: 0 3px 0 1px;
 }
-

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java	2008-07-20 01:51:06 UTC (rev 803)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java	2008-07-20 14:38:06 UTC (rev 804)
@@ -45,6 +45,7 @@
     private final Images img;
     private final Image arrowImage;
     private final RoundedPanel outerBorder;
+    private String stylePrimaryName;
 
     public DropDownPanel() {
 	vp = new VerticalPanel();
@@ -60,8 +61,9 @@
 	titleHP.add(arrowImage);
 	titleHP.add(titleLabel);
 
-	outerBorder.setCornerStyleName("k-dropdownouter");
-	vp.setStylePrimaryName("k-dropdownouter");
+	this.stylePrimaryName = "k-dropdownouter";
+	outerBorder.setCornerStyleName(stylePrimaryName);
+	vp.setStylePrimaryName(stylePrimaryName);
 	vp.setWidth("100%");
 	vp.setCellWidth(contentPanel, "100%");
 	vp.setCellWidth(titleHP, "100%");
@@ -97,6 +99,12 @@
 	}
     }
 
+    public void setBorderStylePrimaryName(final String stylePrimaryName) {
+	this.stylePrimaryName = stylePrimaryName;
+	outerBorder.setCornerStyleName(stylePrimaryName);
+	vp.setStylePrimaryName(stylePrimaryName);
+    }
+
     @Deprecated
     public void setColor(final String color) {
 	// outerBorder.setColor(color);
@@ -148,7 +156,7 @@
 	    contentPanel.removeStyleDependentName(oldThemeS);
 	}
 	final String newThemeS = newTheme.toString();
-	outerBorder.setCornerStyleName("k-dropdownouter-" + newThemeS);
+	outerBorder.setCornerStyleName(stylePrimaryName + "-" + newThemeS);
 	// outerBorder.addStyleDependentName(newThemeS);
 	vp.addStyleDependentName(newThemeS);
 	titleHP.addStyleDependentName(newThemeS);

Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridButton.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridButton.java	2008-07-20 01:51:06 UTC (rev 803)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridButton.java	2008-07-20 14:38:06 UTC (rev 804)
@@ -0,0 +1,35 @@
+package org.ourproject.kune.platf.client.ui.gridmenu;
+
+import com.calclab.suco.client.signal.Slot;
+
+public class GridButton {
+
+    private final String title;
+    private final String icon;
+    private final String tooltip;
+    private final Slot<String> slot;
+
+    public GridButton(final String icon, final String title, final String tooltip, final Slot<String> slot) {
+	this.icon = icon;
+	this.title = title;
+	this.tooltip = tooltip;
+	this.slot = slot;
+    }
+
+    public String getIcon() {
+	return icon;
+    }
+
+    public Slot<String> getSlot() {
+	return slot;
+    }
+
+    public String getTitle() {
+	return title;
+    }
+
+    public String getTooltip() {
+	return tooltip;
+    }
+
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenu.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenu.java	2008-07-20 01:51:06 UTC (rev 803)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenu.java	2008-07-20 14:38:06 UTC (rev 804)
@@ -49,7 +49,7 @@
 
     public void addMenuItem(final GridMenuItem<T> menuItem) {
 	final Item item = new Item(menuItem.getTitle());
-	item.setIconCls(menuItem.getIconCls());
+	item.setIcon(menuItem.getIcon());
 	menu.addItem(item);
 	item.addListener(new BaseItemListenerAdapter() {
 	    public void onClick(final BaseItem item, final EventObject e) {

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuItem.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuItem.java	2008-07-20 01:51:06 UTC (rev 803)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuItem.java	2008-07-20 14:38:06 UTC (rev 804)
@@ -5,12 +5,12 @@
 
 public class GridMenuItem<T> {
 
-    final String iconCls;
+    final String icon;
     final String title;
     private final Signal<T> onClick;
 
-    public GridMenuItem(final String iconCls, final String title, final Slot<T> slot) {
-	this.iconCls = iconCls;
+    public GridMenuItem(final String icon, final String title, final Slot<T> slot) {
+	this.icon = icon;
 	this.title = title;
 	this.onClick = new Signal<T>("onClick");
 	onClick(slot);
@@ -20,8 +20,8 @@
 	onClick.fire(id);
     }
 
-    public String getIconCls() {
-	return iconCls;
+    public String getIcon() {
+	return icon;
     }
 
     public String getTitle() {

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java	2008-07-20 01:51:06 UTC (rev 803)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java	2008-07-20 14:38:06 UTC (rev 804)
@@ -22,10 +22,8 @@
 import com.gwtext.client.dd.DropTarget;
 import com.gwtext.client.dd.DropTargetConfig;
 import com.gwtext.client.util.Format;
-import com.gwtext.client.widgets.BoxComponent;
 import com.gwtext.client.widgets.Panel;
 import com.gwtext.client.widgets.Toolbar;
-import com.gwtext.client.widgets.event.ContainerListenerAdapter;
 import com.gwtext.client.widgets.grid.CellMetadata;
 import com.gwtext.client.widgets.grid.ColumnConfig;
 import com.gwtext.client.widgets.grid.ColumnModel;
@@ -109,12 +107,6 @@
 	}
 	menuMap = new HashMap<String, GridMenu<T>>();
 	recordMap = new HashMap<T, Record>();
-	panel.addListener(new ContainerListenerAdapter() {
-	    public void onResize(final BoxComponent component, final int adjWidth, final int adjHeight,
-		    final int rawWidth, final int rawHeight) {
-		setWidth(adjWidth);
-	    }
-	});
 	initWidget(panel);
     }
 
@@ -210,6 +202,13 @@
 	doLayoutIfNeeded();
     }
 
+    public void setWidth(final int width) {
+	if (grid != null) {
+	    grid.setWidth(width - 27);
+	    doLayoutIfNeeded();
+	}
+    }
+
     public void sort() {
 	store.sort(GROUP);
     }
@@ -426,13 +425,4 @@
 	final Record record = store.getRecordAt(rowIndex);
 	onDoubleClick.fire(record.getAsString(ID));
     }
-
-    private void setWidth(final int width) {
-	Log.info("Grid width: " + width);
-	if (grid != null) {
-	    grid.setWidth(width - 27);
-	    // panel.setWidth(width - 25);
-	    doLayoutIfNeeded();
-	}
-    }
 }

Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/accept.gif
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/accept.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/add-green.gif
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/add-green.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/arrow-down-green.gif
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/arrow-down-green.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/arrow-up-green.gif
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/arrow-up-green.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/cancel.gif
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/cancel.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/del.gif
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/del.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/group-home.gif
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/group-home.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/kune-search-ico-push.gif
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/kune-search-ico-push.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanelNew.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanelNew.java	2008-07-20 01:51:06 UTC (rev 803)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanelNew.java	2008-07-20 14:38:06 UTC (rev 804)
@@ -2,48 +2,81 @@
 
 import org.ourproject.kune.platf.client.dto.GroupDTO;
 import org.ourproject.kune.platf.client.ui.DropDownPanel;
+import org.ourproject.kune.platf.client.ui.gridmenu.GridButton;
 import org.ourproject.kune.platf.client.ui.gridmenu.GridItem;
 import org.ourproject.kune.platf.client.ui.gridmenu.GridMenuPanel;
 import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.ui.newtmp.skel.EntitySummary;
 import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
 import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
 
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.widgets.BoxComponent;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.MessageBox;
 import com.gwtext.client.widgets.ToolbarButton;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import com.gwtext.client.widgets.event.ContainerListenerAdapter;
 
 public class GroupMembersSummaryPanelNew extends DropDownPanel implements GroupMembersSummaryViewNew {
     private final GridMenuPanel<GroupDTO> gridMenuPanel;
+    private final I18nUITranslationService i18n;
+    private final GroupMembersSummaryPresenterNew presenter;
 
     public GroupMembersSummaryPanelNew(final GroupMembersSummaryPresenterNew presenter,
 	    final I18nUITranslationService i18n, final WorkspaceSkeleton ws) {
 	super(true);
+	this.presenter = presenter;
+	this.i18n = i18n;
 	super.setHeaderText(i18n.t("Group members"));
 	super.setHeaderTitle(i18n.t("People and groups collaborating in this group"));
+	super.setBorderStylePrimaryName("k-dropdownouter-members");
 	gridMenuPanel = new GridMenuPanel<GroupDTO>(i18n.t("This is an orphaned project, if you are interested "
 		+ "please request to join to work on it"), true, true, false, true);
-	ws.getEntitySummary().addInSummary(this);
+	final EntitySummary entitySummary = ws.getEntitySummary();
+	entitySummary.addInSummary(this);
+	entitySummary.addListener(new ContainerListenerAdapter() {
+	    @Override
+	    public void onResize(final BoxComponent component, final int adjWidth, final int adjHeight,
+		    final int rawWidth, final int rawHeight) {
+		gridMenuPanel.setWidth(adjWidth);
+	    }
+	});
 	this.setContent(gridMenuPanel);
     }
 
-    public void addAddMemberButton() {
-	gridMenuPanel.getBottomBar().addButton(new ToolbarButton("Test"));
+    public void addButton(final GridButton gridButton) {
+	final ToolbarButton button = new ToolbarButton(gridButton.getTitle());
+	button.setIcon(gridButton.getIcon());
+	button.setTooltip(gridButton.getTooltip());
+	button.addListener(new ButtonListenerAdapter() {
+	    public void onClick(final Button button, final EventObject e) {
+		gridButton.getSlot().onEvent("");
+	    }
+	});
+	gridMenuPanel.getBottomBar().addButton(button);
     }
 
     public void addItem(final GridItem<GroupDTO> gridItem) {
 	gridMenuPanel.addItem(gridItem);
     }
 
-    public void addJoinButton() {
-	gridMenuPanel.getBottomBar().addButton(new ToolbarButton("Test"));
+    public void clear() {
+	gridMenuPanel.removeAll();
     }
 
-    public void addUnjoinButton() {
-	gridMenuPanel.getBottomBar().addButton(new ToolbarButton("Test"));
+    public void confirmAddCollab(final String groupShortName, final String groupLongName) {
+	final String groupName = groupLongName + " (" + groupShortName + ")";
+	MessageBox.confirm(i18n.t("Confirm addition of member"), i18n.t("Add [%s] as member?", groupName),
+		new MessageBox.ConfirmCallback() {
+		    public void execute(final String btnID) {
+			if (btnID.equals("yes")) {
+			    presenter.addCollab(groupShortName);
+			}
+		    }
+		});
     }
 
-    public void clear() {
-	gridMenuPanel.removeAll();
-    }
-
     public void setDropDownContentVisible(final boolean visible) {
 	super.setContentVisible(visible);
     }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenterNew.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenterNew.java	2008-07-20 01:51:06 UTC (rev 803)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenterNew.java	2008-07-20 14:38:06 UTC (rev 804)
@@ -16,6 +16,7 @@
 import org.ourproject.kune.platf.client.services.ImageUtils;
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.ui.gridmenu.GridButton;
 import org.ourproject.kune.platf.client.ui.gridmenu.GridGroup;
 import org.ourproject.kune.platf.client.ui.gridmenu.GridItem;
 import org.ourproject.kune.platf.client.ui.gridmenu.GridMenu;
@@ -44,6 +45,9 @@
     private GridMenuItem<GroupDTO> changeToAdminMenuItem;
     private GridMenuItem<GroupDTO> acceptJoinGroupMenuItem;
     private GridMenuItem<GroupDTO> denyJoinGroupMenuItem;
+    private GridButton addMember;
+    private GridButton requestJoin;
+    private GridButton unJoinButton;
 
     public GroupMembersSummaryPresenterNew(final I18nTranslationService i18n,
 	    final Provider<StateManager> stateManager, final ImageUtils imageUtils, final Session session,
@@ -62,9 +66,23 @@
 	pendigGroup = new GridGroup(pendingTitle, pendingTitle, i18n
 		.t("People pending to be accepted in this group by the admins"), imageUtils
 		.getImageHtml(ImageDescriptor.alert), true);
-	createActions();
+	createMenuActions();
+	createButtons();
     }
 
+    public void addCollab(final String groupShortName) {
+	Site.showProgressProcessing();
+	snService.addCollabMember(session.getUserHash(), session.getCurrentState().getGroup().getShortName(),
+		groupShortName, new AsyncCallbackSimple<SocialNetworkResultDTO>() {
+		    public void onSuccess(final SocialNetworkResultDTO result) {
+			Site.hideProgress();
+			Site.info(i18n.t("Member added as collaborator"));
+			getStateManager().setSocialNetwork(result);
+		    }
+
+		});
+    }
+
     public void hide() {
 	view.setVisible(false);
     }
@@ -85,74 +103,147 @@
 	view.setTheme(oldTheme, newTheme);
     }
 
-    private void createActions() {
-	gotoGroupMenuItem = new GridMenuItem<GroupDTO>("", i18n.t("Visit this member homepage"), new Slot<GroupDTO>() {
-	    public void onEvent(final GroupDTO groupDTO) {
-		getStateManager().gotoToken(groupDTO.getShortName());
+    private void createButtons() {
+	addMember = new GridButton("images/add-green.gif", i18n.t("Add member"), i18n
+		.t("Add a group or a person as member of this group"), new Slot<String>() {
+	    public void onEvent(final String parameter) {
+		// TODO
+		// GroupLiveSearchComponent groupLiveSearchComponent
+		// = workspace.getGroupLiveSearchComponent();
+		// groupLiveSearchComponent.addListener(listener);
+		// groupLiveSearchComponent.show();
 	    }
 	});
-	changeToCollabMenuItem = new GridMenuItem<GroupDTO>("", i18n.t("Change to collaborator"), new Slot<GroupDTO>() {
-	    public void onEvent(final GroupDTO group) {
+
+	requestJoin = new GridButton("images/add-green.gif", i18n.t("Request to join"), i18n
+		.t("Request to participate in this group"), new Slot<String>() {
+	    public void onEvent(final String parameter) {
 		Site.showProgressProcessing();
-		snService.setCollabAsAdmin(session.getUserHash(), session.getCurrentState().getGroup().getShortName(),
-			group.getShortName(), new AsyncCallbackSimple<SocialNetworkResultDTO>() {
-			    public void onSuccess(final SocialNetworkResultDTO result) {
+		snService.requestJoinGroup(session.getUserHash(), session.getCurrentState().getGroup().getShortName(),
+			new AsyncCallbackSimple<Object>() {
+			    public void onSuccess(final Object result) {
 				Site.hideProgress();
-				Site.info(i18n.t("Type of member changed"));
-				getStateManager().setSocialNetwork(result);
+				final String resultType = (String) result;
+				if (resultType == SocialNetworkDTO.REQ_JOIN_ACEPTED) {
+				    Site.info(i18n.t("You are now member of this group"));
+				    getStateManager().reload();
+				}
+				if (resultType == SocialNetworkDTO.REQ_JOIN_DENIED) {
+				    Site.important(i18n.t("Sorry this is a closed group"));
+				}
+				if (resultType == SocialNetworkDTO.REQ_JOIN_WAITING_MODERATION) {
+				    Site.info(i18n.t("Requested. Waiting for admins decision"));
+				}
 			    }
 			});
 	    }
 	});
-	removeMemberMenuItem = new GridMenuItem<GroupDTO>("", i18n.t("Remove this member"), new Slot<GroupDTO>() {
-	    public void onEvent(final GroupDTO group) {
+
+	unJoinButton = new GridButton("images/del.gif", i18n.t("Unjoin this group"), i18n
+		.t("Don't participate more as a member in this group"), new Slot<String>() {
+	    public void onEvent(final String parameter) {
 		Site.showProgressProcessing();
-		snService.deleteMember(session.getUserHash(), session.getCurrentState().getGroup().getShortName(),
-			group.getShortName(), new AsyncCallbackSimple<SocialNetworkResultDTO>() {
+		snService.unJoinGroup(session.getUserHash(), session.getCurrentState().getGroup().getShortName(),
+			new AsyncCallbackSimple<SocialNetworkResultDTO>() {
 			    public void onSuccess(final SocialNetworkResultDTO result) {
 				Site.hideProgress();
-				Site.info(i18n.t("Member removed"));
+				Site.info(i18n.t("Removed as member"));
 				getStateManager().reload();
-				// in the future, only if I cannot
-				// be affected:
-				// snService.stateManager.reloadSocialNetwork((SocialNetworkResultDTO)
+				// in the future with user info:
+				// services.stateManager.reloadSocialNetwork((SocialNetworkResultDTO)
 				// result);
 			    }
 			});
 	    }
 	});
-	changeToAdminMenuItem = new GridMenuItem<GroupDTO>("", i18n.t("Change to admin"), new Slot<GroupDTO>() {
-	    public void onEvent(final GroupDTO group) {
-		Site.showProgressProcessing();
-		final SocialNetworkServiceAsync server = SocialNetworkService.App.getInstance();
-		server.addAdminMember(session.getUserHash(), session.getCurrentState().getGroup().getShortName(), group
-			.getShortName(), new AsyncCallbackSimple<SocialNetworkResultDTO>() {
-		    public void onSuccess(final SocialNetworkResultDTO result) {
-			Site.hideProgress();
-			Site.info(i18n.t("Member added as admin"));
-			getStateManager().setSocialNetwork(result);
+    }
+
+    private GridItem<GroupDTO> createDefMemberMenu(final GroupDTO group, final GridGroup gridGroup) {
+	final GridMenu<GroupDTO> menu = new GridMenu<GroupDTO>(group);
+	final String longName = group.getLongName();
+	final GridItem<GroupDTO> gridItem = new GridItem<GroupDTO>(group, gridGroup, group.getShortName(), imageUtils
+		.getImageHtml(ImageDescriptor.groupDefIcon), longName, longName, " ", longName, i18n.t(
+		"User name: [%s]", group.getShortName()), menu);
+	menu.addMenuItem(gotoGroupMenuItem);
+	return gridItem;
+    }
+
+    private void createMenuActions() {
+	gotoGroupMenuItem = new GridMenuItem<GroupDTO>("images/group-home.gif", i18n.t("Visit this member homepage"),
+		new Slot<GroupDTO>() {
+		    public void onEvent(final GroupDTO groupDTO) {
+			getStateManager().gotoToken(groupDTO.getShortName());
 		    }
 		});
-	    }
-	});
-	acceptJoinGroupMenuItem = new GridMenuItem<GroupDTO>("", i18n.t("Accept this member"), new Slot<GroupDTO>() {
+	changeToCollabMenuItem = new GridMenuItem<GroupDTO>("images/arrow-down-green.gif", i18n
+		.t("Change to collaborator"), new Slot<GroupDTO>() {
 	    public void onEvent(final GroupDTO group) {
 		Site.showProgressProcessing();
-		snService.AcceptJoinGroup(session.getUserHash(), session.getCurrentState().getGroup().getShortName(),
+		snService.setCollabAsAdmin(session.getUserHash(), session.getCurrentState().getGroup().getShortName(),
 			group.getShortName(), new AsyncCallbackSimple<SocialNetworkResultDTO>() {
 			    public void onSuccess(final SocialNetworkResultDTO result) {
 				Site.hideProgress();
-				Site.info(i18n.t("Member accepted"));
+				Site.info(i18n.t("Type of member changed"));
 				getStateManager().setSocialNetwork(result);
 			    }
 			});
 	    }
 	});
-	denyJoinGroupMenuItem = new GridMenuItem<GroupDTO>("", i18n.t("Don't accept this member"),
+	removeMemberMenuItem = new GridMenuItem<GroupDTO>("images/del.gif", i18n.t("Remove this member"),
 		new Slot<GroupDTO>() {
 		    public void onEvent(final GroupDTO group) {
 			Site.showProgressProcessing();
+			snService.deleteMember(session.getUserHash(), session.getCurrentState().getGroup()
+				.getShortName(), group.getShortName(),
+				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
+				    public void onSuccess(final SocialNetworkResultDTO result) {
+					Site.hideProgress();
+					Site.info(i18n.t("Member removed"));
+					getStateManager().reload();
+					// in the future, only if I cannot
+					// be affected:
+					// snService.stateManager.reloadSocialNetwork((SocialNetworkResultDTO)
+					// result);
+				    }
+				});
+		    }
+		});
+	changeToAdminMenuItem = new GridMenuItem<GroupDTO>("images/arrow-up-green.gif", i18n.t("Change to admin"),
+		new Slot<GroupDTO>() {
+		    public void onEvent(final GroupDTO group) {
+			Site.showProgressProcessing();
 			final SocialNetworkServiceAsync server = SocialNetworkService.App.getInstance();
+			server.addAdminMember(session.getUserHash(), session.getCurrentState().getGroup()
+				.getShortName(), group.getShortName(),
+				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
+				    public void onSuccess(final SocialNetworkResultDTO result) {
+					Site.hideProgress();
+					Site.info(i18n.t("Member added as admin"));
+					getStateManager().setSocialNetwork(result);
+				    }
+				});
+		    }
+		});
+	acceptJoinGroupMenuItem = new GridMenuItem<GroupDTO>("images/accept.gif", i18n.t("Accept this member"),
+		new Slot<GroupDTO>() {
+		    public void onEvent(final GroupDTO group) {
+			Site.showProgressProcessing();
+			snService.AcceptJoinGroup(session.getUserHash(), session.getCurrentState().getGroup()
+				.getShortName(), group.getShortName(),
+				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
+				    public void onSuccess(final SocialNetworkResultDTO result) {
+					Site.hideProgress();
+					Site.info(i18n.t("Member accepted"));
+					getStateManager().setSocialNetwork(result);
+				    }
+				});
+		    }
+		});
+	denyJoinGroupMenuItem = new GridMenuItem<GroupDTO>("images/cancel.gif", i18n.t("Don't accept this member"),
+		new Slot<GroupDTO>() {
+		    public void onEvent(final GroupDTO group) {
+			Site.showProgressProcessing();
+			final SocialNetworkServiceAsync server = SocialNetworkService.App.getInstance();
 			server.denyJoinGroup(session.getUserHash(),
 				session.getCurrentState().getGroup().getShortName(), group.getShortName(),
 				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
@@ -166,16 +257,6 @@
 		});
     }
 
-    private GridItem<GroupDTO> createDefMemberMenu(final GroupDTO group, final GridGroup gridGroup) {
-	final GridMenu<GroupDTO> menu = new GridMenu<GroupDTO>(group);
-	final String longName = group.getLongName();
-	final GridItem<GroupDTO> gridItem = new GridItem<GroupDTO>(group, gridGroup, group.getShortName(), imageUtils
-		.getImageHtml(ImageDescriptor.groupDefIcon), longName, longName, " ", longName, i18n.t(
-		"User name: [%s]", group.getShortName()), menu);
-	menu.addMenuItem(gotoGroupMenuItem);
-	return gridItem;
-    }
-
     private StateManager getStateManager() {
 	return stateManager.get();
     }
@@ -202,13 +283,13 @@
 	view.clear();
 
 	if (userIsAdmin) {
-	    view.addAddMemberButton();
+	    view.addButton(addMember);
 	}
 
 	if (!userIsMember) {
-	    view.addJoinButton();
+	    view.addButton(requestJoin);
 	} else if (userIsAdmin && numAdmins > 1 || userIsCollab) {
-	    view.addUnjoinButton();
+	    view.addButton(unJoinButton);
 	}
 
 	if (userCanView) {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryViewNew.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryViewNew.java	2008-07-20 01:51:06 UTC (rev 803)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryViewNew.java	2008-07-20 14:38:06 UTC (rev 804)
@@ -1,19 +1,16 @@
 package org.ourproject.kune.workspace.client.socialnet;
 
 import org.ourproject.kune.platf.client.dto.GroupDTO;
+import org.ourproject.kune.platf.client.ui.gridmenu.GridButton;
 import org.ourproject.kune.platf.client.ui.gridmenu.GridItem;
 import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
 
 public interface GroupMembersSummaryViewNew {
 
-    void addAddMemberButton();
+    void addButton(GridButton gridButton);
 
     void addItem(GridItem<GroupDTO> gridItem);
 
-    void addJoinButton();
-
-    void addUnjoinButton();
-
     void clear();
 
     void setDropDownContentVisible(boolean visible);

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPanel.java	2008-07-20 01:51:06 UTC (rev 803)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPanel.java	2008-07-20 14:38:06 UTC (rev 804)
@@ -42,8 +42,10 @@
     private final Label noTagsLabel;
     private final I18nTranslationService i18n;
 
-    public TagsSummaryPanel(final TagsSummaryPresenter presenter, final I18nTranslationService i18n, final WorkspaceSkeleton ws) {
+    public TagsSummaryPanel(final TagsSummaryPresenter presenter, final I18nTranslationService i18n,
+	    final WorkspaceSkeleton ws) {
 	super(i18n.t("Tags"), true);
+	super.setBorderStylePrimaryName("k-dropdownouter-tags");
 	this.i18n = i18n;
 	setHeaderTitle(i18n.t("Keywords or terms associated with this group"));
 	this.presenter = presenter;

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java	2008-07-20 01:51:06 UTC (rev 803)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java	2008-07-20 14:38:06 UTC (rev 804)
@@ -5,6 +5,7 @@
 import com.google.gwt.user.client.ui.Widget;
 import com.gwtext.client.widgets.Panel;
 import com.gwtext.client.widgets.Toolbar;
+import com.gwtext.client.widgets.event.ContainerListener;
 
 public class EntitySummary {
     private final Panel entityTools;
@@ -37,6 +38,10 @@
 	mainPanel.doLayoutIfNeeded();
     }
 
+    public void addListener(final ContainerListener listener) {
+	entitySummary.addListener(listener);
+    }
+
     public Panel getPanel() {
 	return mainPanel.getPanel();
     }




More information about the kune-commits mailing list