[kune-commits] r1318 - in trunk/src/main/java/cc/kune: chat/client chat/client/snd core/client/state core/public docs/client docs/client/viewers

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Mon Apr 25 19:07:00 CEST 2011


Author: vjrj_
Date: 2011-04-25 19:07:00 +0200 (Mon, 25 Apr 2011)
New Revision: 1318

Added:
   trunk/src/main/java/cc/kune/chat/client/snd/SndClickEvent.java
   trunk/src/main/java/cc/kune/docs/client/viewers/AbstractFolderViewerPanel.java
   trunk/src/main/java/cc/kune/docs/client/viewers/FolderItemWidget.java
   trunk/src/main/java/cc/kune/docs/client/viewers/FolderItemWidget.ui.xml
   trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsFlowPanel.java
   trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsFlowPanel.ui.xml
   trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsTablePanel.java
   trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsTablePanel.ui.xml
Removed:
   trunk/src/main/java/cc/kune/chat/client/snd/ClickEvent.java
   trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPanel.java
   trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPanel.ui.xml
Modified:
   trunk/src/main/java/cc/kune/chat/client/KuneUnattendedPresenter.java
   trunk/src/main/java/cc/kune/chat/client/snd/KuneSoundManager.java
   trunk/src/main/java/cc/kune/core/client/state/ContentCacheDefault.java
   trunk/src/main/java/cc/kune/core/public/ws.css
   trunk/src/main/java/cc/kune/docs/client/DocsGinModule.java
   trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPresenter.java
Log:
FolderViewer as Table

Modified: trunk/src/main/java/cc/kune/chat/client/KuneUnattendedPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/KuneUnattendedPresenter.java	2011-04-18 17:25:02 UTC (rev 1317)
+++ trunk/src/main/java/cc/kune/chat/client/KuneUnattendedPresenter.java	2011-04-25 17:07:00 UTC (rev 1318)
@@ -20,7 +20,7 @@
 package cc.kune.chat.client;
 
 import cc.kune.chat.client.ChatClientDefault.ChatClientAction;
-import cc.kune.chat.client.snd.ClickEvent;
+import cc.kune.chat.client.snd.SndClickEvent;
 
 import com.calclab.hablar.core.client.mvp.HablarEventBus;
 import com.calclab.hablar.signals.client.SignalPreferences;
@@ -45,7 +45,7 @@
                 final int unattendedChatsCount = unattendedManager.getSize();
                 if (unattendedChatsCount > 0 && active == false) {
                     active = true;
-                    ClickEvent.fire(eventBus);
+                    SndClickEvent.fire(eventBus);
                     action.setBlink(true);
 
                 } else if (unattendedChatsCount == 0 && active == true) {

Deleted: trunk/src/main/java/cc/kune/chat/client/snd/ClickEvent.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/snd/ClickEvent.java	2011-04-18 17:25:02 UTC (rev 1317)
+++ trunk/src/main/java/cc/kune/chat/client/snd/ClickEvent.java	2011-04-25 17:07:00 UTC (rev 1318)
@@ -1,58 +0,0 @@
-package cc.kune.chat.client.snd;
-
-import com.google.gwt.event.shared.EventHandler;
-import com.google.gwt.event.shared.GwtEvent;
-import com.google.gwt.event.shared.HandlerRegistration;
-
-import com.google.gwt.event.shared.HasHandlers;
-
-public class ClickEvent extends GwtEvent<ClickEvent.ClickHandler> { 
-
-  public interface HasClickHandlers extends HasHandlers {
-    HandlerRegistration addClickHandler(ClickHandler handler);
-  }
-
-  public interface ClickHandler extends EventHandler {
-    public void onClick(ClickEvent event);
-  }
-
-  private static final Type<ClickHandler> TYPE = new Type<ClickHandler>();
-
-  public static void fire(HasHandlers source) {
-    source.fireEvent(new ClickEvent());
-  }
-
-  public static Type<ClickHandler> getType() {
-    return TYPE;
-  }
-
-
-  public ClickEvent() {
-  }
-
-  @Override
-  public Type<ClickHandler> getAssociatedType() {
-    return TYPE;
-  }
-
-  @Override
-  protected void dispatch(ClickHandler handler) {
-    handler.onClick(this);
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    return super.equals(obj);
-  }
-
-  @Override
-  public int hashCode() {
-    return super.hashCode();
-  }
-
-  @Override
-  public String toString() {
-    return "ClickEvent["
-    + "]";
-  }
-}

Modified: trunk/src/main/java/cc/kune/chat/client/snd/KuneSoundManager.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/snd/KuneSoundManager.java	2011-04-18 17:25:02 UTC (rev 1317)
+++ trunk/src/main/java/cc/kune/chat/client/snd/KuneSoundManager.java	2011-04-25 17:07:00 UTC (rev 1318)
@@ -10,9 +10,9 @@
 
     public KuneSoundManager(final EventBus eventBus, final SoundSignalsConfig soundConfig) {
         this.soundConfig = soundConfig;
-        eventBus.addHandler(ClickEvent.getType(), new ClickEvent.ClickHandler() {
+        eventBus.addHandler(SndClickEvent.getType(), new SndClickEvent.SndClickHandler() {
             @Override
-            public void onClick(final ClickEvent event) {
+            public void onClick(final SndClickEvent event) {
                 createSoundManagerIfNeeded();
                 soundManager.play();
             }

Copied: trunk/src/main/java/cc/kune/chat/client/snd/SndClickEvent.java (from rev 1313, trunk/src/main/java/cc/kune/chat/client/snd/ClickEvent.java)
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/snd/SndClickEvent.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/chat/client/snd/SndClickEvent.java	2011-04-25 17:07:00 UTC (rev 1318)
@@ -0,0 +1,55 @@
+package cc.kune.chat.client.snd;
+
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+public class SndClickEvent extends GwtEvent<SndClickEvent.SndClickHandler> {
+
+    public interface HasClickHandlers extends HasHandlers {
+        HandlerRegistration addSndClickHandler(SndClickHandler handler);
+    }
+
+    public interface SndClickHandler extends EventHandler {
+        public void onClick(SndClickEvent event);
+    }
+
+    private static final Type<SndClickHandler> TYPE = new Type<SndClickHandler>();
+
+    public static void fire(final HasHandlers source) {
+        source.fireEvent(new SndClickEvent());
+    }
+
+    public static Type<SndClickHandler> getType() {
+        return TYPE;
+    }
+
+    public SndClickEvent() {
+    }
+
+    @Override
+    protected void dispatch(final SndClickHandler handler) {
+        handler.onClick(this);
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        return super.equals(obj);
+    }
+
+    @Override
+    public Type<SndClickHandler> getAssociatedType() {
+        return TYPE;
+    }
+
+    @Override
+    public int hashCode() {
+        return super.hashCode();
+    }
+
+    @Override
+    public String toString() {
+        return "SndClickEvent[" + "]";
+    }
+}

Modified: trunk/src/main/java/cc/kune/core/client/state/ContentCacheDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/ContentCacheDefault.java	2011-04-18 17:25:02 UTC (rev 1317)
+++ trunk/src/main/java/cc/kune/core/client/state/ContentCacheDefault.java	2011-04-25 17:07:00 UTC (rev 1318)
@@ -42,7 +42,7 @@
         this.server = server;
         this.eventBus = eventBus;
         this.cacheMap = new HashMap<StateToken, StateAbstractDTO>();
-        useCache = false;
+        useCache = true;
     }
 
     @Override

Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css	2011-04-18 17:25:02 UTC (rev 1317)
+++ trunk/src/main/java/cc/kune/core/public/ws.css	2011-04-25 17:07:00 UTC (rev 1318)
@@ -844,7 +844,7 @@
     white-space: nowrap;
 }
 */
-.k-sn-mainpanel .x-btn button,.k-sn-mainpanel button, button.k-button {
+.k-sn-mainpanel .x-btn button,.k-sn-mainpanel button,button.k-button {
     font: 13px 'Ubuntu', arial;
     border: 2px solid #CCCCCC;
     cursor: pointer;
@@ -867,13 +867,14 @@
     padding-left: 25px !important; */
 }
 
-.k-sn-mainpanel .x-btn button:hover,.k-sn-mainpanel button:hover, .k-button button:hover {
+.k-sn-mainpanel .x-btn button:hover,.k-sn-mainpanel button:hover,.k-button button:hover
+    {
     border: 2px orange solid;
     background: #f0f0f0;
     color: #855585;
 }
 
-.k-sn-mainpanel .x-btn button:active,.k-sn-mainpanel button:active, .k-button
+.k-sn-mainpanel .x-btn button:active,.k-sn-mainpanel button:active,.k-button
      button:active {
     border-top-color: #ffffff;
     background: #ffffff;
@@ -1107,4 +1108,4 @@
 
 .k-def-docbtn span {
     font-size: 13px !important;
-}
\ No newline at end of file
+}

Modified: trunk/src/main/java/cc/kune/docs/client/DocsGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/DocsGinModule.java	2011-04-18 17:25:02 UTC (rev 1317)
+++ trunk/src/main/java/cc/kune/docs/client/DocsGinModule.java	2011-04-25 17:07:00 UTC (rev 1318)
@@ -3,7 +3,7 @@
 import cc.kune.docs.client.actions.DocsClientActions;
 import cc.kune.docs.client.viewers.DocViewerPanel;
 import cc.kune.docs.client.viewers.DocViewerPresenter;
-import cc.kune.docs.client.viewers.FolderViewerPanel;
+import cc.kune.docs.client.viewers.FolderViewerAsTablePanel;
 import cc.kune.docs.client.viewers.FolderViewerPresenter;
 
 import com.google.inject.Singleton;
@@ -18,7 +18,7 @@
         bindPresenter(DocViewerPresenter.class, DocViewerPresenter.DocViewerView.class, DocViewerPanel.class,
                 DocViewerPresenter.DocViewerProxy.class);
         bindPresenter(FolderViewerPresenter.class, FolderViewerPresenter.FolderViewerView.class,
-                FolderViewerPanel.class, FolderViewerPresenter.FolderViewerProxy.class);
+                FolderViewerAsTablePanel.class, FolderViewerPresenter.FolderViewerProxy.class);
     }
 
 }

Added: trunk/src/main/java/cc/kune/docs/client/viewers/AbstractFolderViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/viewers/AbstractFolderViewerPanel.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/docs/client/viewers/AbstractFolderViewerPanel.java	2011-04-25 17:07:00 UTC (rev 1318)
@@ -0,0 +1,55 @@
+package cc.kune.docs.client.viewers;
+
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
+import cc.kune.common.client.ui.UiUtils;
+import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.docs.client.viewers.FolderViewerPresenter.FolderViewerView;
+import cc.kune.gspace.client.GSpaceArmor;
+
+import com.google.gwt.user.client.ui.InlineLabel;
+import com.google.gwt.user.client.ui.InsertPanel.ForIsWidget;
+import com.google.gwt.user.client.ui.Widget;
+import com.gwtplatform.mvp.client.ViewImpl;
+
+public abstract class AbstractFolderViewerPanel extends ViewImpl implements FolderViewerView {
+    protected final GSpaceArmor gsArmor;
+    protected Widget widget;
+
+    public AbstractFolderViewerPanel(final GSpaceArmor gsArmor) {
+        this.gsArmor = gsArmor;
+    }
+
+    @Override
+    public Widget asWidget() {
+        return widget;
+    }
+
+    @Override
+    public void attach() {
+        final ForIsWidget docContainer = gsArmor.getDocContainer();
+        docContainer.add(widget);
+    }
+
+    @Override
+    public void clear() {
+        gsArmor.getSubheaderToolbar().clear();
+        UiUtils.clear(gsArmor.getDocContainer());
+        UiUtils.clear(gsArmor.getDocHeader());
+    }
+
+    @Override
+    public void detach() {
+        clear();
+    }
+
+    @Override
+    public void setActions(final GuiActionDescCollection actions) {
+        gsArmor.getSubheaderToolbar().clear();
+        gsArmor.getSubheaderToolbar().addAll(actions);
+    }
+
+    @Override
+    public void setContainer(final StateContainerDTO state) {
+        gsArmor.getDocHeader().add(new InlineLabel(state.getTitle()));
+    }
+}


Property changes on: trunk/src/main/java/cc/kune/docs/client/viewers/AbstractFolderViewerPanel.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/src/main/java/cc/kune/docs/client/viewers/FolderItemWidget.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/viewers/FolderItemWidget.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/docs/client/viewers/FolderItemWidget.java	2011-04-25 17:07:00 UTC (rev 1318)
@@ -0,0 +1,116 @@
+package cc.kune.docs.client.viewers;
+
+import cc.kune.common.client.actions.ui.ActionSimplePanel;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.HasAllFocusHandlers;
+import com.google.gwt.event.dom.client.HasAllMouseHandlers;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.event.dom.client.HasDoubleClickHandlers;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiHandler;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.FocusPanel;
+import com.google.gwt.user.client.ui.HasText;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.InlineLabel;
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.gwt.user.client.ui.Widget;
+
+public class FolderItemWidget extends Composite implements HasText {
+
+    interface FolderItemWidgetUiBinder extends UiBinder<Widget, FolderItemWidget> {
+    }
+
+    private static FolderItemWidgetUiBinder uiBinder = GWT.create(FolderItemWidgetUiBinder.class);
+
+    @UiField
+    FlowPanel flow;
+    @UiField
+    FocusPanel focusPanel;
+    @UiField
+    Image icon;
+    @UiField
+    SimplePanel menu;
+    @UiField
+    InlineLabel title;
+
+    public FolderItemWidget(final ImageResource iconResource, final String title) {
+        initWidget(uiBinder.createAndBindUi(this));
+        this.title.setText(title);
+        icon.setResource(iconResource);
+    }
+
+    private void clearFocusStyles() {
+        focusPanel.removeStyleDependentName("nofocused");
+        focusPanel.removeStyleDependentName("focused");
+    }
+
+    HasClickHandlers getRowClick() {
+        return focusPanel;
+    }
+
+    HasDoubleClickHandlers getRowDoubleClick() {
+        return focusPanel;
+    }
+
+    HasAllFocusHandlers getRowFocus() {
+        return focusPanel;
+    }
+
+    HasAllMouseHandlers getRowMouse() {
+        return focusPanel;
+    }
+
+    @Override
+    public String getText() {
+        return title.getText();
+    }
+
+    @UiHandler("focusPanel")
+    public void onBlur(final BlurEvent event) {
+        clearFocusStyles();
+        focusPanel.addStyleDependentName("nofocused");
+    }
+
+    @UiHandler("focusPanel")
+    public void onFocus(final FocusEvent event) {
+        clearFocusStyles();
+        focusPanel.addStyleDependentName("focused");
+    }
+
+    @UiHandler("focusPanel")
+    public void onOut(final MouseOutEvent event) {
+        clearFocusStyles();
+        focusPanel.addStyleDependentName("nofocused");
+    }
+
+    @UiHandler("focusPanel")
+    public void onOver(final MouseOverEvent event) {
+        clearFocusStyles();
+        focusPanel.addStyleDependentName("focused");
+    }
+
+    public void setMenu(final ActionSimplePanel toolbar) {
+        menu.add(toolbar);
+    }
+
+    public void setSelect(final boolean selected) {
+        clearFocusStyles();
+        focusPanel.removeStyleDependentName(selected ? "noselected" : "selected");
+        focusPanel.addStyleDependentName(selected ? "selected" : "noselected");
+    }
+
+    @Override
+    public void setText(final String text) {
+        title.setText(text);
+    }
+
+}


Property changes on: trunk/src/main/java/cc/kune/docs/client/viewers/FolderItemWidget.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/src/main/java/cc/kune/docs/client/viewers/FolderItemWidget.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/viewers/FolderItemWidget.ui.xml	                        (rev 0)
+++ trunk/src/main/java/cc/kune/docs/client/viewers/FolderItemWidget.ui.xml	2011-04-25 17:07:00 UTC (rev 1318)
@@ -0,0 +1,56 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+  xmlns:co="urn:ui:cc.kune.core.client" xmlns:g="urn:import:com.google.gwt.user.client.ui">
+  <ui:style>
+    @external .k-folderitem-focus;
+    @external .k-folderitem-focus-focused;
+    @external .k-folderitem-focus-selected;
+    @external .k-folderitem-focus-noselected;
+    @external .k-folderitem-focus-nofocused;
+    .k-folderitem-focus {
+        background-color: none;
+    }
+
+    .k-folderitem-focus-focused {
+        background-color: #F2F5FD;
+    }
+
+    .k-folderitem-focus-selected {
+        background-color: #E3E9FF;
+    }
+
+    .k-folderitem-focus-noselected {
+    }
+
+    .k-folderitem-focus-nofocused {
+
+    }
+
+    .flow {
+        cursor: pointer;
+        border-bottom: 1px solid #F3F3F3;
+        line-height: 1.3em;
+        height: 28px;
+    }
+
+    .title {
+        font-size: 16px;
+        margin-left: 5px;
+    }
+
+    .icon {
+        margin: 5px;
+    }
+
+    .menu {
+        float: right;
+    }
+  </ui:style>
+  <g:FocusPanel ui:field="focusPanel" styleName="{style.k-folderitem-focus}">
+    <g:FlowPanel styleName="{style.flow}" ui:field="flow">
+      <g:Image styleName="{style.icon}" ui:field="icon" />
+      <g:InlineLabel styleName="{style.title}" ui:field="title" />
+      <g:SimplePanel styleName="{style.menu}" ui:field="menu" />
+    </g:FlowPanel>
+  </g:FocusPanel>
+</ui:UiBinder>
\ No newline at end of file


Property changes on: trunk/src/main/java/cc/kune/docs/client/viewers/FolderItemWidget.ui.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsFlowPanel.java (from rev 1316, trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPanel.java)
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsFlowPanel.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsFlowPanel.java	2011-04-25 17:07:00 UTC (rev 1318)
@@ -0,0 +1,83 @@
+package cc.kune.docs.client.viewers;
+
+import cc.kune.common.client.actions.gxtui.AbstractGxtMenuGui;
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
+import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
+import cc.kune.common.client.ui.BasicThumb;
+import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.gspace.client.GSpaceArmor;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.DoubleClickHandler;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
+
+public class FolderViewerAsFlowPanel extends AbstractFolderViewerPanel {
+    interface FolderViewerAsFlowPanelUiBinder extends UiBinder<Widget, FolderViewerAsFlowPanel> {
+    }
+    private static FolderViewerAsFlowPanelUiBinder uiBinder = GWT.create(FolderViewerAsFlowPanelUiBinder.class);
+
+    @UiField
+    FlowPanel flow;
+    int ICONLABELMAXSIZE = 20;
+    int ICONSIZE = 100;
+
+    @Inject
+    public FolderViewerAsFlowPanel(final GSpaceArmor gsArmor) {
+        super(gsArmor);
+        widget = uiBinder.createAndBindUi(this);
+    }
+
+    @Override
+    public void addItem(final FolderItemDescriptor item, final ClickHandler clickHandler,
+            final DoubleClickHandler doubleClickHandler) {
+        // In this viewer we don't use the clickHandler from the presenter
+        flow.add(createThumb(item.getText(), item.getIcon(), item.getTooltip(), "", item.getActionCollection(),
+                doubleClickHandler));
+    }
+
+    @Override
+    public void clear() {
+        flow.clear();
+        super.clear();
+    }
+
+    public BasicThumb createThumb(final String text, final Object icon, final String tooltip,
+            final String tooltipTitle, final GuiActionDescCollection menuitems,
+            final DoubleClickHandler doubleClickHandler) {
+        final BasicThumb thumb = new BasicThumb(icon, ICONSIZE, text, ICONLABELMAXSIZE, false);
+        final MenuDescriptor menu = new MenuDescriptor();
+        menu.setStandalone(true);
+        menu.putValue(AbstractGxtMenuGui.MENU_POSITION, AbstractGxtMenuGui.MenuPosition.bl);
+        for (final GuiActionDescrip item : menuitems) {
+            item.setParent(menu);
+        }
+        final ClickHandler clickHand = new ClickHandler() {
+            @Override
+            public void onClick(final ClickEvent event) {
+                menu.show(thumb);
+            }
+        };
+        thumb.addClickHandler(clickHand);
+        thumb.addDoubleClickHandler(doubleClickHandler);
+        gsArmor.getSubheaderToolbar().add(menu);
+        gsArmor.getSubheaderToolbar().addAll(menuitems);
+        thumb.setTooltip(tooltipTitle, tooltip);
+        thumb.setLabelVisible(true);
+        return thumb;
+    }
+
+    @Override
+    public void setContainer(final StateContainerDTO state) {
+        super.setContainer(state);
+        gsArmor.getDocContainer().add(new HTML("<b>Note:</b> This GUI is provisional<br/>"));
+    }
+
+}


Property changes on: trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsFlowPanel.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsFlowPanel.ui.xml (from rev 1315, trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPanel.ui.xml)
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsFlowPanel.ui.xml	                        (rev 0)
+++ trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsFlowPanel.ui.xml	2011-04-25 17:07:00 UTC (rev 1318)
@@ -0,0 +1,8 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+  xmlns:g='urn:import:com.google.gwt.user.client.ui'>
+  <ui:style>
+  </ui:style>
+  <g:FlowPanel ui:field="flow" width="100%" height="100%">
+  </g:FlowPanel>
+</ui:UiBinder>
\ No newline at end of file


Property changes on: trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsFlowPanel.ui.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsTablePanel.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsTablePanel.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsTablePanel.java	2011-04-25 17:07:00 UTC (rev 1318)
@@ -0,0 +1,107 @@
+package cc.kune.docs.client.viewers;
+
+import cc.kune.common.client.actions.ui.ActionSimplePanel;
+import cc.kune.common.client.actions.ui.bind.GuiProvider;
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
+import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.GSpaceArmor;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.DoubleClickHandler;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOutHandler;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.event.dom.client.MouseOverHandler;
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
+
+public class FolderViewerAsTablePanel extends AbstractFolderViewerPanel {
+
+    interface FolderViewerAsTablePanelUiBinder extends UiBinder<Widget, FolderViewerAsTablePanel> {
+    }
+
+    private static FolderViewerAsTablePanelUiBinder uiBinder = GWT.create(FolderViewerAsTablePanelUiBinder.class);
+
+    @UiField
+    FlexTable flex;
+
+    private final GuiProvider guiProvider;
+    private final I18nTranslationService i18n;
+    private final CoreResources res;
+    protected FolderItemWidget selected;
+
+    @Inject
+    public FolderViewerAsTablePanel(final GSpaceArmor gsArmor, final I18nTranslationService i18n,
+            final GuiProvider guiProvider, final CoreResources res) {
+        super(gsArmor);
+        this.i18n = i18n;
+        this.guiProvider = guiProvider;
+        this.res = res;
+        widget = uiBinder.createAndBindUi(this);
+    }
+
+    @Override
+    public void addItem(final FolderItemDescriptor item, final ClickHandler clickHandler,
+            final DoubleClickHandler doubleClickHandler) {
+        final int rowCount = flex.getRowCount();
+        final FolderItemWidget itemWidget = new FolderItemWidget((ImageResource) item.getIcon(), item.getText());
+        final ActionSimplePanel toolbar = new ActionSimplePanel(guiProvider);
+        itemWidget.setMenu(toolbar);
+        // Tooltip.to(itemWidget, item.getTooltip());
+        final MenuDescriptor menu = new MenuDescriptor(i18n.t("Actions"));
+        menu.withIcon(res.arrowdown()).withStyles("k-def-docbtn, k-btn, k-button");
+        menu.setStandalone(false);
+        menu.setVisible(false);
+        toolbar.add(menu);
+        for (final GuiActionDescrip menuItem : item.getActionCollection()) {
+            menuItem.setParent(menu);
+            toolbar.add(menuItem);
+        }
+        itemWidget.getRowClick().addClickHandler(new ClickHandler() {
+            @Override
+            public void onClick(final ClickEvent event) {
+                if (selected != null) {
+                    selected.setSelect(false);
+                }
+                itemWidget.setSelect(true);
+                selected = itemWidget;
+            }
+        });
+        itemWidget.getRowDoubleClick().addDoubleClickHandler(doubleClickHandler);
+        itemWidget.getRowMouse().addMouseOutHandler(new MouseOutHandler() {
+            @Override
+            public void onMouseOut(final MouseOutEvent event) {
+                menu.setVisible(false);
+                // itemWidget.setSelect(false);
+                // menu.hide();
+            }
+        });
+        itemWidget.getRowMouse().addMouseOverHandler(new MouseOverHandler() {
+            @Override
+            public void onMouseOver(final MouseOverEvent event) {
+                menu.setVisible(true);
+            }
+        });
+        flex.setWidget(rowCount + 1, 0, itemWidget);
+    }
+
+    @Override
+    public void clear() {
+        flex.clear();
+        super.clear();
+    }
+
+    @Override
+    public void setContainer(final StateContainerDTO state) {
+        super.setContainer(state);
+    }
+}


Property changes on: trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsTablePanel.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsTablePanel.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsTablePanel.ui.xml	                        (rev 0)
+++ trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsTablePanel.ui.xml	2011-04-25 17:07:00 UTC (rev 1318)
@@ -0,0 +1,8 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+  xmlns:g="urn:import:com.google.gwt.user.client.ui">
+  <ui:style>
+  </ui:style>
+  <g:FlexTable ui:field="flex" width="100%" height="100%">
+  </g:FlexTable>
+</ui:UiBinder>
\ No newline at end of file


Property changes on: trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsTablePanel.ui.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPanel.java	2011-04-18 17:25:02 UTC (rev 1317)
+++ trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPanel.java	2011-04-25 17:07:00 UTC (rev 1318)
@@ -1,115 +0,0 @@
-package cc.kune.docs.client.viewers;
-
-import cc.kune.common.client.actions.gxtui.AbstractGxtMenuGui;
-import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
-import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
-import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
-import cc.kune.common.client.ui.BasicThumb;
-import cc.kune.common.client.ui.UiUtils;
-import cc.kune.core.shared.dto.StateContainerDTO;
-import cc.kune.docs.client.viewers.FolderViewerPresenter.FolderViewerView;
-import cc.kune.gspace.client.GSpaceArmor;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.DoubleClickHandler;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.InlineLabel;
-import com.google.gwt.user.client.ui.InsertPanel.ForIsWidget;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.inject.Inject;
-import com.gwtplatform.mvp.client.ViewImpl;
-
-public class FolderViewerPanel extends ViewImpl implements FolderViewerView {
-    interface FolderViewerPanelUiBinder extends UiBinder<Widget, FolderViewerPanel> {
-    }
-    private static FolderViewerPanelUiBinder uiBinder = GWT.create(FolderViewerPanelUiBinder.class);
-
-    @UiField
-    FlowPanel flow;
-
-    private final GSpaceArmor gsArmor;
-
-    int ICONLABELMAXSIZE = 20;
-    int ICONSIZE = 100;
-    private final Widget widget;
-
-    @Inject
-    public FolderViewerPanel(final GSpaceArmor wsArmor) {
-        this.gsArmor = wsArmor;
-        widget = uiBinder.createAndBindUi(this);
-    }
-
-    @Override
-    public void addItem(final FolderItemDescriptor item, final DoubleClickHandler doubleClickHandler) {
-        flow.add(createThumb(item.getText(), item.getIcon(), item.getTooltip(), "", item.getActionCollection(),
-                doubleClickHandler));
-    }
-
-    @Override
-    public Widget asWidget() {
-        return widget;
-    }
-
-    @Override
-    public void attach() {
-        final ForIsWidget docContainer = gsArmor.getDocContainer();
-        docContainer.add(widget);
-    }
-
-    @Override
-    public void clear() {
-        flow.clear();
-        gsArmor.getSubheaderToolbar().clear();
-        UiUtils.clear(gsArmor.getDocContainer());
-        UiUtils.clear(gsArmor.getDocHeader());
-    }
-
-    public BasicThumb createThumb(final String text, final Object icon, final String tooltip,
-            final String tooltipTitle, final GuiActionDescCollection menuitems,
-            final DoubleClickHandler doubleClickHandler) {
-        final BasicThumb thumb = new BasicThumb(icon, ICONSIZE, text, ICONLABELMAXSIZE, false);
-        final MenuDescriptor menu = new MenuDescriptor();
-        menu.setStandalone(true);
-        menu.putValue(AbstractGxtMenuGui.MENU_POSITION, AbstractGxtMenuGui.MenuPosition.bl);
-        for (final GuiActionDescrip item : menuitems) {
-            item.setParent(menu);
-        }
-        final ClickHandler clickHand = new ClickHandler() {
-            @Override
-            public void onClick(final ClickEvent event) {
-                menu.show(thumb);
-            }
-        };
-
-        thumb.addClickHandler(clickHand);
-        thumb.addDoubleClickHandler(doubleClickHandler);
-        gsArmor.getSubheaderToolbar().add(menu);
-        gsArmor.getSubheaderToolbar().addAll(menuitems);
-        thumb.setTooltip(tooltipTitle, tooltip);
-        thumb.setLabelVisible(true);
-        return thumb;
-    }
-
-    @Override
-    public void detach() {
-        clear();
-    }
-
-    @Override
-    public void setActions(final GuiActionDescCollection actions) {
-        gsArmor.getSubheaderToolbar().clear();
-        gsArmor.getSubheaderToolbar().addAll(actions);
-    }
-
-    @Override
-    public void setContainer(final StateContainerDTO state) {
-        gsArmor.getDocContainer().add(new HTML("<b>Note:</b> This GUI is provisional<br/>"));
-        gsArmor.getDocHeader().add(new InlineLabel(state.getTitle()));
-    }
-
-}

Deleted: trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPanel.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPanel.ui.xml	2011-04-18 17:25:02 UTC (rev 1317)
+++ trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPanel.ui.xml	2011-04-25 17:07:00 UTC (rev 1318)
@@ -1,20 +0,0 @@
-<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
-<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
-  xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:f='urn:import:org.waveprotocol.box.webclient.widget.frame'
-  xmlns:w='urn:import:org.waveprotocol.wave.client.widget.common'>
-  <ui:style>
-    .wavePanel {
-        margin: 0 0 0 0;
-    }
-
-    .waveHolder {
-        position: absolute;
-        top: 0;
-        bottom: 0;
-        left: 0;
-        right: 0;
-    }
-  </ui:style>
-  <g:FlowPanel ui:field="flow" width="100%" height="100%">
-  </g:FlowPanel>
-</ui:UiBinder>
\ No newline at end of file

Modified: trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPresenter.java	2011-04-18 17:25:02 UTC (rev 1317)
+++ trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPresenter.java	2011-04-25 17:07:00 UTC (rev 1318)
@@ -28,6 +28,8 @@
 import cc.kune.gspace.client.tool.ContentViewer;
 import cc.kune.gspace.client.tool.ContentViewerSelector;
 
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.event.dom.client.DoubleClickEvent;
 import com.google.gwt.event.dom.client.DoubleClickHandler;
 import com.google.gwt.event.shared.EventBus;
@@ -49,7 +51,7 @@
 
     public interface FolderViewerView extends View {
 
-        void addItem(FolderItemDescriptor item, DoubleClickHandler handler);
+        void addItem(FolderItemDescriptor item, ClickHandler clickHandler, DoubleClickHandler doubleClickHandler);
 
         void attach();
 
@@ -103,8 +105,13 @@
             // Don't show
             NotifyUser.info("Deleted, don't show");
         } else {
-            getView().addItem(item, new DoubleClickHandler() {
+            getView().addItem(item, new ClickHandler() {
                 @Override
+                public void onClick(final ClickEvent event) {
+                    stateManager.gotoStateToken(stateToken);
+                }
+            }, new DoubleClickHandler() {
+                @Override
                 public void onDoubleClick(final DoubleClickEvent event) {
                     stateManager.gotoStateToken(stateToken);
                 }
@@ -121,15 +128,17 @@
         if (container.getContents().size() + container.getChilds().size() == 0) {
             // FIXME
         } else {
-            for (final ContentSimpleDTO content : container.getContents()) {
-                addItem(content.getTitle(), content.getTypeId(), content.getMimeType(), content.getStatus(),
-                        content.getStateToken(), content.getStateToken().copy().clearDocument(), content.getRights());
-            }
+            // Folders
             for (final ContainerSimpleDTO childFolder : container.getChilds()) {
                 addItem(childFolder.getName(), childFolder.getTypeId(), null, ContentStatus.publishedOnline,
                         childFolder.getStateToken(),
                         childFolder.getStateToken().copy().setFolder(childFolder.getParentFolderId()), containerRights);
             }
+            // Other contents (docs, etc)
+            for (final ContentSimpleDTO content : container.getContents()) {
+                addItem(content.getTitle(), content.getTypeId(), content.getMimeType(), content.getStatus(),
+                        content.getStateToken(), content.getStateToken().copy().clearDocument(), content.getRights());
+            }
         }
     }
 
@@ -155,7 +164,7 @@
             // Used for previews
             return null;
         } else {
-            return null; // i18n.t("Double click to open");
+            return i18n.t("Double click to open");
         }
     }
 




More information about the kune-commits mailing list