[kune-commits] r955 - in trunk: . src/main/java/org/ourproject/kune/docs/client/cnt src/main/java/org/ourproject/kune/docs/client/ctx src/main/java/org/ourproject/kune/workspace/client/cxt src/main/java/org/ourproject/kune/workspace/client/editor src/main/java/org/ourproject/kune/workspace/client/skel

vjrj vjrj at ourproject.org
Tue Nov 18 13:05:53 CET 2008


Author: vjrj
Date: 2008-11-18 13:05:52 +0100 (Tue, 18 Nov 2008)
New Revision: 955

Added:
   trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/AbstractContextPropEditor.java
Modified:
   trunk/pom.xml
   trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentViewerPresenter.java
   trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocContextPropEditor.java
   trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/AbstractContextPropEditorPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntityWorkspace.java
Log:
Incomplete - task UI tools & workspace refactorization 

Complete - task Editor height not resized 

Incomplete - task New Register of type_id and capabilities 


Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml	2008-11-17 10:27:04 UTC (rev 954)
+++ trunk/pom.xml	2008-11-18 12:05:52 UTC (rev 955)
@@ -379,8 +379,8 @@
         <version>2.0-beta23</version>
         <configuration>
           <logLevel>INFO</logLevel>
-          <style>OBF</style>
-          <!-- <style>PRETTY</style> -->
+          <style>PRETTY</style>
+          <!-- <style>OBF</style> -->
           <runTarget>
             org.ourproject.kune.app.Kune/Kune.html
           </runTarget>

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentViewerPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentViewerPresenter.java	2008-11-17 10:27:04 UTC (rev 954)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentViewerPresenter.java	2008-11-18 12:05:52 UTC (rev 955)
@@ -57,24 +57,30 @@
     @Override
     protected void setState(StateContentDTO state) {
         super.setState(state);
+        setContent(state, DocumentClientTool.TYPE_UPLOADEDFILE);
+    }
+
+    private void setContent(StateContentDTO state, String uploadedfileType) {
         String typeId = state.getTypeId();
-        String text = state.getContent();
+        String contentBody = state.getContent();
         StateToken token = state.getStateToken();
         BasicMimeTypeDTO mimeType = state.getMimeType();
-        if (typeId.equals(DocumentClientTool.TYPE_UPLOADEDFILE)) {
+        if (typeId.equals(uploadedfileType)) {
             if (mimeType != null) {
                 FileDownloadUtils fileDownloadUtils = downloadProvider.get();
                 if (mimeType.getType().equals("image")) {
                     view.showImage(fileDownloadUtils.getImageUrl(token), fileDownloadUtils.getImageResizedUrl(token,
                             ImageSize.sized));
                 } else if (mimeType.toString().equals("text/plain") || mimeType.toString().equals("application/pdf")) {
-                    view.setContent(text);
+                    view.setContent(contentBody);
                 } else {
                     view.setContent("");
                 }
+            } else {
+                view.setContent("");
             }
         } else {
-            view.setContent(text);
+            view.setContent(contentBody);
         }
         view.attach();
     }

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocContextPropEditor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocContextPropEditor.java	2008-11-17 10:27:04 UTC (rev 954)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocContextPropEditor.java	2008-11-18 12:05:52 UTC (rev 955)
@@ -19,14 +19,8 @@
  */
 package org.ourproject.kune.docs.client.ctx;
 
-import org.ourproject.kune.platf.client.dto.StateContentDTO;
+import org.ourproject.kune.workspace.client.cxt.AbstractContextPropEditor;
 
-public interface DocContextPropEditor {
-    void attach();
 
-    void clear();
-
-    void detach();
-
-    void setState(StateContentDTO content);
+public interface DocContextPropEditor extends AbstractContextPropEditor {
 }

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java	2008-11-17 10:27:04 UTC (rev 954)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java	2008-11-18 12:05:52 UTC (rev 955)
@@ -29,27 +29,27 @@
 import com.calclab.suco.client.ioc.Provider;
 
 public class DocumentContextPresenter extends FoldableContextPresenter implements DocumentContext {
-    private final Provider<DocContextPropEditor> adminContextProvider;
+    private final Provider<DocContextPropEditor> contextPropEditorProvider;
 
     public DocumentContextPresenter(final StateManager stateManager,
             final Provider<ContextNavigator> contextNavigatorProvider,
-            final Provider<DocContextPropEditor> adminContextProvider) {
+            final Provider<DocContextPropEditor> contextPropEditorProvider) {
         super(DocumentClientTool.NAME, stateManager, contextNavigatorProvider);
-        this.adminContextProvider = adminContextProvider;
+        this.contextPropEditorProvider = contextPropEditorProvider;
     }
 
     @Override
     protected void detach() {
         super.detach();
-        adminContextProvider.get().detach();
-        adminContextProvider.get().clear();
+        contextPropEditorProvider.get().detach();
+        contextPropEditorProvider.get().clear();
     }
 
     @Override
     protected void setState(final StateContainerDTO state) {
         super.setState(state);
         if (state instanceof StateContentDTO) {
-            adminContextProvider.get().setState((StateContentDTO) state);
+            contextPropEditorProvider.get().setState((StateContentDTO) state);
         }
     }
 }

Added: trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/AbstractContextPropEditor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/AbstractContextPropEditor.java	2008-11-17 10:27:04 UTC (rev 954)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/AbstractContextPropEditor.java	2008-11-18 12:05:52 UTC (rev 955)
@@ -0,0 +1,32 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.workspace.client.cxt;
+
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
+
+public interface AbstractContextPropEditor {
+    void attach();
+
+    void clear();
+
+    void detach();
+
+    void setState(StateContentDTO content);
+}

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/AbstractContextPropEditorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/AbstractContextPropEditorPanel.java	2008-11-17 10:27:04 UTC (rev 954)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/AbstractContextPropEditorPanel.java	2008-11-18 12:05:52 UTC (rev 955)
@@ -131,7 +131,9 @@
     }
 
     public void reset() {
-        tagsField.reset();
+        if (tagsField != null) {
+            tagsField.reset();
+        }
     }
 
     public void setAccessLists(final AccessListsDTO accessLists) {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java	2008-11-17 10:27:04 UTC (rev 954)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java	2008-11-18 12:05:52 UTC (rev 955)
@@ -54,6 +54,7 @@
 
         gwtRTarea = new RichTextArea();
         gwtRTarea.setWidth("97%");
+        gwtRTarea.setHeight("100%");
         gwtRTarea.addStyleName("kune-TexEditorPanel-TextArea");
         gwtRTarea.ensureDebugId(TEXT_AREA);
 
@@ -66,6 +67,7 @@
         mainPanel.add(editorTopBar.getPanel());
         mainPanel.add(gwtRTarea);
 
+        adjustSize(ws.getEntityWorkspace().getContentHeight());
         ws.getEntityWorkspace().addContentListener(new ContainerListenerAdapter() {
             @Override
             public void onResize(final BoxComponent component, final int adjWidth, final int adjHeight,
@@ -143,6 +145,8 @@
     }
 
     private void adjustSize(final int height) {
-        gwtRTarea.setHeight("" + (height - WorkspaceSkeleton.DEF_TOOLBAR_HEIGHT - WorkspaceSkeleton.DEF_TOOLBAR_HEIGHT));
+        int newHeight = height - WorkspaceSkeleton.DEF_TOOLBAR_HEIGHT - 27;
+        gwtRTarea.setHeight("" + newHeight);
+        mainPanel.setCellHeight(gwtRTarea, "" + newHeight);
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntityWorkspace.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntityWorkspace.java	2008-11-17 10:27:04 UTC (rev 954)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntityWorkspace.java	2008-11-18 12:05:52 UTC (rev 955)
@@ -25,6 +25,7 @@
 import com.gwtext.client.core.RegionPosition;
 import com.gwtext.client.widgets.Panel;
 import com.gwtext.client.widgets.event.ContainerListener;
+import com.gwtext.client.widgets.event.ContainerListenerAdapter;
 import com.gwtext.client.widgets.layout.AnchorLayout;
 import com.gwtext.client.widgets.layout.AnchorLayoutData;
 import com.gwtext.client.widgets.layout.BorderLayout;
@@ -148,6 +149,10 @@
         context.addListener(listener);
     }
 
+    public void addListener(ContainerListenerAdapter containerListenerAdapter) {
+        cntCtxBorderLayout.addListener(containerListenerAdapter);
+    }
+
     public SimpleToolbar getBottomTitle() {
         return bottom;
     }
@@ -156,6 +161,10 @@
         return contentBottomBar;
     }
 
+    public int getContentHeight() {
+        return content.getHeight();
+    }
+
     public Toolbar getContentTopBar() {
         return contentTopBar;
     }
@@ -168,6 +177,10 @@
         return contextTopBar;
     }
 
+    public int getHeight() {
+        return cntCtxBorderLayout.getHeight();
+    }
+
     public Panel getPanel() {
         return mainFitPanel;
     }




More information about the kune-commits mailing list