From 97c496ed42b272fe2a15fe22619de50357d1ca7a Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Wed, 11 Jul 2007 11:43:12 +0000 Subject: [PATCH] committing forgotten class svn changeset:1841/svn branch:trunk --- .../terminal/gwt/client/ui/ITreeAction.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/com/itmill/toolkit/terminal/gwt/client/ui/ITreeAction.java diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/ITreeAction.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/ITreeAction.java new file mode 100644 index 0000000000..dd8008da15 --- /dev/null +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/ITreeAction.java @@ -0,0 +1,65 @@ +package com.itmill.toolkit.terminal.gwt.client.ui; + + +/** + * This class is used for "row actions" in ITree and ITable + */ +public class ITreeAction extends IAction { + + String targetKey = ""; + String actionKey = ""; + + public ITreeAction(IActionOwner owner) { + super(owner); + } + + public ITreeAction(IActionOwner owner, String target, String action) { + this(owner); + this.targetKey = target; + this.actionKey = action; + } + + + /** + * Sends message to server that this action has been fired. + * Messages are "standard" Toolkit messages whose value is comma + * separated pair of targetKey (row, treeNod ...) and actions id. + * + * Variablename is always "action". + * + * Actions are always sent immediatedly to server. + */ + public void execute() { + owner.getClient().updateVariable( + owner.getPaintableId(), + "action", + targetKey + "," + actionKey, + true); + owner.getClient().getContextMenu().hide(); + } + + public String getActionKey() { + return actionKey; + } + + public void setActionKey(String actionKey) { + this.actionKey = actionKey; + } + + public String getTargetKey() { + return targetKey; + } + + public void setTargetKey(String targetKey) { + this.targetKey = targetKey; + } + + public String getHTML() { + StringBuffer sb = new StringBuffer(); + if(iconUrl != null) { + sb.append("\"icon\""); + } + sb.append(caption); + return sb.toString(); + } +} -- 2.39.5