[kune-commits] r898 - in trunk/src:
main/java/org/ourproject/kune/docs/client
main/java/org/ourproject/kune/docs/client/cnt
main/java/org/ourproject/kune/platf/client/actions
main/java/org/ourproject/kune/platf/client/actions/toolbar
main/java/org/ourproject/kune/platf/client/dto
main/java/org/ourproject/kune/platf/client/services
main/java/org/ourproject/kune/platf/client/state
main/java/org/ourproject/kune/platf/server/access
main/java/org/ourproject/kune/platf/server/domain
main/java/org/ourproject/kune/platf/server/state
main/java/org/ourproject/kune/workspace
main/java/org/ourproject/kune/workspace/client/ctxnav
main/java/org/ourproject/kune/workspace/client/editor
main/java/org/ourproject/kune/workspace/client/socialnet
test/java/org/ourproject/kune/platf/client/actions
test/java/org/ourproject/kune/workspace/client/editor
vjrj
vjrj at ourproject.org
Wed Oct 1 03:29:29 CEST 2008
Author: vjrj
Date: 2008-10-01 03:29:01 +0200 (Wed, 01 Oct 2008)
New Revision: 898
Added:
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/WrappedRichTextAreaImplOpera.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/WrappedRichTextAreaImplSafari.java
Removed:
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorListener.java
Modified:
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContent.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessListsDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRightsDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupListDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/LinkDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/ParticipationDataDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkResultDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/TagDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/TagResultDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserSimpleDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRights.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/AccessLists.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupList.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/I18nLanguage.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/I18nTranslation.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/SocialNetwork.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java
trunk/src/main/java/org/ourproject/kune/platf/server/state/State.java
trunk/src/main/java/org/ourproject/kune/workspace/Kune-Workspace.gwt.xml
trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditor.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorToolbar.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/WrappedRichTextAreaImplIE6.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/WrappedRichTextAreaImplMozilla.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java
trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionRegistryTest.java
trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java
Log:
Editor refactorization (not finished)
RichTextArea css injets.
toStrings in DTOs for better logs.
Complete - task 62: ContextNav tree scroll problem
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -10,6 +10,7 @@
import static org.ourproject.kune.docs.client.DocumentClientTool.TYPE_WIKI;
import static org.ourproject.kune.docs.client.DocumentClientTool.TYPE_WIKIPAGE;
+import org.ourproject.kune.docs.client.cnt.DocumentContent;
import org.ourproject.kune.platf.client.actions.ActionEnableCondition;
import org.ourproject.kune.platf.client.actions.ActionMenuItemDescriptor;
import org.ourproject.kune.platf.client.actions.ActionToolbarButtonAndItemDescriptor;
@@ -27,20 +28,25 @@
import org.ourproject.kune.platf.client.dto.InitDataDTO;
import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.errors.SessionExpiredException;
import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
import org.ourproject.kune.platf.client.rpc.GroupServiceAsync;
+import org.ourproject.kune.platf.client.services.KuneErrorHandler;
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
import org.ourproject.kune.platf.client.ui.upload.FileUploader;
import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
+import org.ourproject.kune.workspace.client.editor.TextEditor;
import org.ourproject.kune.workspace.client.entitylogo.EntityLogo;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.site.Site;
import com.calclab.suco.client.ioc.Provider;
import com.calclab.suco.client.listener.Listener;
+import com.calclab.suco.client.listener.Listener0;
+import com.google.gwt.user.client.rpc.AsyncCallback;
public class DocumentClientActions {
@@ -55,13 +61,18 @@
private final Provider<GroupServiceAsync> groupServiceProvider;
private final Provider<FileDownloadUtils> fileDownloadProvider;
private final EntityLogo entityLogo;
+ private final Provider<TextEditor> textEditorProvider;
+ private final KuneErrorHandler errorHandler;
+ private final DocumentContent documentContent;
public DocumentClientActions(final I18nUITranslationService i18n, final ContextNavigator contextNavigator,
final Session session, final StateManager stateManager,
final Provider<ContentServiceAsync> contentServiceProvider,
final Provider<GroupServiceAsync> groupServiceProvider, final Provider<FileUploader> fileUploaderProvider,
final ContentActionRegistry contentActionRegistry, final ContextActionRegistry contextActionRegistry,
- final Provider<FileDownloadUtils> fileDownloadProvider, final EntityLogo entityLogo) {
+ final Provider<FileDownloadUtils> fileDownloadProvider, final EntityLogo entityLogo,
+ final Provider<TextEditor> textEditorProvider, final KuneErrorHandler errorHandler,
+ final DocumentContent documentContent) {
this.i18n = i18n;
this.contextNavigator = contextNavigator;
this.session = session;
@@ -73,6 +84,9 @@
this.contentActionRegistry = contentActionRegistry;
this.fileDownloadProvider = fileDownloadProvider;
this.entityLogo = entityLogo;
+ this.textEditorProvider = textEditorProvider;
+ this.errorHandler = errorHandler;
+ this.documentContent = documentContent;
createActions();
}
@@ -306,6 +320,47 @@
final ActionToolbarButtonDescriptor<StateToken> editContent = new ActionToolbarButtonDescriptor<StateToken>(
AccessRolDTO.Editor, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(final StateToken stateToken) {
+ session.check(new AsyncCallbackSimple<Object>() {
+ public void onSuccess(final Object result) {
+ final TextEditor editor = textEditorProvider.get();
+ documentContent.detach();
+ editor.editContent(session.getCurrentState().getContent(), new Listener<String>() {
+ public void onEvent(final String html) {
+ Site.showProgressSaving();
+ contentServiceProvider.get().save(session.getUserHash(), stateToken, html,
+ new AsyncCallback<Integer>() {
+ public void onFailure(final Throwable caught) {
+ Site.hideProgress();
+ try {
+ throw caught;
+ } catch (final SessionExpiredException e) {
+ errorHandler.doSessionExpired();
+ } catch (final Throwable e) {
+ Site.error(i18n.t("Error saving document. Retrying..."));
+ errorHandler.process(caught);
+ editor.onSaveFailed();
+ }
+ }
+
+ public void onSuccess(final Integer newVersion) {
+ Site.hideProgress();
+ editor.onSaved();
+ if (session.getCurrentStateToken().equals(stateToken)) {
+ session.getCurrentState().setVersion(newVersion);
+ session.getCurrentState().setContent(html);
+ documentContent.refreshState();
+ }
+ }
+ });
+ }
+ }, new Listener0() {
+ public void onEvent() {
+ // onClose
+ documentContent.refreshState();
+ }
+ });
+ }
+ });
}
});
editContent.setTextDescription(i18n.tWithNT("Edit", "used in button"));
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -35,7 +35,6 @@
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.tool.ToolSelector;
import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
-import org.ourproject.kune.platf.client.ui.rate.RateIt;
import org.ourproject.kune.platf.client.ui.upload.FileUploader;
import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
import org.ourproject.kune.workspace.client.editor.TextEditor;
@@ -74,7 +73,8 @@
return new DocumentClientActions($(I18nUITranslationService.class), $(ContextNavigator.class),
$(Session.class), $(StateManager.class), $$(ContentServiceAsync.class),
$$(GroupServiceAsync.class), $$(FileUploader.class), $(ContentActionRegistry.class),
- $(ContextActionRegistry.class), $$(FileDownloadUtils.class), $(EntityLogo.class));
+ $(ContextActionRegistry.class), $$(FileDownloadUtils.class), $(EntityLogo.class),
+ $$(TextEditor.class), $(KuneErrorHandler.class), $(DocumentContent.class));
}
});
@@ -83,12 +83,11 @@
final ActionToolbarPanel<StateToken> contentNavigatorToolbar = new ActionToolbarPanel<StateToken>(
ActionToolbarPanel.Position.content, $$(ActionManager.class), $(WorkspaceSkeleton.class));
final ActionToolbar<StateToken> toolbar = new ActionToolbarPresenter<StateToken>(
- contentNavigatorToolbar, $(ContentActionRegistry.class));
+ contentNavigatorToolbar);
final DocumentContentPresenter presenter = new DocumentContentPresenter($(StateManager.class),
- $(I18nUITranslationService.class), $(KuneErrorHandler.class), $(Session.class),
- $(RateIt.class), $$(DocumentReader.class), $$(TextEditor.class), $$(FolderViewer.class),
- $$(ContentServiceAsync.class), toolbar, $(ContentActionRegistry.class));
+ $(Session.class), $$(DocumentReader.class), $$(TextEditor.class), $$(FolderViewer.class),
+ toolbar, $(ContentActionRegistry.class));
final DocumentContentPanel panel = new DocumentContentPanel($(WorkspaceSkeleton.class));
presenter.init(panel);
return presenter;
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContent.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContent.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContent.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -20,20 +20,10 @@
package org.ourproject.kune.docs.client.cnt;
-import com.calclab.suco.client.listener.Listener0;
-
public interface DocumentContent {
- void onEditCancelled(Listener0 listener);
+ void detach();
- void onDeleteClicked();
+ void refreshState();
- void onEditClicked();
-
- void onEditing(Listener0 listener);
-
- void onSaved();
-
- void onSaveFailed();
-
}
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -28,165 +28,62 @@
import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.errors.SessionExpiredException;
-import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
-import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
-import org.ourproject.kune.platf.client.services.KuneErrorHandler;
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.state.StateManager;
-import org.ourproject.kune.platf.client.ui.rate.RateIt;
import org.ourproject.kune.workspace.client.editor.TextEditor;
-import org.ourproject.kune.workspace.client.editor.TextEditorListener;
-import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
-import org.ourproject.kune.workspace.client.site.Site;
import com.calclab.suco.client.ioc.Provider;
-import com.calclab.suco.client.listener.Event0;
import com.calclab.suco.client.listener.Listener;
-import com.calclab.suco.client.listener.Listener0;
import com.calclab.suco.client.listener.Listener2;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-public class DocumentContentPresenter implements DocumentContent, TextEditorListener {
+public class DocumentContentPresenter implements DocumentContent {
private DocumentContentView view;
- private final StateManager stateManager;
private StateDTO content;
private final Session session;
- private final RateIt rateIt;
private final Provider<DocumentReader> docReaderProvider;
private final Provider<TextEditor> textEditorProvider;
private final Provider<FolderViewer> folderViewerProvider;
- private final Event0 onEditing;
- private final Event0 onEditCancelled;
- private final Provider<ContentServiceAsync> contentServiceProvider;
- private final I18nUITranslationService i18n;
- private final KuneErrorHandler errorHandler;
private final ActionToolbar<StateToken> toolbar;
private final ActionRegistry<StateToken> actionRegistry;
- public DocumentContentPresenter(final StateManager stateManager, final I18nUITranslationService i18n,
- final KuneErrorHandler errorHandler, final Session session, final RateIt rateIt,
+ public DocumentContentPresenter(final StateManager stateManager, final Session session,
final Provider<DocumentReader> docReaderProvider, final Provider<TextEditor> textEditorProvider,
- final Provider<FolderViewer> folderViewerProvider,
- final Provider<ContentServiceAsync> contentServiceProvider, final ActionToolbar<StateToken> toolbar,
+ final Provider<FolderViewer> folderViewerProvider, final ActionToolbar<StateToken> toolbar,
final ActionRegistry<StateToken> actionRegistry) {
- this.stateManager = stateManager;
- this.i18n = i18n;
- this.errorHandler = errorHandler;
this.session = session;
- this.rateIt = rateIt;
this.docReaderProvider = docReaderProvider;
this.textEditorProvider = textEditorProvider;
this.folderViewerProvider = folderViewerProvider;
- this.contentServiceProvider = contentServiceProvider;
this.toolbar = toolbar;
this.actionRegistry = actionRegistry;
- this.onEditing = new Event0("onEditing");
- this.onEditCancelled = new Event0("onEditCancelled");
stateManager.onStateChanged(new Listener<StateDTO>() {
public void onEvent(final StateDTO state) {
if (state.getToolName().equals(DocumentClientTool.NAME)) {
setState(state);
- toolbar.attach();
}
}
});
stateManager.onToolChanged(new Listener2<String, String>() {
public void onEvent(final String oldTool, final String newTool) {
if (oldTool != null && oldTool.equals(DocumentClientTool.NAME)) {
- // Detach
+ toolbar.detach();
}
}
});
}
+ public void detach() {
+ toolbar.detach();
+ }
+
public void init(final DocumentContentView view) {
this.view = view;
}
- public void onDeleteClicked() {
- Site.showProgressProcessing();
- contentServiceProvider.get().delContent(session.getUserHash(), content.getStateToken(),
- new AsyncCallbackSimple<Object>() {
- public void onSuccess(final Object result) {
- Site.hideProgress();
- stateManager.reload();
- }
- });
+ public void refreshState() {
+ setState(session.getCurrentState());
}
- public void onEditCancelled() {
- showContent();
- onEditCancelled.fire();
- // Re-enable rateIt widget
- rateIt.setVisible(true);
- textEditorProvider.get().setToolbarVisible(false);
- }
-
- public void onEditCancelled(final Listener0 listener) {
- onEditCancelled.add(listener);
- }
-
- public void onEditClicked() {
- session.check(new AsyncCallbackSimple<Object>() {
- public void onSuccess(final Object result) {
- if (content.hasDocument()) {
- // Don't permit rate content while your are editing
- rateIt.setVisible(false);
- final TextEditor editor = textEditorProvider.get();
- editor.setContent(content.getContent());
- editor.setToolbarVisible(true);
- view.setContent(editor.getView());
- } else {
- // final FolderEditor editor = folderEditorProvider.get();
- // editor.setFolder(content.getContainer());
- // view.setContent(editor.getView());
- }
- onEditing.fire();
- }
- });
- }
-
- public void onEditing(final Listener0 listener) {
- onEditing.add(listener);
- }
-
- public void onSave(final String text) {
- content.setContent(text);
- Site.showProgressSaving();
- contentServiceProvider.get().save(session.getUserHash(), content.getStateToken(), content.getContent(),
- new AsyncCallback<Integer>() {
- public void onFailure(final Throwable caught) {
- Site.hideProgress();
- try {
- throw caught;
- } catch (final SessionExpiredException e) {
- errorHandler.doSessionExpired();
- } catch (final Throwable e) {
- Site.error(i18n.t("Error saving document. Retrying..."));
- errorHandler.process(caught);
- onSaveFailed();
- }
- }
-
- public void onSuccess(final Integer result) {
- Site.hideProgress();
- onSaved();
- }
- });
- }
-
- public void onSaved() {
- textEditorProvider.get().onSaved();
- }
-
- public void onSaveFailed() {
- textEditorProvider.get().onSaveFailed();
- }
-
- public void onTranslate() {
- }
-
private void setState(final StateDTO state) {
content = state;
final String typeId = content.getTypeId();
@@ -200,11 +97,12 @@
}
toolbar.disableMenusAndClearButtons();
toolbar.showActions(collection, true);
+ toolbar.attach();
showContent();
}
private void showContent() {
- textEditorProvider.get().setToolbarVisible(false);
+ // textEditorProvider.get().setToolbarVisible(false);
if (content.hasDocument()) {
docReaderProvider.get().showDocument(content.getStateToken(), content.getContent(), content.getTypeId(),
content.getMimeType());
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -19,11 +19,6 @@
}
}
- public boolean checkEnabling(final ActionDescriptor<T> action, final T T) {
- final ActionEnableCondition<T> enableCondition = action.getEnableCondition();
- return enableCondition != null ? enableCondition.mustBeEnabled(T) : true;
- }
-
public ActionItemCollection<T> getCurrentActions(final T item, final String contentTypeId, final boolean isLogged,
final AccessRightsDTO rights, final boolean toolbarItems) {
final ActionItemCollection<T> collection = new ActionItemCollection<T>();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -1,9 +1,9 @@
package org.ourproject.kune.platf.client.actions.toolbar;
import org.ourproject.kune.platf.client.actions.ActionDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionEnableCondition;
import org.ourproject.kune.platf.client.actions.ActionItem;
import org.ourproject.kune.platf.client.actions.ActionItemCollection;
-import org.ourproject.kune.platf.client.actions.ActionRegistry;
import org.ourproject.kune.platf.client.actions.ActionToolbarButtonAndItemDescriptor;
import org.ourproject.kune.platf.client.actions.ActionToolbarButtonDescriptor;
import org.ourproject.kune.platf.client.actions.ActionToolbarMenuAndItemDescriptor;
@@ -13,17 +13,20 @@
public class ActionToolbarPresenter<T> implements ActionToolbar<T> {
private final ActionToolbarView<T> toolbar;
- private final ActionRegistry<T> actionRegistry;
- public ActionToolbarPresenter(final ActionToolbarView<T> toolbar, final ActionRegistry<T> actionRegistry) {
+ public ActionToolbarPresenter(final ActionToolbarView<T> toolbar) {
this.toolbar = toolbar;
- this.actionRegistry = actionRegistry;
}
public void attach() {
toolbar.attach();
}
+ public boolean checkEnabling(final ActionDescriptor<T> action, final T T) {
+ final ActionEnableCondition<T> enableCondition = action.getEnableCondition();
+ return enableCondition != null ? enableCondition.mustBeEnabled(T) : true;
+ }
+
public void clear() {
toolbar.clear();
}
@@ -34,21 +37,17 @@
public void disableMenusAndClearButtons() {
toolbar.clear();
- // With action-item, this must be redesigned
- // toolbar.clearRemovableActions();
- // toolbar.disableAllMenuItems();
}
public void showActions(final ActionItemCollection<T> actions, final boolean isItemSelected) {
for (final ActionItem<T> actionItem : actions) {
final ActionDescriptor<T> action = actionItem.getAction();
if (action instanceof ActionToolbarMenuDescriptor || action instanceof ActionToolbarMenuAndItemDescriptor) {
- toolbar.addMenuAction(actionItem, isItemSelected
- && actionRegistry.checkEnabling(action, actionItem.getItem()));
+ toolbar.addMenuAction(actionItem, isItemSelected && checkEnabling(action, actionItem.getItem()));
} else {
if (action instanceof ActionToolbarButtonDescriptor
|| action instanceof ActionToolbarButtonAndItemDescriptor) {
- if (isItemSelected && actionRegistry.checkEnabling(action, actionItem.getItem())) {
+ if (isItemSelected && checkEnabling(action, actionItem.getItem())) {
toolbar.addButtonAction(actionItem);
}
} else {
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessListsDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessListsDTO.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessListsDTO.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -28,37 +28,42 @@
private GroupListDTO viewers;
public AccessListsDTO() {
- this(null, null, null);
+ this(null, null, null);
}
public AccessListsDTO(final GroupListDTO admins, final GroupListDTO editors, final GroupListDTO viewers) {
- this.admins = admins;
- this.editors = editors;
- this.viewers = viewers;
+ this.admins = admins;
+ this.editors = editors;
+ this.viewers = viewers;
}
public GroupListDTO getAdmins() {
- return admins;
+ return admins;
}
- public void setAdmins(final GroupListDTO admins) {
- this.admins = admins;
+ public GroupListDTO getEditors() {
+ return editors;
}
- public GroupListDTO getEditors() {
- return editors;
+ public GroupListDTO getViewers() {
+ return viewers;
}
- public void setEditors(final GroupListDTO editors) {
- this.editors = editors;
+ public void setAdmins(final GroupListDTO admins) {
+ this.admins = admins;
}
- public GroupListDTO getViewers() {
- return viewers;
+ public void setEditors(final GroupListDTO editors) {
+ this.editors = editors;
}
public void setViewers(final GroupListDTO viewers) {
- this.viewers = viewers;
+ this.viewers = viewers;
}
+ @Override
+ public String toString() {
+ return "AccessListDTO[admins :" + admins + "; editors: " + editors + "; viewers: " + viewers + "]";
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRightsDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRightsDTO.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRightsDTO.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -27,63 +27,62 @@
private boolean isEditable;
private boolean isVisible;
+ public AccessRightsDTO() {
+ this(false, false, false);
+ }
+
public AccessRightsDTO(final boolean isAdministrable, final boolean isEditable, final boolean isVisible) {
- this.isAdministrable = isAdministrable;
- this.isEditable = isEditable;
- this.isVisible = isVisible;
+ this.isAdministrable = isAdministrable;
+ this.isEditable = isEditable;
+ this.isVisible = isVisible;
}
- public AccessRightsDTO() {
- this(false, false, false);
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ final AccessRightsDTO other = (AccessRightsDTO) obj;
+ if (isAdministrable != other.isAdministrable) {
+ return false;
+ }
+ if (isEditable != other.isEditable) {
+ return false;
+ }
+ if (isVisible != other.isVisible) {
+ return false;
+ }
+ return true;
}
public boolean isAdministrable() {
- return isAdministrable;
+ return isAdministrable;
}
- public void setAdministrable(final boolean isAdministrable) {
- this.isAdministrable = isAdministrable;
+ public boolean isEditable() {
+ return isEditable;
}
- public boolean isEditable() {
- return isEditable;
+ public boolean isVisible() {
+ return isVisible;
}
- public void setEditable(final boolean isEditable) {
- this.isEditable = isEditable;
+ public void setAdministrable(final boolean isAdministrable) {
+ this.isAdministrable = isAdministrable;
}
- public boolean isVisible() {
- return isVisible;
+ public void setEditable(final boolean isEditable) {
+ this.isEditable = isEditable;
}
public void setVisible(final boolean isVisible) {
- this.isVisible = isVisible;
+ this.isVisible = isVisible;
}
public String toString() {
- return "[" + isAdministrable + ", " + isEditable + ", " + isVisible + "]";
+ return "AccessRightsDTO[a: " + isAdministrable + ", e: " + isEditable + ", v: " + isVisible + "]";
}
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- final AccessRightsDTO other = (AccessRightsDTO) obj;
- if (isAdministrable != other.isAdministrable) {
- return false;
- }
- if (isEditable != other.isEditable) {
- return false;
- }
- if (isVisible != other.isVisible) {
- return false;
- }
- return true;
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -54,34 +54,6 @@
return false;
}
final GroupDTO other = (GroupDTO) obj;
- if (defaultLicense == null) {
- if (other.defaultLicense != null) {
- return false;
- }
- } else if (!defaultLicense.equals(other.defaultLicense)) {
- return false;
- }
- if (id == null) {
- if (other.id != null) {
- return false;
- }
- } else if (!id.equals(other.id)) {
- return false;
- }
- if (longName == null) {
- if (other.longName != null) {
- return false;
- }
- } else if (!longName.equals(other.longName)) {
- return false;
- }
- if (publicDesc == null) {
- if (other.publicDesc != null) {
- return false;
- }
- } else if (!publicDesc.equals(other.publicDesc)) {
- return false;
- }
if (shortName == null) {
if (other.shortName != null) {
return false;
@@ -89,9 +61,6 @@
} else if (!shortName.equals(other.shortName)) {
return false;
}
- if (type != other.type) {
- return false;
- }
return true;
}
@@ -187,4 +156,7 @@
this.workspaceTheme = workspaceTheme;
}
+ public String toString() {
+ return "GroupDTO[" + shortName + "]";
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupListDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupListDTO.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupListDTO.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -31,27 +31,34 @@
private String mode;
public GroupListDTO() {
- this(null);
+ this(null);
}
public GroupListDTO(final List<GroupDTO> list) {
- this.list = list;
+ this.list = list;
}
public List<GroupDTO> getList() {
- return list;
+ return list;
}
- public void setList(final List<GroupDTO> list) {
- this.list = list;
+ public String getMode() {
+ return mode;
}
- public String getMode() {
- return mode;
+ public void setList(final List<GroupDTO> list) {
+ this.list = list;
}
public void setMode(final String mode) {
- this.mode = mode;
+ this.mode = mode;
}
+ public String toString() {
+ String groupString = "";
+ for (final GroupDTO group : list) {
+ groupString = groupString + group.getShortName() + ", ";
+ }
+ return "GroupDTO[(" + mode + "): " + groupString + "]";
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/LinkDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/LinkDTO.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/LinkDTO.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -32,62 +32,62 @@
private List<TagDTO> tags;
public LinkDTO() {
- this(null, null, null, null);
+ this(null, null, null, null);
}
public LinkDTO(final String shortName, final String longName, final String iconUrl, final String link) {
- this.shortName = shortName;
- this.longName = longName;
- this.iconUrl = iconUrl;
- this.link = link;
+ this.shortName = shortName;
+ this.longName = longName;
+ this.iconUrl = iconUrl;
+ this.link = link;
}
- public String getShortName() {
- return shortName;
+ public String getIconUrl() {
+ return iconUrl;
}
- public void setShortName(final String shortName) {
- this.shortName = shortName;
- }
-
public String getLink() {
- return link;
+ return link;
}
- public void setLink(final String link) {
- this.link = link;
+ public String getLongName() {
+ return longName;
}
- public String getLongName() {
- return longName;
+ public Double getRate() {
+ return rate;
}
- public void setLongName(final String longName) {
- this.longName = longName;
+ public String getShortName() {
+ return shortName;
}
- public String getIconUrl() {
- return iconUrl;
+ public List<TagDTO> getTags() {
+ return tags;
}
public void setIconUrl(final String iconUrl) {
- this.iconUrl = iconUrl;
+ this.iconUrl = iconUrl;
}
- public Double getRate() {
- return rate;
+ public void setLink(final String link) {
+ this.link = link;
}
+ public void setLongName(final String longName) {
+ this.longName = longName;
+ }
+
public void setRate(final Double rate) {
- this.rate = rate;
+ this.rate = rate;
}
- public List<TagDTO> getTags() {
- return tags;
+ public void setShortName(final String shortName) {
+ this.shortName = shortName;
}
public void setTags(final List<TagDTO> tags) {
- this.tags = tags;
+ this.tags = tags;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/ParticipationDataDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/ParticipationDataDTO.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/ParticipationDataDTO.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -53,4 +53,9 @@
this.groupsIsCollab = groupsIsCollab;
}
+ @Override
+ public String toString() {
+ return "ParticipationDataDTO[admin in: " + groupsIsAdmin.toString() + ", collab in: "
+ + groupsIsCollab.toString() + "]";
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDTO.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDTO.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -48,4 +48,8 @@
this.pendingCollaborators = pendingCollaborators;
}
+ public String toString() {
+ return "SocialNetworkDTO[accessList: " + accessLists + "; pendingsCollabs: " + pendingCollaborators + "]";
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkResultDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkResultDTO.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkResultDTO.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -28,28 +28,31 @@
ParticipationDataDTO userParticipation;
public SocialNetworkResultDTO() {
- this(null, null);
+ this(null, null);
}
public SocialNetworkResultDTO(final SocialNetworkDTO groupMembers, final ParticipationDataDTO userParticipation) {
- this.groupMembers = groupMembers;
- this.userParticipation = userParticipation;
+ this.groupMembers = groupMembers;
+ this.userParticipation = userParticipation;
}
public SocialNetworkDTO getGroupMembers() {
- return groupMembers;
+ return groupMembers;
}
- public void setGroupMembers(final SocialNetworkDTO groupMembers) {
- this.groupMembers = groupMembers;
+ public ParticipationDataDTO getUserParticipation() {
+ return userParticipation;
}
- public ParticipationDataDTO getUserParticipation() {
- return userParticipation;
+ public void setGroupMembers(final SocialNetworkDTO groupMembers) {
+ this.groupMembers = groupMembers;
}
public void setUserParticipation(final ParticipationDataDTO userParticipation) {
- this.userParticipation = userParticipation;
+ this.userParticipation = userParticipation;
}
+ public String toString() {
+ return "SocialNetworkResultDTO[members: " + groupMembers + "; participation: " + userParticipation + "]";
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateDTO.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateDTO.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -23,7 +23,6 @@
import java.util.Date;
import java.util.List;
-
import com.google.gwt.user.client.rpc.IsSerializable;
public class StateDTO implements IsSerializable {
@@ -304,4 +303,8 @@
this.version = version;
}
+ public String toString() {
+ return "StateDTO[" + stateToken + "/" + typeId + "]";
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/TagDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/TagDTO.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/TagDTO.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -26,19 +26,23 @@
private String name;
public TagDTO() {
- this(null);
+ this(null);
}
public TagDTO(final String name) {
- this.name = name;
+ this.name = name;
}
public String getName() {
- return name;
+ return name;
}
public void setName(final String name) {
- this.name = name;
+ this.name = name;
}
+ public String toString() {
+ return name;
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/TagResultDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/TagResultDTO.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/TagResultDTO.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -27,28 +27,32 @@
private Long count;
public TagResultDTO() {
- this(null, null);
+ this(null, null);
}
public TagResultDTO(final String name, final Long count) {
- this.name = name;
- this.count = count;
+ this.name = name;
+ this.count = count;
}
public Long getCount() {
- return count;
+ return count;
}
- public void setCount(final Long count) {
- this.count = count;
+ public String getName() {
+ return name;
}
- public String getName() {
- return name;
+ public void setCount(final Long count) {
+ this.count = count;
}
public void setName(final String name) {
- this.name = name;
+ this.name = name;
}
+ public String toString() {
+ return name + "(" + count + ")";
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserDTO.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserDTO.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -153,4 +153,8 @@
this.timezone = timezone;
}
+ public String toString() {
+ return "UserDTO[" + shortName + "]";
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserSimpleDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserSimpleDTO.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserSimpleDTO.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -22,41 +22,35 @@
import com.google.gwt.user.client.rpc.IsSerializable;
public class UserSimpleDTO implements IsSerializable {
-
private Long id;
-
private String name;
-
private String shortName;
-
private I18nLanguageDTO language;
-
private I18nCountryDTO country;
-
private TimeZoneDTO timezone;
public UserSimpleDTO() {
- this(null, null, null, null, null);
+ this(null, null, null, null, null);
}
public UserSimpleDTO(final String name, final String shortName, final I18nLanguageDTO language,
- final I18nCountryDTO country, final TimeZoneDTO timezone) {
- this.name = name;
- this.shortName = shortName;
- this.language = language;
- this.country = country;
- this.timezone = timezone;
+ final I18nCountryDTO country, final TimeZoneDTO timezone) {
+ this.name = name;
+ this.shortName = shortName;
+ this.language = language;
+ this.country = country;
+ this.timezone = timezone;
}
@Override
public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- final UserSimpleDTO other = (UserSimpleDTO) obj;
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ final UserSimpleDTO other = (UserSimpleDTO) obj;
if (id == null) {
if (other.id != null) {
return false;
@@ -64,71 +58,75 @@
} else if (!id.equals(other.id)) {
return false;
}
- if (shortName == null) {
- if (other.shortName != null) {
- return false;
- }
- } else if (!shortName.equals(other.shortName)) {
- return false;
- }
- return true;
+ if (shortName == null) {
+ if (other.shortName != null) {
+ return false;
+ }
+ } else if (!shortName.equals(other.shortName)) {
+ return false;
+ }
+ return true;
}
public I18nCountryDTO getCountry() {
- return country;
+ return country;
}
public Long getId() {
- return id;
+ return id;
}
public I18nLanguageDTO getLanguage() {
- return language;
+ return language;
}
public String getName() {
- return name;
+ return name;
}
public String getShortName() {
- return shortName;
+ return shortName;
}
public TimeZoneDTO getTimezone() {
- return timezone;
+ return timezone;
}
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
+ final int prime = 31;
+ int result = 1;
result = prime * result + (id == null ? 0 : id.hashCode());
- result = prime * result + (shortName == null ? 0 : shortName.hashCode());
- return result;
+ result = prime * result + (shortName == null ? 0 : shortName.hashCode());
+ return result;
}
public void setCountry(final I18nCountryDTO country) {
- this.country = country;
+ this.country = country;
}
public void setId(final Long id) {
- this.id = id;
+ this.id = id;
}
public void setLanguage(final I18nLanguageDTO language) {
- this.language = language;
+ this.language = language;
}
public void setName(final String name) {
- this.name = name;
+ this.name = name;
}
public void setShortName(final String shortName) {
- this.shortName = shortName;
+ this.shortName = shortName;
}
public void setTimezone(final TimeZoneDTO timezone) {
- this.timezone = timezone;
+ this.timezone = timezone;
}
+ public String toString() {
+ return "UserSimpleDTO(" + shortName + ")";
+ }
+
}
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-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -283,7 +283,12 @@
register(Singleton.class, new Factory<TextEditor>(TextEditor.class) {
public TextEditor create() {
- final TextEditorPresenter presenter = new TextEditorPresenter(null, true);
+ final ActionToolbarPanel<StateToken> contentNavigatorToolbar = new ActionToolbarPanel<StateToken>(
+ ActionToolbarPanel.Position.content, $$(ActionManager.class), $(WorkspaceSkeleton.class));
+ final ActionToolbar<StateToken> toolbar = new ActionToolbarPresenter<StateToken>(
+ contentNavigatorToolbar);
+ final TextEditorPresenter presenter = new TextEditorPresenter(true, toolbar,
+ $(I18nUITranslationService.class));
final TextEditorPanel panel = new TextEditorPanel(presenter, i18n, $(WorkspaceSkeleton.class));
presenter.init(panel);
return presenter;
@@ -334,14 +339,14 @@
final ActionToolbarPanel<StateToken> contextNavigatorToolbar = new ActionToolbarPanel<StateToken>(
ActionToolbarPanel.Position.context, $$(ActionManager.class), $(WorkspaceSkeleton.class));
final ActionToolbar<StateToken> toolbar = new ActionToolbarPresenter<StateToken>(
- contextNavigatorToolbar, $(ContentActionRegistry.class));
+ contextNavigatorToolbar);
final ContextNavigatorPresenter presenter = new ContextNavigatorPresenter($(StateManager.class),
$(Session.class), $$(ContentServiceAsync.class), i18n, $(EntityTitle.class),
$(ContentIconsRegistry.class), $(DragDropContentRegistry.class), toolbar,
$(ContextActionRegistry.class));
final ContextNavigatorPanel panel = new ContextNavigatorPanel(presenter, i18n,
- $(WorkspaceSkeleton.class), $(ActionManager.class), $(WsThemePresenter.class));
+ $(WorkspaceSkeleton.class), $(ActionManager.class));
presenter.init(panel);
return presenter;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -33,8 +33,6 @@
void addSiteToken(String token, Listener<StateToken> whenToken);
- void gotoContainer(Long containerId);
-
void gotoToken(StateToken state);
void gotoToken(String token);
@@ -51,7 +49,7 @@
void removeSiteToken(String token);
- void setRetrievedState(StateDTO content);
+ void setRetrievedState(StateDTO state);
void setSocialNetwork(SocialNetworkResultDTO socialNet);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -63,7 +63,11 @@
this.onSocialNetworkChanged = new Event<StateDTO>("onSocialNetworkChanged");
session.onUserSignIn(new Listener<UserInfoDTO>() {
public void onEvent(final UserInfoDTO parameter) {
- restorePreviousState();
+ if (oldState != null) {
+ restorePreviousState();
+ } else {
+ reload();
+ }
}
});
session.onUserSignOut(new Listener0() {
@@ -78,14 +82,8 @@
siteTokens.put(token, listener);
}
- public void gotoContainer(final Long containerId) {
- final StateToken newStateToken = session.getCurrentState().getStateToken().clone();
- newStateToken.clearDocument();
- newStateToken.setFolder(containerId);
- gotoToken(newStateToken);
- }
-
public void gotoToken(final StateToken state) {
+ Log.debug("StateManager: history goto-token newItem (" + state + ")");
history.newItem(state.getEncoded());
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRights.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRights.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRights.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -25,38 +25,41 @@
boolean isEditable;
boolean isVisible;
+ public AccessRights() {
+ this(false, false, false);
+ }
+
public AccessRights(final boolean isAdministrable, final boolean isEditable, final boolean isVisible) {
this.isAdministrable = isAdministrable;
this.isEditable = isEditable;
this.isVisible = isVisible;
}
- public AccessRights() {
- this(false, false, false);
- }
-
public boolean isAdministrable() {
return isAdministrable;
}
+ public boolean isEditable() {
+ return isEditable;
+ }
+
+ public boolean isVisible() {
+ return isVisible;
+ }
+
public void setAdministrable(final boolean isAdministrable) {
this.isAdministrable = isAdministrable;
}
- public boolean isEditable() {
- return isEditable;
- }
-
public void setEditable(final boolean isEditable) {
this.isEditable = isEditable;
}
- public boolean isVisible() {
- return isVisible;
- }
-
public void setVisible(final boolean isVisible) {
this.isVisible = isVisible;
}
+ public String toString() {
+ return "AccessRights[a: " + isAdministrable + ", e: " + isEditable + ", v: " + isVisible + "]";
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/AccessLists.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/AccessLists.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/AccessLists.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -32,16 +32,16 @@
@Entity
@Table(name = "access_lists")
public class AccessLists {
- @Id
- @GeneratedValue
- private Long id;
-
@OneToOne(cascade = CascadeType.ALL)
protected GroupList admins;
+
@OneToOne(cascade = CascadeType.ALL)
protected GroupList editors;
@OneToOne(cascade = CascadeType.ALL)
protected GroupList viewers;
+ @Id
+ @GeneratedValue
+ private Long id;
public AccessLists() {
this.admins = new GroupList();
@@ -49,14 +49,6 @@
this.viewers = new GroupList();
}
- public Long getId() {
- return id;
- }
-
- public void setId(final Long id) {
- this.id = id;
- }
-
public void addAdmin(final Group group) {
admins.add(group);
}
@@ -69,6 +61,18 @@
viewers.add(group);
}
+ public GroupList getAdmins() {
+ return admins;
+ }
+
+ public GroupList getEditors() {
+ return editors;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
public GroupList getList(final AccessRol rol) {
if (rol == AccessRol.Administrator) {
return getAdmins();
@@ -79,14 +83,6 @@
}
}
- public GroupList getAdmins() {
- return admins;
- }
-
- public GroupList getEditors() {
- return editors;
- }
-
public GroupList getViewers() {
return viewers;
}
@@ -102,4 +98,13 @@
public void removeViewer(final Group group) {
viewers.remove(group);
}
+
+ public void setId(final Long id) {
+ this.id = id;
+ }
+
+ @Override
+ public String toString() {
+ return "AccessList[admins :" + admins + "; editors: " + editors + "; viewers: " + viewers + "]";
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -281,4 +281,7 @@
this.workspaceTheme = workspaceTheme;
}
+ public String toString() {
+ return "Group[" + shortName + "]";
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupList.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupList.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupList.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -39,80 +39,88 @@
@Table(name = "group_list")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public class GroupList {
+ @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
+ List<Group> list;
+
@Id
@GeneratedValue
private Long id;
- @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
- List<Group> list;
-
@Enumerated(EnumType.ORDINAL)
@Basic
private GroupListMode mode;
public GroupList() {
- this(new ArrayList<Group>());
- this.mode = GroupListMode.NORMAL;
+ this(new ArrayList<Group>());
+ this.mode = GroupListMode.NORMAL;
}
public GroupList(final List<Group> list) {
- this.list = list;
+ this.list = list;
}
- public Long getId() {
- return id;
+ public void add(final Group group) {
+ // No group duplicate
+ // TODO: Get this outside Domain?
+ if (!list.contains(group)) {
+ list.add(group);
+ }
+ // TODO: Get this outside Domain?
+ if (getMode() == GroupListMode.NOBODY) {
+ setMode(GroupListMode.NORMAL);
+ }
}
- public void setId(final Long id) {
- this.id = id;
+ public ArrayList<Group> duplicate() {
+ return new ArrayList<Group>(list);
}
- public List<Group> getList() {
- return list;
+ public Long getId() {
+ return id;
}
- public void setList(final List<Group> list) {
- this.list = list;
+ public List<Group> getList() {
+ return list;
}
- public void add(final Group group) {
- // No group duplicate
- // TODO: Get this outside Domain?
- if (!list.contains(group)) {
- list.add(group);
- }
- // TODO: Get this outside Domain?
- if (getMode() == GroupListMode.NOBODY) {
- setMode(GroupListMode.NORMAL);
- }
+ public GroupListMode getMode() {
+ return mode;
}
public boolean includes(final Group group) {
- return mode.checkIfIncludes(group, this.list);
+ return mode.checkIfIncludes(group, this.list);
}
- public ArrayList<Group> duplicate() {
- return new ArrayList<Group>(list);
+ public boolean isEmpty() {
+ return list.size() == 0;
}
- public boolean isEmpty() {
- return list.size() == 0;
+ public void remove(final Group group) {
+ list.remove(group);
+ // TODO: Get this outside Domain?
+ if (list.isEmpty()) {
+ setMode(GroupListMode.NOBODY);
+ }
}
- public GroupListMode getMode() {
- return mode;
+ public void setId(final Long id) {
+ this.id = id;
}
+ public void setList(final List<Group> list) {
+ this.list = list;
+ }
+
public void setMode(final GroupListMode mode) {
- this.mode = mode;
+ this.mode = mode;
}
- public void remove(final Group group) {
- list.remove(group);
- // TODO: Get this outside Domain?
- if (list.isEmpty()) {
- setMode(GroupListMode.NOBODY);
- }
+ public String toString() {
+ String groupString = "";
+ for (final Group group : list) {
+ groupString = groupString + group.getShortName() + ", ";
+ }
+ return "Group[(" + mode + "): " + groupString + "]";
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/I18nLanguage.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/I18nLanguage.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/I18nLanguage.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -103,179 +103,184 @@
private String scope;
public I18nLanguage() {
- this(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
+ this(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
}
+ // Only for tests
+ public I18nLanguage(final Long id, final String englishName, final String nativeName, final String code) {
+ this.id = id;
+ this.englishName = englishName;
+ this.nativeName = nativeName;
+ this.code = code;
+ }
+
// code is iso6391 || iso6392 || rfc3306 (see DatabaInicializer)
public I18nLanguage(final Long id, final String code, final String direction, final String englishName,
- final String englishNameLocale, final String englishNameModifier, final String iso6391,
- final String iso6392, final String iso6393, final Boolean macroLanguage, final String nativeName,
- final String nativeNameLocale, final String nativeNameModifier, final String pluralization,
- final String rfc3066, final String scope) {
- this.id = id;
- this.iso6391 = iso6391;
- this.iso6392 = iso6392;
- this.iso6393 = iso6393;
- this.rfc3066 = rfc3066;
- this.englishName = englishName;
- this.englishNameLocale = englishNameLocale;
- this.englishNameModifier = englishNameModifier;
- this.nativeName = nativeName;
- this.nativeNameLocale = nativeNameLocale;
- this.nativeNameModifier = nativeNameModifier;
- this.macroLanguage = macroLanguage;
- this.direction = direction;
- this.pluralization = pluralization;
- this.scope = scope;
- this.code = code;
+ final String englishNameLocale, final String englishNameModifier, final String iso6391,
+ final String iso6392, final String iso6393, final Boolean macroLanguage, final String nativeName,
+ final String nativeNameLocale, final String nativeNameModifier, final String pluralization,
+ final String rfc3066, final String scope) {
+ this.id = id;
+ this.iso6391 = iso6391;
+ this.iso6392 = iso6392;
+ this.iso6393 = iso6393;
+ this.rfc3066 = rfc3066;
+ this.englishName = englishName;
+ this.englishNameLocale = englishNameLocale;
+ this.englishNameModifier = englishNameModifier;
+ this.nativeName = nativeName;
+ this.nativeNameLocale = nativeNameLocale;
+ this.nativeNameModifier = nativeNameModifier;
+ this.macroLanguage = macroLanguage;
+ this.direction = direction;
+ this.pluralization = pluralization;
+ this.scope = scope;
+ this.code = code;
}
- // Only for tests
- public I18nLanguage(final Long id, final String englishName, final String nativeName, final String code) {
- this.id = id;
- this.englishName = englishName;
- this.nativeName = nativeName;
- this.code = code;
+ @Finder(query = "FROM I18nLanguage l WHERE code = :language")
+ public I18nLanguage findByCode(@Named("language")
+ final String language) {
+ return null;
}
- public Long getId() {
- return this.id;
+ @Finder(query = "FROM I18nLanguage")
+ public List<I18nLanguage> getAll() {
+ return null;
}
- public void setId(final Long id) {
- this.id = id;
+ public String getCode() {
+ return code;
}
- public String getIso6391() {
- return this.iso6391;
+ public String getDirection() {
+ return this.direction;
}
- public void setIso6391(final String iso6391) {
- this.iso6391 = iso6391;
+ public String getEnglishName() {
+ return this.englishName;
}
- public String getIso6392() {
- return this.iso6392;
+ public String getEnglishNameLocale() {
+ return this.englishNameLocale;
}
- public void setIso6392(final String iso6392) {
- this.iso6392 = iso6392;
+ public String getEnglishNameModifier() {
+ return this.englishNameModifier;
}
- public String getIso6393() {
- return this.iso6393;
+ public Long getId() {
+ return this.id;
}
- public void setIso6393(final String iso6393) {
- this.iso6393 = iso6393;
+ public String getIso6391() {
+ return this.iso6391;
}
- public String getRfc3066() {
- return this.rfc3066;
+ public String getIso6392() {
+ return this.iso6392;
}
- public void setRfc3066(final String rfc3066) {
- this.rfc3066 = rfc3066;
+ public String getIso6393() {
+ return this.iso6393;
}
- public String getEnglishName() {
- return this.englishName;
+ public Boolean getMacroLanguage() {
+ return this.macroLanguage;
}
- public void setEnglishName(final String englishName) {
- this.englishName = englishName;
+ public String getNativeName() {
+ return this.nativeName;
}
- public String getEnglishNameLocale() {
- return this.englishNameLocale;
+ public String getNativeNameLocale() {
+ return this.nativeNameLocale;
}
- public void setEnglishNameLocale(final String englishNameLocale) {
- this.englishNameLocale = englishNameLocale;
+ public String getNativeNameModifier() {
+ return this.nativeNameModifier;
}
- public String getEnglishNameModifier() {
- return this.englishNameModifier;
+ public String getPluralization() {
+ return this.pluralization;
}
- public void setEnglishNameModifier(final String englishNameModifier) {
- this.englishNameModifier = englishNameModifier;
+ public String getRfc3066() {
+ return this.rfc3066;
}
- public String getNativeName() {
- return this.nativeName;
+ public String getScope() {
+ return this.scope;
}
- public void setNativeName(final String nativeName) {
- this.nativeName = nativeName;
+ @Column(unique = true)
+ public void setCode(final String code) {
+ this.code = code;
}
- public String getNativeNameLocale() {
- return this.nativeNameLocale;
+ public void setDirection(final String direction) {
+ this.direction = direction;
}
- public void setNativeNameLocale(final String nativeNameLocale) {
- this.nativeNameLocale = nativeNameLocale;
+ public void setEnglishName(final String englishName) {
+ this.englishName = englishName;
}
- public String getNativeNameModifier() {
- return this.nativeNameModifier;
+ public void setEnglishNameLocale(final String englishNameLocale) {
+ this.englishNameLocale = englishNameLocale;
}
- public void setNativeNameModifier(final String nativeNameModifier) {
- this.nativeNameModifier = nativeNameModifier;
+ public void setEnglishNameModifier(final String englishNameModifier) {
+ this.englishNameModifier = englishNameModifier;
}
- public Boolean getMacroLanguage() {
- return this.macroLanguage;
+ public void setId(final Long id) {
+ this.id = id;
}
- public void setMacroLanguage(final Boolean macroLanguage) {
- this.macroLanguage = macroLanguage;
+ public void setIso6391(final String iso6391) {
+ this.iso6391 = iso6391;
}
- public String getDirection() {
- return this.direction;
+ public void setIso6392(final String iso6392) {
+ this.iso6392 = iso6392;
}
- public void setDirection(final String direction) {
- this.direction = direction;
+ public void setIso6393(final String iso6393) {
+ this.iso6393 = iso6393;
}
- public String getPluralization() {
- return this.pluralization;
+ public void setMacroLanguage(final Boolean macroLanguage) {
+ this.macroLanguage = macroLanguage;
}
- public void setPluralization(final String pluralization) {
- this.pluralization = pluralization;
+ public void setNativeName(final String nativeName) {
+ this.nativeName = nativeName;
}
- public String getScope() {
- return this.scope;
+ public void setNativeNameLocale(final String nativeNameLocale) {
+ this.nativeNameLocale = nativeNameLocale;
}
- public void setScope(final String scope) {
- this.scope = scope;
+ public void setNativeNameModifier(final String nativeNameModifier) {
+ this.nativeNameModifier = nativeNameModifier;
}
- @Finder(query = "FROM I18nLanguage l WHERE code = :language")
- public I18nLanguage findByCode(@Named("language")
- final String language) {
- return null;
+ public void setPluralization(final String pluralization) {
+ this.pluralization = pluralization;
}
- public String getCode() {
- return code;
+ public void setRfc3066(final String rfc3066) {
+ this.rfc3066 = rfc3066;
}
- @Column(unique = true)
- public void setCode(final String code) {
- this.code = code;
+ public void setScope(final String scope) {
+ this.scope = scope;
}
- @Finder(query = "FROM I18nLanguage")
- public List<I18nLanguage> getAll() {
- return null;
+ @Override
+ public String toString() {
+ return "I18nLanguage[" + englishName + "]";
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/I18nTranslation.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/I18nTranslation.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/I18nTranslation.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -49,20 +49,20 @@
@Indexed
@Table(name = "globalize_translations")
@NamedQueries( {
- @NamedQuery(name = "untranslated", query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :language and text=null"),
- @NamedQuery(name = "translated", query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :language and text!=null"),
- @NamedQuery(name = "untranslatedcount", query = "SELECT COUNT(gt.id) FROM I18nTranslation gt WHERE gt.language = :language and text=null"),
- @NamedQuery(name = "translatedcount", query = "SELECT COUNT(gt.id) FROM I18nTranslation gt WHERE gt.language = :language and text!=null") })
+ @NamedQuery(name = "untranslated", query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :language and text=null"),
+ @NamedQuery(name = "translated", query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :language and text!=null"),
+ @NamedQuery(name = "untranslatedcount", query = "SELECT COUNT(gt.id) FROM I18nTranslation gt WHERE gt.language = :language and text=null"),
+ @NamedQuery(name = "translatedcount", query = "SELECT COUNT(gt.id) FROM I18nTranslation gt WHERE gt.language = :language and text!=null") })
public class I18nTranslation implements HasId {
+ public static final String DEF_NAMESPACE = "kune_core";
+ public static final Integer DEF_PLUR_INDEX = 1;
+ public static final String DEFAULT_LANG = "en";
+ public static final String UNTRANSLATED_VALUE = null;
private static final String TRANSLATED_QUERY = "translated";
private static final String UNTRANSLATED_QUERY = "untranslated";
private static final String TRANSLATED_COUNT_QUERY = "translatedcount";
private static final String UNTRANSLATED_COUNT_QUERY = "untranslatedcount";
- public static final String DEF_NAMESPACE = "kune_core";
- public static final Integer DEF_PLUR_INDEX = 1;
- public static final String DEFAULT_LANG = "en";
- public static final String UNTRANSLATED_VALUE = null;
@Id
@GeneratedValue
@@ -96,115 +96,112 @@
private String text;
public I18nTranslation() {
- this(null, null, null, null, null, null, null, null);
+ this(null, null, null, null, null, null, null, null);
}
- public I18nTranslation(final String facet, final Integer itemId, final Integer pluralizationIndex,
- final String tableName, final String text, final String trKey, final String type,
- final I18nLanguage language) {
- this.type = type;
- this.trKey = trKey;
- this.tableName = tableName;
- this.itemId = itemId;
- this.facet = facet;
- this.language = language;
- this.pluralizationIndex = pluralizationIndex;
- this.text = text;
- }
-
public I18nTranslation(final String trKey, final I18nLanguage language, final String text) {
- this("", null, DEF_PLUR_INDEX, "", text, trKey, DEF_NAMESPACE, language);
+ this("", null, DEF_PLUR_INDEX, "", text, trKey, DEF_NAMESPACE, language);
}
- public Long getId() {
- return this.id;
+ public I18nTranslation(final String facet, final Integer itemId, final Integer pluralizationIndex,
+ final String tableName, final String text, final String trKey, final String type,
+ final I18nLanguage language) {
+ this.type = type;
+ this.trKey = trKey;
+ this.tableName = tableName;
+ this.itemId = itemId;
+ this.facet = facet;
+ this.language = language;
+ this.pluralizationIndex = pluralizationIndex;
+ this.text = text;
}
- public void setId(final Long id) {
- this.id = id;
+ public I18nTranslation cloneForNewLanguage() {
+ final I18nTranslation clone = new I18nTranslation();
+ clone.type = type;
+ clone.trKey = trKey;
+ clone.tableName = tableName;
+ clone.itemId = itemId;
+ clone.facet = facet;
+ clone.language = null;
+ clone.pluralizationIndex = pluralizationIndex;
+ clone.text = null;
+ return clone;
}
- public String getType() {
- return this.type;
+ @Finder(query = "SELECT gt FROM I18nTranslation gt JOIN gt.language gl WHERE gl.code = :language")
+ public List<I18nTranslation> findByLanguage(@Named("language")
+ final String language) {
+ return null;
}
- public void setType(final String type) {
- this.type = type;
+ public String getFacet() {
+ return this.facet;
}
- public String getTrKey() {
- return this.trKey;
+ public Long getId() {
+ return this.id;
}
- public void setTrKey(final String trKey) {
- this.trKey = trKey;
- }
-
- public String getTableName() {
- return this.tableName;
- }
-
- public void setTableName(final String tableName) {
- this.tableName = tableName;
- }
-
public Integer getItemId() {
- return this.itemId;
+ return this.itemId;
}
- public void setItemId(final Integer itemId) {
- this.itemId = itemId;
+ public I18nLanguage getLanguage() {
+ return language;
}
- public String getFacet() {
- return this.facet;
+ @Finder(query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :deflanguage AND gt.trKey NOT IN (SELECT gt.trKey FROM I18nTranslation gt WHERE gt.language = :language)")
+ public List<I18nTranslation> getNonExistentFromDefault(@Named("deflanguage")
+ final I18nLanguage deflanguage, @Named("language")
+ final I18nLanguage language) {
+ return null;
}
- public void setFacet(final String facet) {
- this.facet = facet;
- }
-
public Integer getPluralizationIndex() {
- return this.pluralizationIndex;
+ return this.pluralizationIndex;
}
- public void setPluralizationIndex(final Integer pluralizationIndex) {
- this.pluralizationIndex = pluralizationIndex;
+ public String getTableName() {
+ return this.tableName;
}
public String getText() {
- return this.text;
+ return this.text;
}
- public void setText(final String text) {
- this.text = text;
+ @Finder(namedQuery = TRANSLATED_QUERY)
+ public List<I18nTranslation> getTranslatedLexicon(@Named("language")
+ final I18nLanguage language) {
+ return null;
}
- public I18nLanguage getLanguage() {
- return language;
+ @Finder(namedQuery = TRANSLATED_QUERY)
+ public List<I18nTranslation> getTranslatedLexicon(@Named("language")
+ final I18nLanguage language, @FirstResult
+ final int first, @MaxResults
+ final int max) {
+ return null;
}
- public void setLanguage(final I18nLanguage language) {
- this.language = language;
+ @Finder(namedQuery = TRANSLATED_COUNT_QUERY)
+ public Long getTranslatedLexiconCount(@Named("language")
+ final I18nLanguage language) {
+ return null;
}
- @Finder(query = "SELECT gt FROM I18nTranslation gt JOIN gt.language gl WHERE gl.code = :language")
- public List<I18nTranslation> findByLanguage(@Named("language")
- final String language) {
- return null;
+ public String getTrKey() {
+ return this.trKey;
}
- @Finder(query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :deflanguage AND gt.trKey NOT IN (SELECT gt.trKey FROM I18nTranslation gt WHERE gt.language = :language)")
- public List<I18nTranslation> getNonExistentFromDefault(@Named("deflanguage")
- final I18nLanguage deflanguage, @Named("language")
- final I18nLanguage language) {
- return null;
+ public String getType() {
+ return this.type;
}
@Finder(namedQuery = UNTRANSLATED_QUERY)
public List<I18nTranslation> getUnstranslatedLexicon(@Named("language")
final I18nLanguage language) {
- return null;
+ return null;
}
@Finder(namedQuery = UNTRANSLATED_QUERY)
@@ -212,46 +209,54 @@
final I18nLanguage language, @FirstResult
final int first, @MaxResults
final int max) {
- return null;
+ return null;
}
@Finder(namedQuery = UNTRANSLATED_COUNT_QUERY)
public Long getUnstranslatedLexiconCount(@Named("language")
final I18nLanguage language) {
- return null;
+ return null;
}
- @Finder(namedQuery = TRANSLATED_QUERY)
- public List<I18nTranslation> getTranslatedLexicon(@Named("language")
- final I18nLanguage language) {
- return null;
+ public void setFacet(final String facet) {
+ this.facet = facet;
}
- @Finder(namedQuery = TRANSLATED_QUERY)
- public List<I18nTranslation> getTranslatedLexicon(@Named("language")
- final I18nLanguage language, @FirstResult
- final int first, @MaxResults
- final int max) {
- return null;
+ public void setId(final Long id) {
+ this.id = id;
}
- @Finder(namedQuery = TRANSLATED_COUNT_QUERY)
- public Long getTranslatedLexiconCount(@Named("language")
- final I18nLanguage language) {
- return null;
+ public void setItemId(final Integer itemId) {
+ this.itemId = itemId;
}
- public I18nTranslation cloneForNewLanguage() {
- I18nTranslation clone = new I18nTranslation();
- clone.type = type;
- clone.trKey = trKey;
- clone.tableName = tableName;
- clone.itemId = itemId;
- clone.facet = facet;
- clone.language = null;
- clone.pluralizationIndex = pluralizationIndex;
- clone.text = null;
- return clone;
+ public void setLanguage(final I18nLanguage language) {
+ this.language = language;
}
+ public void setPluralizationIndex(final Integer pluralizationIndex) {
+ this.pluralizationIndex = pluralizationIndex;
+ }
+
+ public void setTableName(final String tableName) {
+ this.tableName = tableName;
+ }
+
+ public void setText(final String text) {
+ this.text = text;
+ }
+
+ public void setTrKey(final String trKey) {
+ this.trKey = trKey;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return "I18nTranslation[" + trKey + " (" + language + ") " + text + "]";
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/SocialNetwork.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/SocialNetwork.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/SocialNetwork.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -41,80 +41,83 @@
GroupList pendingCollaborators;
public SocialNetwork() {
- accessLists = new AccessLists();
- pendingCollaborators = new GroupList();
+ accessLists = new AccessLists();
+ pendingCollaborators = new GroupList();
}
- public Long getId() {
- return id;
+ public void addAdmin(final Group group) {
+ accessLists.addAdmin(group);
}
- public GroupList getPendingCollaborators() {
- return pendingCollaborators;
+ public void addCollaborator(final Group group) {
+ accessLists.addEditor(group);
}
- public void setPendingCollaborators(final GroupList pendingCollaborators) {
- this.pendingCollaborators = pendingCollaborators;
+ public void addPendingCollaborator(final Group group) {
+ pendingCollaborators.add(group);
}
- public void setAccessLists(final AccessLists accessList) {
- this.accessLists = accessList;
+ public void addViewer(final Group group) {
+ accessLists.addViewer(group);
}
- public void setId(final Long id) {
- this.id = id;
+ public AccessLists getAccessLists() {
+ return accessLists;
}
- public void addAdmin(final Group group) {
- accessLists.addAdmin(group);
+ public Long getId() {
+ return id;
}
- public void addCollaborator(final Group group) {
- accessLists.addEditor(group);
+ public GroupList getPendingCollaborators() {
+ return pendingCollaborators;
}
- public void addViewer(final Group group) {
- accessLists.addViewer(group);
+ public boolean isAdmin(final Group group) {
+ return accessLists.getAdmins().includes(group);
}
- public void addPendingCollaborator(final Group group) {
- pendingCollaborators.add(group);
+ public boolean isCollab(final Group group) {
+ return accessLists.getEditors().includes(group);
}
+ public boolean isPendingCollab(final Group group) {
+ return pendingCollaborators.getList().contains(group);
+ }
+
+ public boolean isViewer(final Group group) {
+ return accessLists.getViewers().includes(group);
+ }
+
public void removeAdmin(final Group group) {
- accessLists.removeAdmin(group);
+ accessLists.removeAdmin(group);
}
public void removeCollaborator(final Group group) {
- accessLists.removeEditor(group);
+ accessLists.removeEditor(group);
}
- public void removeViewer(final Group group) {
- accessLists.removeViewer(group);
- }
-
public void removePendingCollaborator(final Group group) {
- pendingCollaborators.getList().remove(group);
+ pendingCollaborators.getList().remove(group);
}
- public AccessLists getAccessLists() {
- return accessLists;
+ public void removeViewer(final Group group) {
+ accessLists.removeViewer(group);
}
- public boolean isAdmin(final Group group) {
- return accessLists.getAdmins().includes(group);
+ public void setAccessLists(final AccessLists accessList) {
+ this.accessLists = accessList;
}
- public boolean isCollab(final Group group) {
- return accessLists.getEditors().includes(group);
+ public void setId(final Long id) {
+ this.id = id;
}
- public boolean isViewer(final Group group) {
- return accessLists.getViewers().includes(group);
+ public void setPendingCollaborators(final GroupList pendingCollaborators) {
+ this.pendingCollaborators = pendingCollaborators;
}
- public boolean isPendingCollab(final Group group) {
- return pendingCollaborators.getList().contains(group);
+ public String toString() {
+ return "SocialNetwork[accessList: " + accessLists + "; pendingsCollabs: " + pendingCollaborators + "]";
}
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -213,4 +213,7 @@
this.userGroup = userGroup;
}
+ public String toString() {
+ return "User[" + shortName + "]";
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/state/State.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/state/State.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/state/State.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -293,4 +293,7 @@
this.typeId = typeId;
}
+ public String toString() {
+ return "State[" + stateToken + "/" + typeId + "]";
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/Kune-Workspace.gwt.xml
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/Kune-Workspace.gwt.xml 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/workspace/Kune-Workspace.gwt.xml 2008-10-01 01:29:01 UTC (rev 898)
@@ -1,27 +1,47 @@
<module>
- <inherits name='org.ourproject.kune.platf.Kune-Platform' />
- <inherits name="com.google.gwt.core.Core" />
- <inherits name="com.google.gwt.user.UserAgent" />
- <!-- RTE css inject -->
+ <inherits name='org.ourproject.kune.platf.Kune-Platform' />
+ <inherits name="com.google.gwt.core.Core" />
+ <inherits name="com.google.gwt.user.UserAgent" />
+ <!-- RTE css inject -->
+ <!-- See gwt-user: com/google/gwt/user/RichText.gwt.xml -->
- <replace-with
- class="org.ourproject.kune.workspace.client.editor.WrappedRichTextAreaImplIE6">
- <when-type-is
- class="com.google.gwt.user.client.ui.impl.RichTextAreaImpl" />
- <when-property-is name="user.agent" value="ie6" />
- </replace-with>
+ <!-- IE-specific implementation -->
+ <replace-with
+ class="org.ourproject.kune.workspace.client.editor.WrappedRichTextAreaImplIE6">
+ <when-type-is
+ class="com.google.gwt.user.client.ui.impl.RichTextAreaImpl" />
+ <when-property-is name="user.agent" value="ie6" />
+ </replace-with>
- <replace-with
- class="org.ourproject.kune.workspace.client.editor.WrappedRichTextAreaImplMozilla">
- <when-type-is
- class="com.google.gwt.user.client.ui.impl.RichTextAreaImpl" />
- <any>
- <when-property-is name="user.agent" value="gecko1_8" />
- <when-property-is name="user.agent" value="gecko" />
- </any>
- </replace-with>
+ <!-- Mozilla-specific implementation -->
+ <replace-with
+ class="org.ourproject.kune.workspace.client.editor.WrappedRichTextAreaImplMozilla">
+ <when-type-is
+ class="com.google.gwt.user.client.ui.impl.RichTextAreaImpl" />
+ <any>
+ <when-property-is name="user.agent" value="gecko1_8" />
+ <when-property-is name="user.agent" value="gecko" />
+ </any>
+ </replace-with>
- <!--
- TODO: .... same for Safari and Opera.
- -->
+ <!-- Safari-specific implementation -->
+ <replace-with
+ class="org.ourproject.kune.workspace.client.editor.WrappedRichTextAreaImplSafari">
+ <when-type-is
+ class="com.google.gwt.user.client.ui.impl.RichTextAreaImpl" />
+ <any>
+ <when-property-is name="user.agent" value="safari" />
+ </any>
+ </replace-with>
+
+ <!-- Opera-specific implementation -->
+ <replace-with
+ class="org.ourproject.kune.workspace.client.editor.WrappedRichTextAreaImplOpera">
+ <when-type-is
+ class="com.google.gwt.user.client.ui.impl.RichTextAreaImpl" />
+ <any>
+ <when-property-is name="user.agent" value="opera" />
+ </any>
+ </replace-with>
+
</module>
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -30,11 +30,8 @@
import org.ourproject.kune.platf.client.services.I18nTranslationService;
import org.ourproject.kune.workspace.client.site.Site;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-import org.ourproject.kune.workspace.client.themes.WsTheme;
-import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
import com.allen_sauer.gwt.log.client.Log;
-import com.calclab.suco.client.listener.Listener2;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
import com.gwtext.client.core.EventObject;
@@ -71,15 +68,10 @@
private final ContextNavigatorPresenter presenter;
public ContextNavigatorPanel(final ContextNavigatorPresenter presenter, final I18nTranslationService i18n,
- final WorkspaceSkeleton ws, final ActionManager actionManager, final WsThemePresenter wsTheme) {
+ final WorkspaceSkeleton ws, final ActionManager actionManager) {
this.presenter = presenter;
this.ws = ws;
this.actionManager = actionManager;
- wsTheme.onThemeChanged(new Listener2<WsTheme, WsTheme>() {
- public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) {
- setTheme(oldTheme, newTheme);
- }
- });
contextMenus = new HashMap<String, Menu>();
fireOnTextChange = true;
@@ -203,16 +195,6 @@
}
}
- public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
- if (treePanel != null) {
- if (oldTheme != null) {
- final String previousThemeS = oldTheme.toString();
- treePanel.removeStyleName("k-entity-context-" + previousThemeS);
- }
- treePanel.addStyleName("k-entity-context-" + newTheme);
- }
- }
-
private void createItemMenu(final String nodeId, final ActionItemCollection<StateToken> actionCollection) {
DeferredCommand.addCommand(new Command() {
public void execute() {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditor.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditor.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -20,22 +20,17 @@
package org.ourproject.kune.workspace.client.editor;
-import org.ourproject.kune.platf.client.View;
+import com.calclab.suco.client.listener.Listener;
+import com.calclab.suco.client.listener.Listener0;
public interface TextEditor {
- public String getContent();
+ void editContent(String content, Listener<String> onSave, Listener0 onEditCancelled);
- public View getView();
+ void onSaved();
- public void onSaved();
+ void onSaveFailed();
- public void onSaveFailed();
+ void reset();
- public void reset();
-
- public void setContent(String content);
-
- public void setToolbarVisible(boolean visible);
-
}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorListener.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorListener.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorListener.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -1,29 +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.workspace.client.editor;
-
-public interface TextEditorListener {
-
- void onEditCancelled();
-
- void onSave(String text);
-
-}
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-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -22,17 +22,20 @@
import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.ui.DefaultBorderLayout;
+import org.ourproject.kune.workspace.client.skel.Toolbar;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.WindowResizeListener;
-import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.RichTextArea;
import com.gwtext.client.widgets.MessageBox;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.layout.FitLayout;
-public class TextEditorPanel extends Composite implements TextEditorView {
+public class TextEditorPanel implements TextEditorView {
private static final String BACKCOLOR_ENABLED = "#FFF";
private static final String BACKCOLOR_DISABLED = "#CCC";
private final RichTextArea gwtRTarea;
@@ -40,18 +43,31 @@
private final TextEditorPresenter presenter;
private final Timer saveTimer;
private final I18nTranslationService i18n;
+ private final DefaultBorderLayout mainPanel;
+ private final WorkspaceSkeleton ws;
public TextEditorPanel(final TextEditorPresenter presenter, final I18nTranslationService i18n,
final WorkspaceSkeleton ws) {
-
this.presenter = presenter;
this.i18n = i18n;
+ this.ws = ws;
+ mainPanel = new DefaultBorderLayout();
+ final Panel centerPanel = new Panel();
+ centerPanel.setLayout(new FitLayout());
gwtRTarea = new RichTextArea();
- textEditorToolbar = new TextEditorToolbar(gwtRTarea, presenter, i18n, ws);
- initWidget(gwtRTarea);
-
+ // centerPanel.add(gwtRTarea);
gwtRTarea.setWidth("97%");
gwtRTarea.addStyleName("kune-TexEditorPanel-TextArea");
+
+ final Toolbar editorTopBar = new Toolbar();
+ textEditorToolbar = new TextEditorToolbar(gwtRTarea, presenter, i18n);
+ editorTopBar.add(textEditorToolbar);
+ editorTopBar.addStyleName("k-toolbar-bottom-line");
+
+ // mainPanel.add(editorTopBar.getPanel(), Position.NORTH, false,
+ // DefaultBorderLayout.DEF_TOOLBAR_HEIGHT);
+ mainPanel.add(centerPanel, DefaultBorderLayout.Position.CENTER);
+
adjustSize("" + (Window.getClientHeight() - 265));
Window.addWindowResizeListener(new WindowResizeListener() {
public void onWindowResized(final int arg0, final int arg1) {
@@ -65,6 +81,15 @@
};
}
+ public void attach() {
+ // ws.getEntityWorkspace().setContent(mainPanel.getPanel());
+ ws.getEntityWorkspace().setContent(gwtRTarea);
+ }
+
+ public void detach() {
+ mainPanel.getPanel().removeFromParent();
+ }
+
public void editHTML(final boolean edit) {
textEditorToolbar.editHTML(edit);
}
@@ -119,10 +144,6 @@
textEditorToolbar.setTextSaveButton(text);
}
- public void setToolBarVisible(final boolean visible) {
- textEditorToolbar.setVisible(visible);
- }
-
public void showSaveBeforeDialog() {
MessageBox.confirm(i18n.t("Save confirmation"), i18n.t("Save before close?"), new MessageBox.ConfirmCallback() {
public void execute(final String btnID) {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -21,23 +21,50 @@
package org.ourproject.kune.workspace.client.editor;
import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.actions.ActionItem;
+import org.ourproject.kune.platf.client.actions.ActionItemCollection;
+import org.ourproject.kune.platf.client.actions.ActionToolbarButtonDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionToolbarPosition;
+import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import com.calclab.suco.client.listener.Listener;
+import com.calclab.suco.client.listener.Listener0;
+
public class TextEditorPresenter implements TextEditor {
private boolean editingHtml;
private TextEditorView view;
private boolean savePending;
private final boolean autoSave;
- private final TextEditorListener listener;
private boolean saveAndCloseConfirmed;
+ private Listener<String> onSave;
+ private Listener0 onEditCancelled;
+ private final ActionToolbar<StateToken> toolbar;
+ private ActionToolbarButtonDescriptor<StateToken> save;
+ private ActionToolbarButtonDescriptor<StateToken> close;
+ private final I18nUITranslationService i18n;
- public TextEditorPresenter(final TextEditorListener listener, final boolean isAutoSave) {
- this.listener = listener;
+ public TextEditorPresenter(final boolean isAutoSave, final ActionToolbar<StateToken> toolbar,
+ final I18nUITranslationService i18n) {
+ this.toolbar = toolbar;
autoSave = isAutoSave;
+ this.i18n = i18n;
savePending = false;
editingHtml = false;
saveAndCloseConfirmed = false;
+ createActions();
}
+ public void editContent(final String content, final Listener<String> onSave, final Listener0 onEditCancelled) {
+ this.onSave = onSave;
+ this.onEditCancelled = onEditCancelled;
+ toolbar.attach();
+ view.attach();
+ setContent(content);
+ }
+
public String getContent() {
return view.getHTML();
}
@@ -87,16 +114,10 @@
savePending = false;
saveAndCloseConfirmed = false;
view.setEnabledSaveButton(false);
+ view.detach();
+ toolbar.detach();
}
- public void setContent(final String html) {
- this.view.setHTML(html);
- }
-
- public void setToolbarVisible(final boolean visible) {
- view.setToolBarVisible(visible);
- }
-
protected void onCancel() {
if (savePending) {
view.saveTimerCancel();
@@ -108,7 +129,7 @@
protected void onCancelConfirmed() {
reset();
- listener.onEditCancelled();
+ onEditCancelled.onEvent();
}
protected void onEditHTML() {
@@ -128,6 +149,35 @@
}
protected void onSave() {
- listener.onSave(view.getHTML());
+ onSave.onEvent(view.getHTML());
}
+
+ private void createActions() {
+ save = new ActionToolbarButtonDescriptor<StateToken>(AccessRolDTO.Viewer, ActionToolbarPosition.topbar,
+ new Listener<StateToken>() {
+ public void onEvent(final StateToken token) {
+ onSave();
+ }
+ });
+ save.setTextDescription(i18n.tWithNT("Save", "used in button"));
+ // save.setIconUrl("images/");
+
+ close = new ActionToolbarButtonDescriptor<StateToken>(AccessRolDTO.Viewer, ActionToolbarPosition.topbar,
+ new Listener<StateToken>() {
+ public void onEvent(final StateToken token) {
+ onCancel();
+ }
+ });
+ close.setTextDescription(i18n.tWithNT("Close", "used in button"));
+ // close.setIconUrl("images/");
+
+ final ActionItemCollection<StateToken> collection = new ActionItemCollection<StateToken>();
+ collection.add(new ActionItem<StateToken>(save, null));
+ collection.add(new ActionItem<StateToken>(close, null));
+ toolbar.showActions(collection, true);
+ }
+
+ private void setContent(final String html) {
+ this.view.setHTML(html);
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorToolbar.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorToolbar.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorToolbar.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -30,7 +30,6 @@
import org.ourproject.kune.platf.client.ui.palette.ColorSelectListener;
import org.ourproject.kune.platf.client.ui.palette.WebSafePalettePanel;
import org.ourproject.kune.platf.client.ui.palette.WebSafePalettePresenter;
-import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
@@ -264,11 +263,9 @@
private final TextEditorImages images = (TextEditorImages) GWT.create(TextEditorImages.class);
private final EventListener listener = new EventListener();
-
private final RichTextArea richText;
private final RichTextArea.BasicFormatter basic;
private final RichTextArea.ExtendedFormatter extended;
-
private final VerticalPanel outer = new VerticalPanel();
private final HorizontalPanel topPanel = new HorizontalPanel();
private ToggleButton bold;
@@ -308,7 +305,7 @@
* the rich text area to be controlled
*/
public TextEditorToolbar(final RichTextArea richText, final TextEditorPresenter panelListener,
- final I18nTranslationService i18n, final WorkspaceSkeleton ws) {
+ final I18nTranslationService i18n) {
this.richText = richText;
this.i18n = i18n;
this.basic = richText.getBasicFormatter();
@@ -392,8 +389,7 @@
// i18n.t("Edit HTML")));
// }
- ws.getEntityWorkspace().getContentTopBar().add(this);
- super.setVisible(false);
+ // super.setVisible(false);
}
public void editHTML(final boolean edit) {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorView.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorView.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -24,34 +24,36 @@
public interface TextEditorView extends View {
- public void editHTML(boolean edit);
+ void attach();
- public String getHTML();
+ void detach();
- public String getText();
+ void editHTML(boolean edit);
- public View getToolBar();
+ String getHTML();
- public void saveTimerCancel();
+ String getText();
- public void scheduleSave(int delayMillis);
+ View getToolBar();
- public void setEnabled(boolean enabled);
+ void saveTimerCancel();
- public void setEnabledCancelButton(boolean enabled);
+ void scheduleSave(int delayMillis);
- public void setEnabledSaveButton(boolean enabled);
+ void setEnabled(boolean enabled);
- public void setHeight(String height);
+ void setEnabledCancelButton(boolean enabled);
- public void setHTML(String html);
+ void setEnabledSaveButton(boolean enabled);
- public void setText(String text);
+ void setHeight(String height);
- public void setTextSaveButton(String text);
+ void setHTML(String html);
- public void setToolBarVisible(boolean visible);
+ void setText(String text);
- public void showSaveBeforeDialog();
+ void setTextSaveButton(String text);
+ void showSaveBeforeDialog();
+
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/WrappedRichTextAreaImplIE6.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/WrappedRichTextAreaImplIE6.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/WrappedRichTextAreaImplIE6.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -31,17 +31,35 @@
*/
public class WrappedRichTextAreaImplIE6 extends RichTextAreaImplIE6 {
- public native void initElement()
- /*-{
+ @Override
+ public native void initElement() /*-{
var _this = this;
- window.setTimeout(function() {
+ _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImplStandard::initializing = true;
+
+ setTimeout(function() {
+ if (_this. at com.google.gwt.user.client.ui.impl.RichTextAreaImplStandard::initializing == false) {
+ return;
+ }
+
+ // Attempt to set the iframe document's body to 'contentEditable' mode.
+ // There's no way to know when the body will actually be available, so
+ // keep trying every so often until it is.
+ // Note: The body seems to be missing only rarely, so please don't remove
+ // this retry loop just because it's hard to reproduce.
var elem = _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImpl::elem;
var doc = elem.contentWindow.document;
+ if (!doc.body) {
+ // Retry in 50 ms. Faster would run the risk of pegging the CPU. Slower
+ // would increase the probability of a user-visible delay.
+ setTimeout(arguments.callee, 50);
+ return;
+ }
var ct = "<html><head><style>@import url('" + "css/richtext.css" + "');</style></head><body CONTENTEDITABLE='true'></body></html>" ;
doc.write( ct );
+ doc.body.contentEditable = true;
// Send notification that the iframe has reached design mode.
_this. at com.google.gwt.user.client.ui.impl.RichTextAreaImplStandard::onElementInitialized()();
}, 1);
- }-*/;
-}
\ No newline at end of file
+ }-*/;
+}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/WrappedRichTextAreaImplMozilla.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/WrappedRichTextAreaImplMozilla.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/WrappedRichTextAreaImplMozilla.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -31,51 +31,50 @@
*/
public class WrappedRichTextAreaImplMozilla extends RichTextAreaImplMozilla {
- public native void initElement()
- /*-{
- // Mozilla doesn't allow designMode to be set reliably until the iframe is
- // fully loaded.
- var _this = this;
- var iframe = _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImpl::elem;
+ @Override
+ public native void initElement() /*-{
+ // Mozilla doesn't allow designMode to be set reliably until the iframe is
+ // fully loaded.
+ var _this = this;
+ var iframe = _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImpl::elem;
+ _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImplStandard::initializing = true;
- iframe.onload = function() {
- // Some Mozillae have the nasty habit of calling onload again when you set
- // designMode, so let's avoid doing it more than once.
- iframe.onload = null;
+ iframe.onload = function() {
+ // Some Mozillae have the nasty habit of calling onload again when you set
+ // designMode, so let's avoid doing it more than once.
+ iframe.onload = null;
- // patch ccs inject:
+ // patch ccs inject:
- var doc = _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImpl::elem.contentWindow.document;
- head=doc.getElementsByTagName('head')[0];
- link=document.createElement('link');
- link.setAttribute('rel',"stylesheet");
- link.setAttribute('type',"text/css");
- link.setAttribute('href',"css/richtext.css" );
- head.appendChild(link);
+ var doc = _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImpl::elem.contentWindow.document;
+ head=doc.getElementsByTagName('head')[0];
+ link=document.createElement('link');
+ link.setAttribute('rel',"stylesheet");
+ link.setAttribute('type',"text/css");
+ link.setAttribute('href',"css/richtext.css" );
+ head.appendChild(link);
- var styles = document.createElement('style');
- styles.setAttribute('type', 'text/css');
- var newStyle = document.createTextNode('\n<!--\nbody{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:400;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400;}q:before,q:after{content:\'\';}abbr,acronym{border:0;font-variant:normal;}sup,sub{line-height:-1px;vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}body{font:13px/1.22 arial,helvetica,clean,sans-serif;font-size:small;font:x-small;}table{font-size:inherit;font:100%;}pre,code,kbd,samp,tt{font-family:monospace;font-size:108%;line-height:99%;}h1{font-size:138.5%;}h2{font-size:123.1%;}h3{font-size:108%;}h1,h2,h3{margin:1em 0;}h1,h2,h3,h4,h5,h6,strong{font-weight:700;}abbr,acronym{border-bottom:1px dotted #000;cursor:help;}em{font-style:italic;}blockquote,ul,ol,dl{margin:1em;}ol,ul,dl{margin-left:2em;}ol li{list-style:decimal outside;}ul li{list-style:disc outside;}dl dd{margin-left:1em;}th,td{border:1px solid #000;padding:.5em;}th{font-weight:700;text-align:center;}caption{margin-bottom:.5em;text-align:center;}p,fieldset,table,pre{margin-bottom:1em;}input[type=text],input[type=password],textarea{width:12.25em;width:11.9em;}body{font-family:arial, sans;margin:5px}\n-->\n');
- styles.appendChild(newStyle);
- head.appendChild(styles);
+ var styles = document.createElement('style');
+ styles.setAttribute('type', 'text/css');
+ var newStyle = document.createTextNode('\n<!--\nbody{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:400;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400;}q:before,q:after{content:\'\';}abbr,acronym{border:0;font-variant:normal;}sup,sub{line-height:-1px;vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}body{font:13px/1.22 arial,helvetica,clean,sans-serif;font-size:small;font:x-small;}table{font-size:inherit;font:100%;}pre,code,kbd,samp,tt{font-family:monospace;font-size:108%;line-height:99%;}h1{font-size:138.5%;}h2{font-size:123.1%;}h3{font-size:108%;}h1,h2,h3{margin:1em 0;}h1,h2,h3,h4,h5,h6,strong{font-weight:700;}abbr,acronym{border-bottom:1px dotted #000;cursor:help;}em{font-style:italic;}blockquote,ul,ol,dl{margin:1em;}ol,ul,dl{margin-left:2em;}ol li{list-style:decimal outside;}ul li{list-style:disc outside;}dl dd{margin-left:1em;}th,td{border:1px solid #000;padding:.5em;}th{font-weight:700;text-align:center;}caption{margin-bottom:.5em;text-align:center;}p,fieldset,table,pre{margin-bottom:1em;}input[type=text],input[type=password],textarea{width:12.25em;width:11.9em;}body{font-family:arial, sans;margin:5px}\n-->\n');
+ styles.appendChild(newStyle);
+ head.appendChild(styles);
- // -- patch
+ // -- patch
- // Send notification that the iframe has finished loading.
- _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImplStandard::onElementInitialized()();
+ // Send notification that the iframe has finished loading.
+ _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImplStandard::onElementInitialized()();
- // Don't set designMode until the RTA actually gets focused. This is
- // necessary because editing won't work on Mozilla if the iframe is
- // *hidden, but attached*. Waiting for focus gets around this issue.
- //
- // Note: This onfocus will not conflict with the addEventListener('focus',
- // ...) // in RichTextAreaImplStandard.
- iframe.contentWindow.onfocus = function() {
- iframe.contentWindow.onfocus = null;
- iframe.contentWindow.document.designMode = 'On';
- };
+ // Don't set designMode until the RTA actually gets focused. This is
+ // necessary because editing won't work on Mozilla if the iframe is
+ // *hidden, but attached*. Waiting for focus gets around this issue.
+ //
+ // Note: This onfocus will not conflict with the addEventListener('focus',
+ // ...) // in RichTextAreaImplStandard.
+ iframe.contentWindow.onfocus = function() {
+ iframe.contentWindow.onfocus = null;
+ iframe.contentWindow.document.designMode = 'On';
- };
- }-*/;
-
+ };
+ }-*/;
}
Added: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/WrappedRichTextAreaImplOpera.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/WrappedRichTextAreaImplOpera.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/WrappedRichTextAreaImplOpera.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -0,0 +1,29 @@
+package org.ourproject.kune.workspace.client.editor;
+
+import com.google.gwt.user.client.ui.impl.RichTextAreaImplOpera;
+
+public class WrappedRichTextAreaImplOpera extends RichTextAreaImplOpera {
+
+ @Override
+ public native void initElement() /*-{
+ // Most browsers don't like setting designMode until slightly _after_
+ // the iframe becomes attached to the DOM. Any non-zero timeout will do
+ // just fine.
+ var _this = this;
+ _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImplStandard::initializing = true;
+ setTimeout(function() {
+ // Turn on design mode.
+ _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImpl::elem.contentWindow.document.designMode = 'On';
+ // patch css inject:
+ var elem = _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImpl::elem;
+ var doc = elem.contentWindow.document;
+ var ct = "<html><head><style>@import url('" + "css/richtext.css" + "');</style></head><body CONTENTEDITABLE='true'></body></html>" ;
+ doc.write( ct );
+ // -- patch
+
+ // Send notification that the iframe has reached design mode.
+ _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImplStandard::onElementInitialized()();
+ }, 1);
+ }-*/;
+
+}
Added: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/WrappedRichTextAreaImplSafari.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/WrappedRichTextAreaImplSafari.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/WrappedRichTextAreaImplSafari.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -0,0 +1,30 @@
+package org.ourproject.kune.workspace.client.editor;
+
+import com.google.gwt.user.client.ui.impl.RichTextAreaImplSafari;
+
+public class WrappedRichTextAreaImplSafari extends RichTextAreaImplSafari {
+
+ @Override
+ public native void initElement() /*-{
+ // Most browsers don't like setting designMode until slightly _after_
+ // the iframe becomes attached to the DOM. Any non-zero timeout will do
+ // just fine.
+ var _this = this;
+ _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImplStandard::initializing = true;
+ setTimeout(function() {
+ // Turn on design mode.
+ _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImpl::elem.contentWindow.document.designMode = 'On';
+
+ // patch css inject:
+ var elem = _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImpl::elem;
+ var doc = elem.contentWindow.document;
+ var ct = "<html><head><style>@import url('" + "css/richtext.css" + "');</style></head><body CONTENTEDITABLE='true'></body></html>" ;
+ doc.write( ct );
+ // -- patch
+
+ // Send notification that the iframe has reached design mode.
+ _this. at com.google.gwt.user.client.ui.impl.RichTextAreaImplStandard::onElementInitialized()();
+ }, 1);
+ }-*/;
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -86,6 +86,7 @@
view.clear();
final List<GroupDTO> groupsIsAdmin = participation.getGroupsIsAdmin();
final List<GroupDTO> groupsIsCollab = participation.getGroupsIsCollab();
+ Log.info(participation.toString());
Log.info("Is admin in " + groupsIsAdmin.size() + " groups.");
Log.info("Is collab in " + groupsIsCollab.size() + " groups.");
final int numAdmins = groupsIsAdmin.size();
Modified: trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionRegistryTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionRegistryTest.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionRegistryTest.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -1,7 +1,6 @@
package org.ourproject.kune.platf.client.actions;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
@@ -87,30 +86,6 @@
checkActionLists(1, new AccessRightsDTO(false, false, true), false);
}
- @Test
- public void testEnablingFalse() {
- Mockito.stub(session.isLogged()).toReturn(true);
- adminAction.setEnableCondition(new ActionEnableCondition<StateToken>() {
- public boolean mustBeEnabled(final StateToken param) {
- return false;
- }
- });
- registry.addAction(adminAction, DEF_CONTENT_TYPE_ID);
- assertTrue(!registry.checkEnabling(adminAction, new StateToken()));
- }
-
- @Test
- public void testEnablingTrue() {
- Mockito.stub(session.isLogged()).toReturn(true);
- adminAction.setEnableCondition(new ActionEnableCondition<StateToken>() {
- public boolean mustBeEnabled(final StateToken param) {
- return true;
- }
- });
- registry.addAction(adminAction, DEF_CONTENT_TYPE_ID);
- assertTrue(registry.checkEnabling(adminAction, new StateToken()));
- }
-
private void addDefActions() {
registry.addAction(adminAction, DEF_CONTENT_TYPE_ID);
registry.addAction(editorAction, DEF_CONTENT_TYPE_ID);
Modified: trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java 2008-09-30 01:49:58 UTC (rev 897)
+++ trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java 2008-10-01 01:29:01 UTC (rev 898)
@@ -5,105 +5,102 @@
import org.junit.Test;
public class TextEditorPresenterTest {
- private TextEditorListener listener;
private TextEditorPresenter presenter;
private TextEditorView view;
@Before
public void createObjects() {
- listener = EasyMock.createStrictMock(TextEditorListener.class);
- presenter = new TextEditorPresenter(listener, true);
- view = EasyMock.createStrictMock(TextEditorView.class);
+ presenter = new TextEditorPresenter(true, null, null);
+ view = EasyMock.createStrictMock(TextEditorView.class);
}
@Test
- public void testViewInitialization() {
- viewInit();
- EasyMock.replay(view);
- presenter.init(view);
- EasyMock.verify(view);
+ public void testSave() {
+ viewInit();
+ view.setEnabledSaveButton(true);
+ view.scheduleSave(10000);
+ EasyMock.expect(view.getHTML()).andReturn("foo");
+ viewReset();
+ EasyMock.replay(view);
+ // listener.onSave("foo");
+ // EasyMock.replay(listener);
+ presenter.init(view);
+ presenter.onEdit();
+ presenter.onSave();
+ presenter.onSaved();
+ EasyMock.verify(view);
+ // EasyMock.verify(listener);
}
@Test
public void testSavePending() {
- viewInit();
- view.setEnabledSaveButton(true);
- view.scheduleSave(10000);
- EasyMock.replay(view);
- presenter.init(view);
- presenter.onEdit();
- EasyMock.verify(view);
+ viewInit();
+ view.setEnabledSaveButton(true);
+ view.scheduleSave(10000);
+ EasyMock.replay(view);
+ presenter.init(view);
+ presenter.onEdit();
+ EasyMock.verify(view);
}
@Test
- public void testSave() {
- viewInit();
- view.setEnabledSaveButton(true);
- view.scheduleSave(10000);
- EasyMock.expect(view.getHTML()).andReturn("foo");
- viewReset();
- EasyMock.replay(view);
- listener.onSave("foo");
- EasyMock.replay(listener);
- presenter.init(view);
- presenter.onEdit();
- presenter.onSave();
- presenter.onSaved();
- EasyMock.verify(view);
- EasyMock.verify(listener);
+ public void testSavePendingCancel() {
+ viewInit();
+ view.setEnabledSaveButton(true);
+ view.scheduleSave(10000);
+ view.saveTimerCancel();
+ view.showSaveBeforeDialog();
+ EasyMock.expect(view.getHTML()).andReturn("foo");
+ viewReset();
+ EasyMock.replay(view);
+ // listener.onSave("foo");
+ // listener.onEditCancelled();
+ // EasyMock.replay(listener);
+ presenter.init(view);
+ presenter.onEdit();
+ presenter.onCancel();
+ presenter.onSaveAndClose();
+ presenter.onSaved();
+ EasyMock.verify(view);
+ // EasyMock.verify(listener);
}
@Test
- public void testSavePendingCancel() {
- viewInit();
- view.setEnabledSaveButton(true);
- view.scheduleSave(10000);
- view.saveTimerCancel();
- view.showSaveBeforeDialog();
- EasyMock.expect(view.getHTML()).andReturn("foo");
- viewReset();
- EasyMock.replay(view);
- listener.onSave("foo");
- listener.onEditCancelled();
- EasyMock.replay(listener);
- presenter.init(view);
- presenter.onEdit();
- presenter.onCancel();
- presenter.onSaveAndClose();
- presenter.onSaved();
- EasyMock.verify(view);
- EasyMock.verify(listener);
+ public void testSavePendingCancelSaveFails() {
+ viewInit();
+ view.setEnabledSaveButton(true);
+ view.scheduleSave(10000);
+ view.saveTimerCancel();
+ view.showSaveBeforeDialog();
+ EasyMock.expect(view.getHTML()).andReturn("foo");
+ view.scheduleSave(20000);
+ EasyMock.replay(view);
+ // listener.onSave("foo");
+ // EasyMock.replay(listener);
+ presenter.init(view);
+ presenter.onEdit();
+ presenter.onCancel();
+ presenter.onSaveAndClose();
+ presenter.onSaveFailed();
+ EasyMock.verify(view);
+ // EasyMock.verify(listener);
}
@Test
- public void testSavePendingCancelSaveFails() {
- viewInit();
- view.setEnabledSaveButton(true);
- view.scheduleSave(10000);
- view.saveTimerCancel();
- view.showSaveBeforeDialog();
- EasyMock.expect(view.getHTML()).andReturn("foo");
- view.scheduleSave(20000);
- EasyMock.replay(view);
- listener.onSave("foo");
- EasyMock.replay(listener);
- presenter.init(view);
- presenter.onEdit();
- presenter.onCancel();
- presenter.onSaveAndClose();
- presenter.onSaveFailed();
- EasyMock.verify(view);
- EasyMock.verify(listener);
+ public void testViewInitialization() {
+ viewInit();
+ EasyMock.replay(view);
+ presenter.init(view);
+ EasyMock.verify(view);
}
private void viewInit() {
- view.setEnabledSaveButton(false);
- view.setEnabled(true);
+ view.setEnabledSaveButton(false);
+ view.setEnabled(true);
}
private void viewReset() {
- view.saveTimerCancel();
- view.setEnabledSaveButton(false);
+ view.saveTimerCancel();
+ view.setEnabledSaveButton(false);
}
-
}
More information about the kune-commits
mailing list