[kune-commits] r1374 - in trunk/src/main/java/cc/kune/gspace/client: options/tools tool/selector
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Wed May 11 00:57:21 CEST 2011
Author: vjrj_
Date: 2011-05-11 00:57:21 +0200 (Wed, 11 May 2011)
New Revision: 1374
Modified:
trunk/src/main/java/cc/kune/gspace/client/options/tools/EntityOptionsToolsConfPanel.java
trunk/src/main/java/cc/kune/gspace/client/options/tools/EntityOptionsToolsConfPresenter.java
trunk/src/main/java/cc/kune/gspace/client/options/tools/EntityOptionsToolsConfView.java
trunk/src/main/java/cc/kune/gspace/client/options/tools/GroupOptionsToolsConfPanel.java
trunk/src/main/java/cc/kune/gspace/client/options/tools/GroupOptionsToolsConfPresenter.java
trunk/src/main/java/cc/kune/gspace/client/options/tools/UserOptionsToolsConfPanel.java
trunk/src/main/java/cc/kune/gspace/client/options/tools/UserOptionsToolsConfPresenter.java
trunk/src/main/java/cc/kune/gspace/client/tool/selector/ToolSelectorItemPresenter.java
Log:
Some bug fixes in tools
Modified: trunk/src/main/java/cc/kune/gspace/client/options/tools/EntityOptionsToolsConfPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/tools/EntityOptionsToolsConfPanel.java 2011-05-10 22:02:36 UTC (rev 1373)
+++ trunk/src/main/java/cc/kune/gspace/client/options/tools/EntityOptionsToolsConfPanel.java 2011-05-10 22:57:21 UTC (rev 1374)
@@ -24,6 +24,7 @@
import cc.kune.common.client.log.Log;
import cc.kune.common.client.tooltip.Tooltip;
import cc.kune.common.client.ui.IconLabel;
+import cc.kune.common.client.ui.MaskWidget;
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.client.ui.DefaultForm;
import cc.kune.core.shared.dto.ToolSimpleDTO;
@@ -35,7 +36,6 @@
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.widget.Label;
import com.extjs.gxt.ui.client.widget.form.CheckBox;
-import com.extjs.gxt.ui.client.widget.form.HiddenField;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Widget;
@@ -43,15 +43,18 @@
public class EntityOptionsToolsConfPanel extends DefaultForm implements EntityOptionsToolsConfView {
private final HashMap<String, CheckBox> fields;
private final I18nTranslationService i18n;
+ private final MaskWidget maskWidget;
private final IconLabel tabTitle;
- public EntityOptionsToolsConfPanel(final I18nTranslationService i18n, final CoreResources res) {
+ public EntityOptionsToolsConfPanel(final I18nTranslationService i18n, final CoreResources res,
+ final MaskWidget maskWidget) {
+ this.maskWidget = maskWidget;
tabTitle = new IconLabel(res.kunePreferences(), i18n.t("Tools"));
this.i18n = i18n;
// super.setHeight(EntityOptionsView.HEIGHT);
super.setWidth(EntityOptionsView.WIDTH);
super.setFrame(true);
- super.add(new HiddenField());
+ // super.add(new HiddenField());
super.getFormPanel().setLabelWidth(20);
fields = new HashMap<String, CheckBox>();
super.addStyleName("k-overflow-y-auto");
@@ -62,7 +65,7 @@
public void add(final ToolSimpleDTO tool, final ClickHandler handler) {
final CheckBox checkbox = new CheckBox();
checkbox.setFieldLabel(tool.getRootName());
- checkbox.setValue(false);
+ // checkbox.setValue(false);
checkbox.addListener(Events.Change, new Listener<BaseEvent>() {
@Override
public void handleEvent(final BaseEvent be) {
@@ -114,6 +117,11 @@
}
@Override
+ public void mask() {
+ maskWidget.mask(this);
+ }
+
+ @Override
public void setChecked(final String tool, final boolean checked) {
final CheckBox field = getTool(tool);
field.setValue(checked);
@@ -134,4 +142,9 @@
final CheckBox field = getTool(tool);
Tooltip.to(field, tip);
}
+
+ @Override
+ public void unmask() {
+ maskWidget.unMask();
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/tools/EntityOptionsToolsConfPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/tools/EntityOptionsToolsConfPresenter.java 2011-05-10 22:02:36 UTC (rev 1373)
+++ trunk/src/main/java/cc/kune/gspace/client/options/tools/EntityOptionsToolsConfPresenter.java 2011-05-10 22:57:21 UTC (rev 1374)
@@ -23,6 +23,7 @@
import java.util.List;
import cc.kune.common.client.notify.NotifyLevel;
+import cc.kune.common.client.notify.NotifyUser;
import cc.kune.core.client.rpcservices.GroupServiceAsync;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.StateManager;
@@ -39,106 +40,110 @@
public abstract class EntityOptionsToolsConfPresenter {
- private final EntityOptions entityOptions;
- private final Provider<GroupServiceAsync> groupService;
- protected final I18nTranslationService i18n;
- protected final Session session;
- protected final StateManager stateManager;
- private EntityOptionsToolsConfView view;
+ private final EntityOptions entityOptions;
+ private final Provider<GroupServiceAsync> groupService;
+ protected final I18nTranslationService i18n;
+ protected final Session session;
+ protected final StateManager stateManager;
+ private EntityOptionsToolsConfView view;
- public EntityOptionsToolsConfPresenter(final Session session, final StateManager stateManager,
- final I18nTranslationService i18n, final EntityOptions entityOptions,
- final Provider<GroupServiceAsync> groupService) {
- this.session = session;
- this.stateManager = stateManager;
- this.i18n = i18n;
- this.entityOptions = entityOptions;
- this.groupService = groupService;
- }
+ public EntityOptionsToolsConfPresenter(final Session session, final StateManager stateManager,
+ final I18nTranslationService i18n, final EntityOptions entityOptions,
+ final Provider<GroupServiceAsync> groupService) {
+ this.session = session;
+ this.stateManager = stateManager;
+ this.i18n = i18n;
+ this.entityOptions = entityOptions;
+ this.groupService = groupService;
+ }
- protected abstract boolean applicable();
+ protected abstract boolean applicable();
- protected abstract Collection<ToolSimpleDTO> getAllTools();
+ protected abstract Collection<ToolSimpleDTO> getAllTools();
- protected abstract StateToken getDefContentToken();
+ protected abstract StateToken getDefContentToken();
- protected abstract String getDefContentTooltip();
+ protected abstract String getDefContentTooltip();
- protected abstract List<String> getEnabledTools();
+ protected abstract List<String> getEnabledTools();
- protected abstract StateToken getOperationToken();
+ protected abstract StateToken getOperationToken();
- public IsWidget getView() {
- return view;
- }
+ public IsWidget getView() {
+ return view;
+ }
- protected abstract void gotoDifLocationIfNecessary(String toolName);
+ protected abstract void gotoDifLocationIfNecessary(String toolName);
- public void init(final EntityOptionsToolsConfView view) {
- this.view = view;
- setState();
- entityOptions.addTab(view, view.getTabTitle());
+ public void init(final EntityOptionsToolsConfView view) {
+ this.view = view;
+ setState();
+ entityOptions.addTab(view, view.getTabTitle());
+ }
+
+ private void onCheck(final ToolSimpleDTO tool, final boolean checked) {
+ final List<String> enabledTools = getEnabledTools();
+ final String toolName = tool.getName();
+ if (checked) {
+ if (!(enabledTools.contains(toolName))) {
+ setToolCheckedInServer(checked, toolName);
+ }
+ } else {
+ if (enabledTools.contains(toolName)) {
+ setToolCheckedInServer(checked, toolName);
+ gotoDifLocationIfNecessary(toolName);
+ }
}
+ }
- private void onCheck(final ToolSimpleDTO tool, final boolean checked) {
- final List<String> enabledTools = getEnabledTools();
- final String toolName = tool.getName();
- if (checked) {
- if (!(enabledTools.contains(toolName))) {
- setToolCheckedInServer(checked, toolName);
- }
- } else {
- if (enabledTools.contains(toolName)) {
- setToolCheckedInServer(checked, toolName);
- gotoDifLocationIfNecessary(toolName);
- }
+ protected void reset() {
+ view.clear();
+ entityOptions.hideMessages();
+ }
+
+ protected void setState() {
+ reset();
+ final Collection<ToolSimpleDTO> toolCollection = getAllTools();
+ for (final ToolSimpleDTO tool : toolCollection) {
+ view.add(tool, new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ onCheck(tool, view.isChecked(tool.getName()));
}
+ });
+ view.setEnabled(tool.getName(), true);
}
-
- protected void reset() {
- view.clear();
- entityOptions.hideMessages();
+ for (final String tool : getEnabledTools()) {
+ view.setChecked(tool, true);
}
- protected void setState() {
- reset();
- final Collection<ToolSimpleDTO> toolCollection = getAllTools();
- for (final ToolSimpleDTO tool : toolCollection) {
- view.add(tool, new ClickHandler() {
- @Override
- public void onClick(final ClickEvent event) {
- onCheck(tool, view.isChecked(tool.getName()));
- }
- });
- view.setEnabled(tool.getName(), true);
- }
- for (final String tool : getEnabledTools()) {
- view.setChecked(tool, true);
- }
-
- final StateToken token = getDefContentToken();
- if (token != null) {
- final String defContentTool = token.getTool();
- if (defContentTool != null) {
- view.setEnabled(defContentTool, false);
- view.setTooltip(defContentTool, getDefContentTooltip());
- }
- }
+ final StateToken token = getDefContentToken();
+ if (token != null) {
+ final String defContentTool = token.getTool();
+ if (defContentTool != null) {
+ // view.setEnabled(defContentTool, false);
+ view.setTooltip(defContentTool, getDefContentTooltip());
+ }
}
+ }
- protected void setToolCheckedInServer(final boolean checked, final String toolName) {
- groupService.get().setToolEnabled(session.getUserHash(), getOperationToken(), toolName, checked,
- new AsyncCallback<Void>() {
- @Override
- public void onFailure(final Throwable caught) {
- view.setChecked(toolName, !checked);
- entityOptions.setErrorMessage(i18n.t("Error configuring the tool"), NotifyLevel.error);
- }
+ protected void setToolCheckedInServer(final boolean checked, final String toolName) {
+ // view.mask();
+ groupService.get().setToolEnabled(session.getUserHash(), getOperationToken(), toolName, checked,
+ new AsyncCallback<Void>() {
+ @Override
+ public void onFailure(final Throwable caught) {
+ view.setChecked(toolName, !checked);
+ entityOptions.setErrorMessage(i18n.t("Error configuring the tool"), NotifyLevel.error);
+ NotifyUser.error(i18n.t("Error configuring the tool"));
+ // view.unmask();
+ }
- @Override
- public void onSuccess(final Void result) {
- stateManager.reload();
- }
- });
- }
+ @Override
+ public void onSuccess(final Void result) {
+ stateManager.reload();
+ // view.unmask();
+ }
+ });
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/tools/EntityOptionsToolsConfView.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/tools/EntityOptionsToolsConfView.java 2011-05-10 22:02:36 UTC (rev 1373)
+++ trunk/src/main/java/cc/kune/gspace/client/options/tools/EntityOptionsToolsConfView.java 2011-05-10 22:57:21 UTC (rev 1374)
@@ -26,15 +26,19 @@
public interface EntityOptionsToolsConfView extends EntityOptionsTabView {
- void add(ToolSimpleDTO tool, ClickHandler clickHandler);
+ void add(ToolSimpleDTO tool, ClickHandler clickHandler);
- void clear();
+ void clear();
- boolean isChecked(String tool);
+ boolean isChecked(String tool);
- void setChecked(String tool, boolean checked);
+ void mask();
- void setEnabled(String tool, boolean enabled);
+ void setChecked(String tool, boolean checked);
- void setTooltip(String tool, String tip);
+ void setEnabled(String tool, boolean enabled);
+
+ void setTooltip(String tool, String tip);
+
+ void unmask();
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/tools/GroupOptionsToolsConfPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/tools/GroupOptionsToolsConfPanel.java 2011-05-10 22:02:36 UTC (rev 1373)
+++ trunk/src/main/java/cc/kune/gspace/client/options/tools/GroupOptionsToolsConfPanel.java 2011-05-10 22:57:21 UTC (rev 1374)
@@ -19,16 +19,19 @@
*/
package cc.kune.gspace.client.options.tools;
+import cc.kune.common.client.ui.MaskWidget;
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
import com.google.inject.Inject;
-public class GroupOptionsToolsConfPanel extends EntityOptionsToolsConfPanel implements GroupOptionsToolsConfView {
+public class GroupOptionsToolsConfPanel extends EntityOptionsToolsConfPanel implements
+ GroupOptionsToolsConfView {
- @Inject
- public GroupOptionsToolsConfPanel(final I18nTranslationService i18n, final CoreResources res) {
- super(i18n, res);
- }
+ @Inject
+ public GroupOptionsToolsConfPanel(final I18nTranslationService i18n, final CoreResources res,
+ final MaskWidget maskWidget) {
+ super(i18n, res, maskWidget);
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/tools/GroupOptionsToolsConfPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/tools/GroupOptionsToolsConfPresenter.java 2011-05-10 22:02:36 UTC (rev 1373)
+++ trunk/src/main/java/cc/kune/gspace/client/options/tools/GroupOptionsToolsConfPresenter.java 2011-05-10 22:57:21 UTC (rev 1374)
@@ -36,61 +36,63 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
-public class GroupOptionsToolsConfPresenter extends EntityOptionsToolsConfPresenter implements GroupOptionsToolsConf {
+public class GroupOptionsToolsConfPresenter extends EntityOptionsToolsConfPresenter implements
+ GroupOptionsToolsConf {
- @Inject
- public GroupOptionsToolsConfPresenter(final StateManager stateManager, final Session session,
- final I18nTranslationService i18n, final GroupOptions entityOptions,
- final Provider<GroupServiceAsync> groupService, final GroupOptionsToolsConfView view) {
- super(session, stateManager, i18n, entityOptions, groupService);
- init(view);
- stateManager.onGroupChanged(true, new GroupChangedHandler() {
- @Override
- public void onGroupChanged(final GroupChangedEvent event) {
- setState();
- }
- });
- }
+ @Inject
+ public GroupOptionsToolsConfPresenter(final StateManager stateManager, final Session session,
+ final I18nTranslationService i18n, final GroupOptions entityOptions,
+ final Provider<GroupServiceAsync> groupService, final GroupOptionsToolsConfView view) {
+ super(session, stateManager, i18n, entityOptions, groupService);
+ init(view);
+ stateManager.onGroupChanged(true, new GroupChangedHandler() {
+ @Override
+ public void onGroupChanged(final GroupChangedEvent event) {
+ setState();
+ }
+ });
+ }
- @Override
- protected boolean applicable() {
- return session.isCurrentStateAGroup();
- }
+ @Override
+ protected boolean applicable() {
+ return session.isCurrentStateAGroup();
+ }
- @Override
- protected Collection<ToolSimpleDTO> getAllTools() {
- return session.getGroupTools();
- }
+ @Override
+ protected Collection<ToolSimpleDTO> getAllTools() {
+ return session.getGroupTools();
+ }
- @Override
- protected StateToken getDefContentToken() {
- final ContentSimpleDTO defaultContent = session.getCurrentState().getGroup().getDefaultContent();
- return defaultContent == null ? null : defaultContent.getStateToken();
- }
+ @Override
+ protected StateToken getDefContentToken() {
+ final ContentSimpleDTO defaultContent = session.getCurrentState().getGroup().getDefaultContent();
+ return defaultContent == null ? null : defaultContent.getStateToken();
+ }
- @Override
- protected String getDefContentTooltip() {
- return i18n.t("You cannot disable this tool because it's where the current group home page is located. To do that you have to select other content as the default group home page but in another tool.");
- }
+ @Override
+ protected String getDefContentTooltip() {
+ // FIXME
+ return i18n.t("You cannot disable this tool because it's where the current group home page is located. To do that you have to select other content as the default group home page but in another tool.");
+ }
- @Override
- protected List<String> getEnabledTools() {
- return session.getCurrentState().getEnabledTools();
- }
+ @Override
+ protected List<String> getEnabledTools() {
+ return session.getCurrentState().getEnabledTools();
+ }
- @Override
- protected StateToken getOperationToken() {
- return session.getCurrentStateToken();
- }
+ @Override
+ protected StateToken getOperationToken() {
+ return session.getCurrentStateToken();
+ }
- @Override
- protected void gotoDifLocationIfNecessary(final String toolName) {
- if (session.getCurrentStateToken().getTool().equals(toolName)) {
- final ContentSimpleDTO defaultContent = session.getCurrentState().getGroup().getDefaultContent();
- if (defaultContent != null) {
- stateManager.gotoStateToken(defaultContent.getStateToken());
- }
- }
+ @Override
+ protected void gotoDifLocationIfNecessary(final String toolName) {
+ if (session.getCurrentStateToken().getTool().equals(toolName)) {
+ final ContentSimpleDTO defaultContent = session.getCurrentState().getGroup().getDefaultContent();
+ if (defaultContent != null) {
+ stateManager.gotoStateToken(defaultContent.getStateToken());
+ }
}
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/tools/UserOptionsToolsConfPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/tools/UserOptionsToolsConfPanel.java 2011-05-10 22:02:36 UTC (rev 1373)
+++ trunk/src/main/java/cc/kune/gspace/client/options/tools/UserOptionsToolsConfPanel.java 2011-05-10 22:57:21 UTC (rev 1374)
@@ -19,16 +19,19 @@
*/
package cc.kune.gspace.client.options.tools;
+import cc.kune.common.client.ui.MaskWidget;
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
import com.google.inject.Inject;
-public class UserOptionsToolsConfPanel extends EntityOptionsToolsConfPanel implements UserOptionsToolsConfView {
+public class UserOptionsToolsConfPanel extends EntityOptionsToolsConfPanel implements
+ UserOptionsToolsConfView {
- @Inject
- public UserOptionsToolsConfPanel(final I18nTranslationService i18n, final CoreResources res) {
- super(i18n, res);
- }
+ @Inject
+ public UserOptionsToolsConfPanel(final I18nTranslationService i18n, final CoreResources res,
+ final MaskWidget maskWidget) {
+ super(i18n, res, maskWidget);
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/tools/UserOptionsToolsConfPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/tools/UserOptionsToolsConfPresenter.java 2011-05-10 22:02:36 UTC (rev 1373)
+++ trunk/src/main/java/cc/kune/gspace/client/options/tools/UserOptionsToolsConfPresenter.java 2011-05-10 22:57:21 UTC (rev 1374)
@@ -35,58 +35,60 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
-public class UserOptionsToolsConfPresenter extends EntityOptionsToolsConfPresenter implements UserOptionsToolsConf {
+public class UserOptionsToolsConfPresenter extends EntityOptionsToolsConfPresenter implements
+ UserOptionsToolsConf {
- @Inject
- public UserOptionsToolsConfPresenter(final Session session, final StateManager stateManager,
- final I18nTranslationService i18n, final UserOptions entityOptions,
- final Provider<GroupServiceAsync> groupService, final GroupOptionsToolsConfView view) {
- super(session, stateManager, i18n, entityOptions, groupService);
- init(view);
- session.onUserSignIn(true, new UserSignInHandler() {
- @Override
- public void onUserSignIn(final UserSignInEvent event) {
- setState();
- }
- });
- }
+ @Inject
+ public UserOptionsToolsConfPresenter(final Session session, final StateManager stateManager,
+ final I18nTranslationService i18n, final UserOptions entityOptions,
+ final Provider<GroupServiceAsync> groupService, final UserOptionsToolsConfView view) {
+ super(session, stateManager, i18n, entityOptions, groupService);
+ init(view);
+ session.onUserSignIn(true, new UserSignInHandler() {
+ @Override
+ public void onUserSignIn(final UserSignInEvent event) {
+ setState();
+ }
+ });
+ }
- @Override
- protected boolean applicable() {
- return session.isLogged();
- }
+ @Override
+ protected boolean applicable() {
+ return session.isLogged();
+ }
- @Override
- protected Collection<ToolSimpleDTO> getAllTools() {
- return session.getUserTools();
- }
+ @Override
+ protected Collection<ToolSimpleDTO> getAllTools() {
+ return session.getUserTools();
+ }
- @Override
- protected StateToken getDefContentToken() {
- final String homePage = session.getCurrentUserInfo().getHomePage();
- return homePage == null ? null : new StateToken(homePage);
- }
+ @Override
+ protected StateToken getDefContentToken() {
+ final String homePage = session.getCurrentUserInfo().getHomePage();
+ return homePage == null ? null : new StateToken(homePage);
+ }
- @Override
- protected String getDefContentTooltip() {
- return i18n.t("You cannot disable this tool because it's where your home page is located. To do that you have to select other content as the default home page but in another tool.");
- }
+ @Override
+ protected String getDefContentTooltip() {
+ // FIXME
+ return i18n.t("You cannot disable this tool because it's where your home page is located. To do that you have to select other content as the default home page but in another tool.");
+ }
- @Override
- protected List<String> getEnabledTools() {
- return session.getCurrentUserInfo().getEnabledTools();
- }
+ @Override
+ protected List<String> getEnabledTools() {
+ return session.getCurrentUserInfo().getEnabledTools();
+ }
- @Override
- protected StateToken getOperationToken() {
- return session.getCurrentUser().getStateToken();
- }
+ @Override
+ protected StateToken getOperationToken() {
+ return session.getCurrentUser().getStateToken();
+ }
- @Override
- protected void gotoDifLocationIfNecessary(final String toolName) {
- if (session.getCurrentStateToken().getGroup().equals(session.getCurrentUserInfo().getShortName())
- && session.getCurrentStateToken().getTool().equals(toolName)) {
- stateManager.gotoStateToken(session.getCurrentState().getGroup().getDefaultContent().getStateToken());
- }
+ @Override
+ protected void gotoDifLocationIfNecessary(final String toolName) {
+ if (session.getCurrentStateToken().getGroup().equals(session.getCurrentUserInfo().getShortName())
+ && session.getCurrentStateToken().getTool().equals(toolName)) {
+ stateManager.gotoStateToken(session.getCurrentState().getGroup().getDefaultContent().getStateToken());
}
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/tool/selector/ToolSelectorItemPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/tool/selector/ToolSelectorItemPresenter.java 2011-05-10 22:02:36 UTC (rev 1373)
+++ trunk/src/main/java/cc/kune/gspace/client/tool/selector/ToolSelectorItemPresenter.java 2011-05-10 22:57:21 UTC (rev 1374)
@@ -29,76 +29,78 @@
import com.google.gwt.user.client.ui.IsWidget;
public class ToolSelectorItemPresenter implements ToolSelectorItem {
- public interface ToolSelectorItemView extends IsWidget {
+ public interface ToolSelectorItemView extends IsWidget {
- HasClickHandlers getFocus();
+ HasClickHandlers getFocus();
- HasText getLabel();
+ HasText getLabel();
- // void setTheme(WsTheme oldTheme, WsTheme newTheme);
+ // void setTheme(WsTheme oldTheme, WsTheme newTheme);
- void setSelected(boolean selected);
+ void setSelected(boolean selected);
- void setVisible(boolean visible);
- }
+ void setVisible(boolean visible);
+ }
- private final String longName;
- // private final WsThemeManager wsThemePresenter;
- private final String shortName;
- private StateToken token;
- private final ToolSelector toolSelector;
- private ToolSelectorItemView view;
+ private final String longName;
+ // private final WsThemeManager wsThemePresenter;
+ private final String shortName;
+ private StateToken token;
+ private final ToolSelector toolSelector;
+ private ToolSelectorItemView view;
- public ToolSelectorItemPresenter(final String shortName, final String longName, final ToolSelector toolSelector) {
- this.shortName = shortName;
- this.longName = longName;
- this.toolSelector = toolSelector;
- // this.wsThemePresenter = wsThemePresenter;
- }
+ public ToolSelectorItemPresenter(final String shortName, final String longName,
+ final ToolSelector toolSelector) {
+ this.shortName = shortName;
+ this.longName = longName;
+ this.toolSelector = toolSelector;
+ // this.wsThemePresenter = wsThemePresenter;
+ }
- @Override
- public String getShortName() {
- return shortName;
- }
+ @Override
+ public String getShortName() {
+ return shortName;
+ }
- public ToolSelectorItemView getView() {
- return view;
- }
+ @Override
+ public ToolSelectorItemView getView() {
+ return view;
+ }
- public void init(final ToolSelectorItemView view) {
- this.view = view;
- toolSelector.addTool(this);
- view.getFocus().addClickHandler(new ClickHandler() {
- @Override
- public void onClick(final ClickEvent event) {
- History.newItem(token.toString());
- }
- });
- view.getLabel().setText(longName);
- // wsThemePresenter.addOnThemeChanged(new Listener2<WsTheme, WsTheme>()
- // {
- // public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) {
- // setTheme(oldTheme, newTheme);
- // }
- // });
- }
+ public void init(final ToolSelectorItemView view) {
+ this.view = view;
+ toolSelector.addTool(this);
+ view.getFocus().addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ History.newItem(token.toString());
+ }
+ });
+ view.getLabel().setText(longName);
+ // wsThemePresenter.addOnThemeChanged(new Listener2<WsTheme, WsTheme>()
+ // {
+ // public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) {
+ // setTheme(oldTheme, newTheme);
+ // }
+ // });
+ }
- @Override
- public void setGroupShortName(final String groupShortName) {
- token = new StateToken(groupShortName, getShortName(), null, null);
- }
+ @Override
+ public void setGroupShortName(final String groupShortName) {
+ token = new StateToken(groupShortName, getShortName(), null, null);
+ }
- @Override
- public void setSelected(final boolean selected) {
- view.setSelected(selected);
- }
+ @Override
+ public void setSelected(final boolean selected) {
+ view.setSelected(selected);
+ }
- // private void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
- // view.setTheme(oldTheme, newTheme);
- // }
+ // private void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
+ // view.setTheme(oldTheme, newTheme);
+ // }
- @Override
- public void setVisible(final boolean visible) {
- view.setVisible(visible);
- }
+ @Override
+ public void setVisible(final boolean visible) {
+ view.setVisible(visible);
+ }
}
More information about the kune-commits
mailing list