[kune-commits] r944 - in trunk/src/main/java/org/ourproject/kune:
chat/client chat/client/ctx chat/client/ctx/room
docs/client/ctx platf/client/ui workspace/client
workspace/client/cnt workspace/client/cxt
vjrj
vjrj at ourproject.org
Mon Nov 10 21:44:21 CET 2008
Author: vjrj
Date: 2008-11-10 21:44:20 +0100 (Mon, 10 Nov 2008)
New Revision: 944
Added:
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoom.java
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoomPanel.java
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoomPresenter.java
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoomView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/
trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/FoldableContextPresenter.java
Removed:
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdmin.java
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdminPresenter.java
Modified:
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientActions.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContext.java
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/TextUtils.java
trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPresenter.java
Log:
Incomplete - taskUI tools & workspace refactorization
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientActions.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientActions.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -18,6 +18,7 @@
*
*/package org.ourproject.kune.chat.client;
+import org.ourproject.kune.chat.client.ctx.room.AddRoom;
import org.ourproject.kune.docs.client.DocumentClientTool;
import org.ourproject.kune.platf.client.actions.ActionToolbarButtonDescriptor;
import org.ourproject.kune.platf.client.actions.ActionToolbarButtonSeparator;
@@ -39,15 +40,17 @@
private final ContentActionRegistry contentActionRegistry;
private final I18nUITranslationService i18n;
private final ContextActionRegistry contextActionRegistry;
+ private final Provider<AddRoom> addRoomProvider;
public ChatClientActions(final I18nUITranslationService i18n, final Session session,
final ContentActionRegistry contentActionRegistry, final ContextActionRegistry contextActionRegistry,
- final Provider<ChatEngine> chatEngine) {
+ final Provider<ChatEngine> chatEngine, Provider<AddRoom> addRoomProvider) {
this.i18n = i18n;
this.session = session;
this.contentActionRegistry = contentActionRegistry;
this.contextActionRegistry = contextActionRegistry;
this.chatEngineProvider = chatEngine;
+ this.addRoomProvider = addRoomProvider;
createActions();
}
@@ -68,8 +71,10 @@
ActionToolbarButtonDescriptor<StateToken> joinRoom = new ActionToolbarButtonDescriptor<StateToken>(
AccessRolDTO.Viewer, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(StateToken token) {
- chatEngineProvider.get().joinRoom(session.getContainerState().getContainer().getName(),
+ ChatEngine chatEngine = chatEngineProvider.get();
+ chatEngine.joinRoom(session.getContainerState().getContainer().getName(),
session.getCurrentUserInfo().getShortName());
+ chatEngine.show();
}
});
joinRoom.setTextDescription(i18n.t("Enter room"));
@@ -79,7 +84,7 @@
ActionToolbarButtonDescriptor<StateToken> addRoom = new ActionToolbarButtonDescriptor<StateToken>(
AccessRolDTO.Administrator, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(StateToken token) {
-
+ addRoomProvider.get().show();
}
});
addRoom.setTextDescription(i18n.t("New room"));
@@ -92,6 +97,7 @@
contentActionRegistry.addAction(chatAbout, DocumentClientTool.TYPE_POST);
contentActionRegistry.addAction(chatAbout, DocumentClientTool.TYPE_UPLOADEDFILE);
- contextActionRegistry.addAction(joinRoom, ChatClientTool.TYPE_ROOT);
+ contextActionRegistry.addAction(addRoom, ChatClientTool.TYPE_ROOT, ChatClientTool.TYPE_ROOM);
+ contentActionRegistry.addAction(joinRoom, ChatClientTool.TYPE_ROOM);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -23,8 +23,9 @@
import org.ourproject.kune.chat.client.cnt.room.ChatRoomPresenter;
import org.ourproject.kune.chat.client.ctx.ChatContext;
import org.ourproject.kune.chat.client.ctx.ChatContextPresenter;
-import org.ourproject.kune.chat.client.ctx.room.RoomAdmin;
-import org.ourproject.kune.chat.client.ctx.room.RoomAdminPresenter;
+import org.ourproject.kune.chat.client.ctx.room.AddRoom;
+import org.ourproject.kune.chat.client.ctx.room.AddRoomPanel;
+import org.ourproject.kune.chat.client.ctx.room.AddRoomPresenter;
import org.ourproject.kune.platf.client.actions.ContentActionRegistry;
import org.ourproject.kune.platf.client.actions.ContentIconsRegistry;
import org.ourproject.kune.platf.client.actions.ContextActionRegistry;
@@ -56,7 +57,7 @@
@Override
public ChatClientActions create() {
return new ChatClientActions($(I18nUITranslationService.class), $(Session.class),
- $(ContentActionRegistry.class), $(ContextActionRegistry.class), $$(ChatEngine.class));
+ $(ContentActionRegistry.class), $(ContextActionRegistry.class), $$(ChatEngine.class), $$(AddRoom.class));
}
});
@@ -69,11 +70,11 @@
}
});
- register(Singleton.class, new Factory<ChatContext>(ChatContext.class) {
+ register(ToolGroup.class, new Factory<ChatContext>(ChatContext.class) {
@Override
public ChatContext create() {
final ChatContextPresenter presenter = new ChatContextPresenter($(StateManager.class),
- $$(ContextNavigator.class), $$(RoomAdmin.class));
+ $$(ContextNavigator.class));
return presenter;
}
});
@@ -99,12 +100,13 @@
}
});
- register(Singleton.class, new Factory<RoomAdmin>(RoomAdmin.class) {
+ register(Singleton.class, new Factory<AddRoom>(AddRoom.class) {
@Override
- public RoomAdmin create() {
- final RoomAdminPresenter presenter = new RoomAdminPresenter($(ContextNavigator.class),
- $(I18nUITranslationService.class), $$(StateManager.class), $(Session.class),
- $$(ContentServiceAsync.class));
+ public AddRoom create() {
+ final AddRoomPresenter presenter = new AddRoomPresenter($(Session.class),
+ $$(ContentServiceAsync.class), $(StateManager.class));
+ final AddRoomPanel panel = new AddRoomPanel(presenter, $(I18nTranslationService.class));
+ presenter.init(panel);
return presenter;
}
});
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -46,6 +46,6 @@
@Override
protected void registerIcons() {
- contentIconsRegistry.registerContentTypeIcon(TYPE_ROOM, "public/images/emite-room.png");
+ contentIconsRegistry.registerContentTypeIcon(TYPE_ROOM, "images/emite-room.png");
}
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContext.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContext.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContext.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -19,10 +19,6 @@
*/
package org.ourproject.kune.chat.client.ctx;
-import org.ourproject.kune.platf.client.dto.StateContainerDTO;
public interface ChatContext {
-
- void setState(StateContainerDTO state);
-
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -19,24 +19,23 @@
*/
package org.ourproject.kune.chat.client.ctx;
-import org.ourproject.kune.chat.client.ctx.room.RoomAdmin;
+import org.ourproject.kune.chat.client.ChatClientTool;
import org.ourproject.kune.platf.client.dto.StateContainerDTO;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
+import org.ourproject.kune.workspace.client.cxt.FoldableContextPresenter;
import com.calclab.suco.client.ioc.Provider;
-public class ChatContextPresenter implements ChatContext {
+public class ChatContextPresenter extends FoldableContextPresenter implements ChatContext {
- private final Provider<RoomAdmin> roomAdminsProvider;
-
public ChatContextPresenter(final StateManager stateManager,
- final Provider<ContextNavigator> contextNavigatorProvider, final Provider<RoomAdmin> roomAdminsProvider) {
- this.roomAdminsProvider = roomAdminsProvider;
+ final Provider<ContextNavigator> contextNavigatorProvider) {
+ super(ChatClientTool.NAME, stateManager, contextNavigatorProvider);
}
- public void setState(final StateContainerDTO state) {
- final RoomAdmin rooms = roomAdminsProvider.get();
- rooms.showRoom(state.getStateToken(), state.getContainer(), state.getContainerRights());
+ @Override
+ protected void setState(final StateContainerDTO state) {
+ super.setState(state);
}
}
Added: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoom.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoom.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoom.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -0,0 +1,7 @@
+package org.ourproject.kune.chat.client.ctx.room;
+
+public interface AddRoom {
+
+ void show();
+
+}
Added: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoomPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoomPanel.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoomPanel.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -0,0 +1,99 @@
+package org.ourproject.kune.chat.client.ctx.room;
+
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.ui.TextUtils;
+
+import com.calclab.emiteuimodule.client.dialog.BasicDialogExtended;
+import com.calclab.emiteuimodule.client.dialog.BasicDialogListener;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.DeferredCommand;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.widgets.form.Field;
+import com.gwtext.client.widgets.form.FormPanel;
+import com.gwtext.client.widgets.form.TextField;
+import com.gwtext.client.widgets.form.event.FieldListenerAdapter;
+
+public class AddRoomPanel implements AddRoomView {
+
+ public static final String CANCEL_ID = "k-ct-arp-cb";
+ public static final String ADD_ROOM_ID = "k-ct-arp-ab";
+ public static final String ROOM_NAME_ID = "k-ct-arp-rfield";
+ private final AddRoomPresenter presenter;
+ private BasicDialogExtended dialog;
+ private final I18nTranslationService i18n;
+ private FormPanel formPanel;
+ private TextField roomName;
+
+ public AddRoomPanel(final AddRoomPresenter presenter, final I18nTranslationService i18n) {
+ this.i18n = i18n;
+ this.presenter = presenter;
+ }
+
+ public void reset() {
+ formPanel.getForm().reset();
+ }
+
+ public void show() {
+ if (dialog == null) {
+ dialog = new BasicDialogExtended(i18n.t("Add a chat room"), false, false, 330, 130, "chat-icon",
+ i18n.tWithNT("Add", "used in button"), ADD_ROOM_ID, i18n.tWithNT("Cancel", "used in button"),
+ CANCEL_ID, new BasicDialogListener() {
+ public void onCancelButtonClick() {
+ dialog.hide();
+ reset();
+ }
+
+ public void onFirstButtonClick() {
+ doAddRoom();
+ }
+ });
+ dialog.setResizable(false);
+ createForm();
+
+ // TODO define a UI Extension Point here
+ }
+ dialog.show();
+ roomName.focus();
+ }
+
+ protected void doAddRoom() {
+ roomName.validate();
+ if (formPanel.getForm().isValid()) {
+ DeferredCommand.addCommand(new Command() {
+ public void execute() {
+ presenter.addRoom(roomName.getValueAsString());
+ reset();
+ }
+ });
+ dialog.hide();
+ }
+ }
+
+ private void createForm() {
+ formPanel = new FormPanel();
+ formPanel.setFrame(true);
+ formPanel.setAutoScroll(false);
+
+ formPanel.setWidth(333);
+ formPanel.setLabelWidth(100);
+ formPanel.setPaddings(10);
+
+ roomName = new TextField(i18n.t("Room Name"), "name", 150);
+ roomName.setAllowBlank(false);
+ roomName.setValidationEvent(false);
+ roomName.setRegex(TextUtils.UNIX_NAME);
+ roomName.setRegexText(i18n.t("Can only contain characters, numbers, and dashes"));
+ roomName.setId(ROOM_NAME_ID);
+ formPanel.add(roomName);
+
+ dialog.add(formPanel);
+ roomName.addListener(new FieldListenerAdapter() {
+ @Override
+ public void onSpecialKey(Field field, EventObject e) {
+ if (e.getKey() == 13) {
+ doAddRoom();
+ }
+ }
+ });
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoomPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoomPresenter.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoomPresenter.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -0,0 +1,51 @@
+package org.ourproject.kune.chat.client.ctx.room;
+
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.workspace.client.site.Site;
+
+import com.calclab.suco.client.ioc.Provider;
+
+public class AddRoomPresenter implements AddRoom {
+
+ private AddRoomView view;
+ private final Session session;
+ private final Provider<ContentServiceAsync> contentServiceProvider;
+ private final StateManager stateManager;
+
+ public AddRoomPresenter(Session session, final Provider<ContentServiceAsync> contentServiceProvider,
+ StateManager stateManager) {
+ this.session = session;
+ this.contentServiceProvider = contentServiceProvider;
+ this.stateManager = stateManager;
+ }
+
+ public void addRoom(String roomName) {
+ Site.showProgressProcessing();
+ final String groupShortName = session.getCurrentState().getGroup().getShortName();
+ contentServiceProvider.get().addRoom(session.getUserHash(),
+ session.getContainerState().getRootContainer().getStateToken(), groupShortName + "-" + roomName,
+ new AsyncCallbackSimple<StateContainerDTO>() {
+ public void onSuccess(final StateContainerDTO state) {
+ stateManager.setRetrievedState(state);
+ Site.hideProgress();
+ }
+ });
+ }
+
+ public View getView() {
+ return view;
+ }
+
+ public void init(AddRoomView view) {
+ this.view = view;
+ }
+
+ public void show() {
+ view.show();
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoomView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoomView.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoomView.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -0,0 +1,9 @@
+package org.ourproject.kune.chat.client.ctx.room;
+
+import org.ourproject.kune.platf.client.View;
+
+public interface AddRoomView extends View {
+
+ void show();
+
+}
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdmin.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdmin.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdmin.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -1,28 +0,0 @@
-/*
- *
- * 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.chat.client.ctx.room;
-
-import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
-import org.ourproject.kune.platf.client.dto.ContainerDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-
-public interface RoomAdmin {
- void showRoom(final StateToken token, final ContainerDTO container, final AccessRightsDTO rights);
-}
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdminPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdminPresenter.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdminPresenter.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -1,77 +0,0 @@
-/*
- *
- * 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.chat.client.ctx.room;
-
-import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
-import org.ourproject.kune.platf.client.dto.ContainerDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
-import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.platf.client.state.StateManager;
-import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
-
-import com.calclab.suco.client.ioc.Provider;
-
-public class RoomAdminPresenter implements RoomAdmin {
- private final ContextNavigator contextNavigator;
-
- public RoomAdminPresenter(final ContextNavigator contextNavigator, final I18nTranslationService i18n,
- final Provider<StateManager> stateManagerProvider, final Session session,
- final Provider<ContentServiceAsync> contentServiceProvider) {
- this.contextNavigator = contextNavigator;
- // final ContextNavigatorImages images =
- // ContextNavigatorImages.App.getInstance();
- // contextNavigator.registerType(ChatClientTool.TYPE_CHAT,
- // images.page());
- // contextNavigator.registerType(ChatClientTool.TYPE_ROOM,
- // images.chatGreen());
- // contextNavigator.canCreate(i18n.t("New chat room"), i18n.t("Add a
- // chat room"), new Listener<String>() {
- // public void onEvent(final String name) {
- // Site.showProgressProcessing();
- // final String groupShortName =
- // session.getCurrentState().getGroup().getShortName();
- // final Long containerId =
- // session.getCurrentState().getFolder().getId();
- // contentServiceProvider.get().addRoom(session.getUserHash(),
- // groupShortName, containerId,
- // groupShortName + "-" + name, new AsyncCallbackSimple<StateDTO>() {
- // public void onSuccess(final StateDTO state) {
- // final StateManager stateManager = stateManagerProvider.get();
- // stateManager.setRetrievedState(state);
- // // FIXME: Isn't using cache (same in Add folder)
- // stateManager.reloadContextAndTitles();
- // Site.hideProgress();
- // }
- // });
- // }
- // });
- }
-
- public void showRoom(final StateToken token, final ContainerDTO container, final AccessRightsDTO rights) {
- // contextNavigator.showContainer(token, container, rights);
- // final String type = container.getTypeId();
- // if (type.equals(ChatClientTool.TYPE_ROOM)) {
- // contextNavigator.setControlsVisible(false);
- // }
- }
-
-}
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-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -21,43 +21,34 @@
import org.ourproject.kune.docs.client.DocumentClientTool;
import org.ourproject.kune.docs.client.ctx.admin.DocContextEditor;
-import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
import org.ourproject.kune.platf.client.dto.StateContainerDTO;
import org.ourproject.kune.platf.client.dto.StateContentDTO;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
+import org.ourproject.kune.workspace.client.cxt.FoldableContextPresenter;
import com.calclab.suco.client.ioc.Provider;
-import com.calclab.suco.client.listener.Listener;
-public class DocumentContextPresenter implements DocumentContext {
- private final Provider<ContextNavigator> contextNavigatorProvider;
+public class DocumentContextPresenter extends FoldableContextPresenter implements DocumentContext {
private final Provider<DocContextEditor> adminContextProvider;
public DocumentContextPresenter(final StateManager stateManager,
- final Provider<ContextNavigator> contextNavigatorProvider, final Provider<DocContextEditor> adminContextProvider) {
- this.contextNavigatorProvider = contextNavigatorProvider;
+ final Provider<ContextNavigator> contextNavigatorProvider,
+ final Provider<DocContextEditor> adminContextProvider) {
+ super(DocumentClientTool.NAME, stateManager, contextNavigatorProvider);
this.adminContextProvider = adminContextProvider;
- stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
- public void onEvent(final StateAbstractDTO state) {
- if (state instanceof StateContainerDTO) {
- StateContainerDTO stateCntCtx = (StateContainerDTO) state;
- if (DocumentClientTool.NAME.equals(stateCntCtx.getToolName())) {
- setState(stateCntCtx);
- contextNavigatorProvider.get().attach();
- }
- } else {
- contextNavigatorProvider.get().detach();
- adminContextProvider.get().detach();
- contextNavigatorProvider.get().clear();
- adminContextProvider.get().clear();
- }
- }
- });
}
- private void setState(final StateContainerDTO state) {
- contextNavigatorProvider.get().setState(state, true);
+ @Override
+ protected void detach() {
+ super.detach();
+ adminContextProvider.get().detach();
+ adminContextProvider.get().clear();
+ }
+
+ @Override
+ protected void setState(final StateContainerDTO state) {
+ super.setState(state);
if (state instanceof StateContentDTO) {
adminContextProvider.get().setState((StateContentDTO) state);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/TextUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/TextUtils.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/TextUtils.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -28,6 +28,8 @@
// Original regexp from http://www.regular-expressions.info/email.html
public static final String EMAIL_REGEXP = "[-!#$%&\'*+/=?_`{|}~a-z0-9^]+(\\.[-!#$%&\'*+/=?_`{|}~a-z0-9^]+)*@(localhost|([a-z0-9]([-a-z0-9]*[a-z0-9])?\\.)+[a-z0-9]([-a-z0-9]*[a-z0-9]))?";
+ public static final String UNIX_NAME = "^[a-z0-9_\\-]+$";
+
/*
* This method escape only some dangerous html chars
*/
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentPanel.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentPanel.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -4,7 +4,7 @@
import com.google.gwt.user.client.ui.Widget;
-public class AbstractContentPanel {
+public abstract class AbstractContentPanel {
private final WorkspaceSkeleton ws;
private Widget widget;
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPanel.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPanel.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -10,7 +10,7 @@
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
-public class FoldableContentPanel extends AbstractContentPanel {
+public abstract class FoldableContentPanel extends AbstractContentPanel {
private final I18nTranslationService i18n;
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPresenter.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPresenter.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -13,7 +13,7 @@
import com.calclab.suco.client.listener.Listener;
-public class FoldableContentPresenter extends AbstractContentPresenter {
+public abstract class FoldableContentPresenter extends AbstractContentPresenter {
private final String toolName;
private final ActionRegistry<StateToken> actionRegistry;
Added: trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/FoldableContextPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/FoldableContextPresenter.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/FoldableContextPresenter.java 2008-11-10 20:44:20 UTC (rev 944)
@@ -0,0 +1,42 @@
+package org.ourproject.kune.workspace.client.cxt;
+
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
+
+import com.calclab.suco.client.ioc.Provider;
+import com.calclab.suco.client.listener.Listener;
+
+public abstract class FoldableContextPresenter {
+ private final Provider<ContextNavigator> contextNavigatorProvider;
+ protected final String toolname;
+
+ public FoldableContextPresenter(final String toolname, final StateManager stateManager,
+ final Provider<ContextNavigator> contextNavigatorProvider) {
+ this.toolname = toolname;
+ this.contextNavigatorProvider = contextNavigatorProvider;
+ stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
+ public void onEvent(final StateAbstractDTO state) {
+ if (state instanceof StateContainerDTO) {
+ StateContainerDTO stateCntCtx = (StateContainerDTO) state;
+ if (toolname.equals(stateCntCtx.getToolName())) {
+ setState(stateCntCtx);
+ contextNavigatorProvider.get().attach();
+ }
+ } else {
+ detach();
+ }
+ }
+ });
+ }
+
+ protected void detach() {
+ contextNavigatorProvider.get().detach();
+ contextNavigatorProvider.get().clear();
+ }
+
+ protected void setState(StateContainerDTO state) {
+ contextNavigatorProvider.get().setState(state, true);
+ }
+}
More information about the kune-commits
mailing list