[kune-commits] r795 - in trunk/src/main/java/org/ourproject/kune: app/public/css chat/client platf/client/app platf/client/services workspace/client/ui/newtmp workspace/client/ui/newtmp/skel workspace/client/ui/newtmp/themes workspace/client/workspace/ui

vjrj vjrj at ourproject.org
Thu Jul 10 04:28:33 CEST 2008


Author: vjrj
Date: 2008-07-10 04:28:27 +0200 (Thu, 10 Jul 2008)
New Revision: 795

Modified:
   trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
   trunk/src/main/java/org/ourproject/kune/chat/client/ChatFactory.java
   trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationBuilder.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/WorkspaceManager.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/Entity.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntityWorkspace.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/WorkspaceSkeleton.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/WsThemePanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/WsThemePresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogo.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogoPanel.java
Log:
Better theme support


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-09 23:43:14 UTC (rev 794)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css	2008-07-10 02:28:27 UTC (rev 795)
@@ -14,7 +14,7 @@
 .k-EntityTextLogo {
     border: 2px solid #F2F2F2;
     height: 60px;
-    margin-bottom: 4px;
+    margin: 0 0 4px -1px;
     overflow: hidden;
     width: 468px;
 }

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatFactory.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatFactory.java	2008-07-09 23:43:14 UTC (rev 794)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatFactory.java	2008-07-10 02:28:27 UTC (rev 795)
@@ -47,39 +47,39 @@
     private static I18nTranslationService i18n;
 
     public static ChatContent createChatContent(final EmiteUIDialog emiteUIDialog, final I18nTranslationService i18n) {
-        ChatFactory.i18n = i18n;
-        WorkspaceDeckPanel panel = new WorkspaceDeckPanel();
-        ChatContentPresenter presenter = new ChatContentPresenter(emiteUIDialog, panel);
-        return presenter;
+	ChatFactory.i18n = i18n;
+	final WorkspaceDeckPanel panel = new WorkspaceDeckPanel();
+	final ChatContentPresenter presenter = new ChatContentPresenter(emiteUIDialog, panel);
+	return presenter;
     }
 
     public static ChatContext createChatContext() {
-        WorkspaceDeckPanel panel = new WorkspaceDeckPanel();
-        ChatContextPresenter presenter = new ChatContextPresenter(panel);
-        return presenter;
+	final WorkspaceDeckPanel panel = new WorkspaceDeckPanel();
+	final ChatContextPresenter presenter = new ChatContextPresenter(panel);
+	return presenter;
     }
 
     public static ChatInfo createChatInfo(final ChatRoomListener listener) {
-        ChatInfoPanel panel = new ChatInfoPanel(listener);
-        return panel;
+	final ChatInfoPanel panel = new ChatInfoPanel(listener);
+	return panel;
     }
 
     public static ChatRoomControl createChatRoomControlViewer(final ChatRoomListener listener) {
-        ChatRoomControlPanel panel = new ChatRoomControlPanel(listener, i18n);
-        ChatRoomControlPresenter presenter = new ChatRoomControlPresenter(panel);
-        return presenter;
+	final ChatRoomControlPanel panel = new ChatRoomControlPanel(listener, i18n);
+	final ChatRoomControlPresenter presenter = new ChatRoomControlPresenter(panel);
+	return presenter;
     }
 
     public static ChatRoom createChatRoomViewer(final ChatRoomListener listener) {
-        ChatRoomPanel panel = new ChatRoomPanel();
-        ChatRoomPresenter presenter = new ChatRoomPresenter(panel);
-        return presenter;
+	final ChatRoomPanel panel = new ChatRoomPanel();
+	final ChatRoomPresenter presenter = new ChatRoomPresenter(panel);
+	return presenter;
     }
 
     public static RoomsAdmin createRoomsAdmin() {
-        ContextItems contextItems = WorkspaceFactory.createContextItems();
-        RoomsAdminPresenter presenter = new RoomsAdminPresenter(contextItems, i18n);
-        return presenter;
+	final ContextItems contextItems = WorkspaceFactory.createContextItems();
+	final RoomsAdminPresenter presenter = new RoomsAdminPresenter(contextItems, i18n);
+	return presenter;
     }
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationBuilder.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationBuilder.java	2008-07-09 23:43:14 UTC (rev 794)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationBuilder.java	2008-07-10 02:28:27 UTC (rev 795)
@@ -38,9 +38,9 @@
 import org.ourproject.kune.workspace.client.WorkspaceClientModule;
 import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
 import org.ourproject.kune.workspace.client.sitebar.Site;
-import org.ourproject.kune.workspace.client.ui.newtmp.WorkspaceManager;
 import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
 import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
 
 import com.calclab.emiteuimodule.client.EmiteUIModule;
 import com.google.gwt.user.client.Window;
@@ -67,26 +67,12 @@
 	final I18nUITranslationService i18n = kune.getI18N();
 
 	// Temporary new ws
-	final WorkspaceManager wmanager = kune.getInstance(WorkspaceManager.class);
+	final WsThemePresenter wstheme = kune.getInstance(WsThemePresenter.class);
 	final WorkspaceSkeleton ws = kune.getInstance(WorkspaceSkeleton.class);
-	// final com.gwtext.client.widgets.Window dialog = new
-	// com.gwtext.client.widgets.Window("gwt-ext new ws 3", 640,
-	// 480);
-	// final Panel panel = new Panel();
-	// panel.setPaddings(5);
-	// panel.setLayout(new FitLayout());
-	// panel.add(((WorkspaceSkeleton) wsmanager.getView()).getPanel());
-	// new Viewport(panel);
-	// wsnew.getPanel().setWidth(640);
-	// wsnew.getPanel().setHeight(460);
-	// panel.setWidth(640);
-	// panel.setHeight(460);
-	// dialog.add(panel);
-	// dialog.show();
-	ws.setTheme(WsTheme.def);
+
+	wstheme.setTheme(WsTheme.def);
 	ws.show();
 	ws.getEntityWorkspace().getContentTopBar().add(new Label("Sorry, kune workspace under heavy refactorization"));
-	wmanager.setTheme(WsTheme.def);
 
 	// Testing providers:
 	platform.install(new PlatformClientModule(session, kune.getProvider(StateManager.class)));

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java	2008-07-09 23:43:14 UTC (rev 794)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java	2008-07-10 02:28:27 UTC (rev 795)
@@ -131,7 +131,7 @@
 	builder.registerProvider(WsThemePresenter.class, new Provider<WsThemePresenter>() {
 	    public WsThemePresenter get() {
 		final WsThemePresenter presenter = new WsThemePresenter();
-		final WsThemePanel panel = new WsThemePanel(ws);
+		final WsThemePanel panel = new WsThemePanel(ws, presenter);
 		presenter.init(panel);
 		return presenter;
 	    }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/WorkspaceManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/WorkspaceManager.java	2008-07-09 23:43:14 UTC (rev 794)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/WorkspaceManager.java	2008-07-10 02:28:27 UTC (rev 795)
@@ -9,6 +9,8 @@
 import org.ourproject.kune.workspace.client.ui.newtmp.title.EntityTitlePresenter;
 import org.ourproject.kune.workspace.client.workspace.ui.EntityLogo;
 
+import com.calclab.suco.client.signal.Slot2;
+
 public class WorkspaceManager {
 
     private final EntityLogo entityLogo;
@@ -23,8 +25,13 @@
 	this.entityLogo = entityLogo;
 	this.entityTitlePresenter = entityTitlePresenter;
 	this.entitySubTitlePresenter = entitySubTitlePresenter;
+	this.entityLicensePresenter = entityLicensePresenter;
 	this.wsThemePresenter = wsThemePresenter;
-	this.entityLicensePresenter = entityLicensePresenter;
+	wsThemePresenter.onThemeChanged(new Slot2<WsTheme, WsTheme>() {
+	    public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) {
+		entityLogo.setTheme(oldTheme, newTheme);
+	    }
+	});
     }
 
     public void setState(final StateDTO state) {
@@ -40,6 +47,5 @@
     }
 
     public void setTheme(final WsTheme theme) {
-	entityLogo.setTheme(theme);
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/Entity.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/Entity.java	2008-07-09 23:43:14 UTC (rev 794)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/Entity.java	2008-07-10 02:28:27 UTC (rev 795)
@@ -33,8 +33,11 @@
 	return entityWorkspace;
     }
 
-    public void setTheme(final WsTheme theme) {
-	super.setCls("k-entity-" + theme);
-	entityWorkspace.setTheme(theme);
+    public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
+	if (oldTheme != null) {
+	    super.removeStyle("k-entity-" + oldTheme);
+	}
+	super.addStyle("k-entity-" + newTheme);
+	entityWorkspace.setTheme(oldTheme, newTheme);
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntityWorkspace.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntityWorkspace.java	2008-07-09 23:43:14 UTC (rev 794)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntityWorkspace.java	2008-07-10 02:28:27 UTC (rev 795)
@@ -23,7 +23,6 @@
     private final RoundedPanel roundedTitle;
     private final RoundedPanel roundedBottom;
     private final DefaultBorderLayout containerWrap;
-    private WsTheme previousTheme;
 
     public EntityWorkspace() {
 	final Panel titles = new Panel();
@@ -120,23 +119,22 @@
 	setPanel(content, (Widget) view);
     }
 
-    public void setTheme(final WsTheme theme) {
-	final String themeS = theme.toString();
-	if (previousTheme != null) {
-	    final String previousThemeS = previousTheme.toString();
+    public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
+	final String themeS = newTheme.toString();
+	if (oldTheme != null) {
+	    final String previousThemeS = oldTheme.toString();
 	    title.removeStyleDependentName(previousThemeS);
 	    subTitle.removeStyleDependentName(previousThemeS);
 	    bottom.removeStyleDependentName(previousThemeS);
 	    super.removeStyle("k-entityworkspace-" + previousThemeS);
 	    container.removeStyleName("k-entity-container-" + previousThemeS);
 	}
-	super.addStyle("k-entityworkspace-" + theme);
-	roundedTitle.setCornerStyleName("k-entity-title-rd-" + theme);
-	roundedBottom.setCornerStyleName("k-entity-bottom-rd-" + theme);
+	super.addStyle("k-entityworkspace-" + newTheme);
+	roundedTitle.setCornerStyleName("k-entity-title-rd-" + newTheme);
+	roundedBottom.setCornerStyleName("k-entity-bottom-rd-" + newTheme);
 	title.addStyleDependentName(themeS);
 	subTitle.addStyleDependentName(themeS);
 	bottom.addStyleDependentName(themeS);
-	container.addStyleName("k-entity-container-" + theme);
-	previousTheme = theme;
+	container.addStyleName("k-entity-container-" + newTheme);
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/WorkspaceSkeleton.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/WorkspaceSkeleton.java	2008-07-09 23:43:14 UTC (rev 794)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/WorkspaceSkeleton.java	2008-07-10 02:28:27 UTC (rev 795)
@@ -47,8 +47,8 @@
 	return entity.getEntitySummary().getSiteTraybar();
     }
 
-    public void setTheme(final WsTheme theme) {
-	entity.setTheme(theme);
+    public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
+	entity.setTheme(oldTheme, newTheme);
     }
 
     public void show() {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/WsThemePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/WsThemePanel.java	2008-07-09 23:43:14 UTC (rev 794)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/WsThemePanel.java	2008-07-10 02:28:27 UTC (rev 795)
@@ -2,6 +2,7 @@
 
 import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
 
+import com.calclab.suco.client.signal.Slot2;
 import com.gwtext.client.core.EventObject;
 import com.gwtext.client.widgets.ToolbarButton;
 import com.gwtext.client.widgets.menu.BaseItem;
@@ -13,7 +14,7 @@
 
     private final Menu menu;
 
-    public WsThemePanel(final WorkspaceSkeleton ws) {
+    public WsThemePanel(final WorkspaceSkeleton ws, final WsThemePresenter presenter) {
 	menu = new Menu();
 	for (final WsTheme theme : WsTheme.values()) {
 	    final MenuItem item = new MenuItem();
@@ -22,13 +23,18 @@
 	    item.addListener(new BaseItemListenerAdapter() {
 		@Override
 		public void onClick(final BaseItem item, final EventObject e) {
-		    ws.setTheme(theme);
+		    presenter.setTheme(theme);
 		}
 	    });
 	}
 	menu.setDefaultAlign("br-tr");
 	super.setMenu(menu);
 	ws.getSiteTraybar().addButton(this);
+	presenter.onThemeChanged(new Slot2<WsTheme, WsTheme>() {
+	    public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) {
+		ws.setTheme(oldTheme, newTheme);
+	    }
+	});
     }
 
     public void setVisible(final boolean visible) {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/WsThemePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/WsThemePresenter.java	2008-07-09 23:43:14 UTC (rev 794)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/WsThemePresenter.java	2008-07-10 02:28:27 UTC (rev 795)
@@ -1,14 +1,33 @@
 package org.ourproject.kune.workspace.client.ui.newtmp.themes;
 
+import com.calclab.suco.client.signal.Signal2;
+import com.calclab.suco.client.signal.Slot2;
+
 public class WsThemePresenter {
 
     private WsThemeView view;
+    private WsTheme previousTheme;
+    private final Signal2<WsTheme, WsTheme> onThemeChanged;
 
+    public WsThemePresenter() {
+	this.onThemeChanged = new Signal2<WsTheme, WsTheme>("onThemeChanged");
+    }
+
     public void init(final WsThemeView view) {
 	this.view = view;
     }
 
+    public void onThemeChanged(final Slot2<WsTheme, WsTheme> slot) {
+	onThemeChanged.add(slot);
+    }
+
+    public void setTheme(final WsTheme newTheme) {
+	onThemeChanged.fire(previousTheme, newTheme);
+	previousTheme = newTheme;
+    }
+
     public void setVisible(final boolean visible) {
 	view.setVisible(visible);
     }
+
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogo.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogo.java	2008-07-09 23:43:14 UTC (rev 794)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogo.java	2008-07-10 02:28:27 UTC (rev 795)
@@ -12,6 +12,6 @@
 
     public abstract void setPutYourLogoVisible(final boolean visible);
 
-    public abstract void setTheme(final WsTheme theme);
+    public abstract void setTheme(final WsTheme oldTheme, WsTheme newTheme);
 
 }
\ No newline at end of file

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogoPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogoPanel.java	2008-07-09 23:43:14 UTC (rev 794)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogoPanel.java	2008-07-10 02:28:27 UTC (rev 795)
@@ -106,8 +106,11 @@
 	getEntityTextLogo().setPutYourLogoVisible(visible);
     }
 
-    public void setTheme(final WsTheme theme) {
-	getEntityTextLogo().addStyleDependentName(theme.toString());
+    public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
+	if (oldTheme != null) {
+	    getEntityTextLogo().removeStyleDependentName(oldTheme.toString());
+	}
+	getEntityTextLogo().addStyleDependentName(newTheme.toString());
     }
 
     private EntityTextLogo getEntityTextLogo() {




More information about the kune-commits mailing list