blob: 74c2b2194df88f8a35ca58e2a87b0d45e78bbf16 [file] [log] [blame]
/*******************************************************************************
* Copyright (C) 2007 The University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
******************************************************************************/
package net.sf.taverna.t2.activities.stringconstant.views;
import java.awt.Frame;
import javax.swing.Action;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import net.sf.taverna.t2.activities.stringconstant.StringConstantActivity;
import net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean;
import net.sf.taverna.t2.activities.stringconstant.actions.StringConstantActivityConfigurationAction;
import net.sf.taverna.t2.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
public class StringConstantActivityContextualView extends HTMLBasedActivityContextualView<StringConstantConfigurationBean> {
private static int MAX_LENGTH=100;
private static final long serialVersionUID = -553974544001808511L;
public StringConstantActivityContextualView(Activity<?> activity) {
super(activity);
}
@Override
public String getViewTitle() {
return "Text constant";
}
@Override
protected String getRawTableRowsHtml() {
String v = StringUtils.abbreviate(getConfigBean().getValue(), MAX_LENGTH);
v = StringEscapeUtils.escapeHtml(v);
String html = "<tr><td>Value</td><td>"+v+"</td></tr>";
return html;
}
@Override
public Action getConfigureAction(Frame owner) {
return new StringConstantActivityConfigurationAction((StringConstantActivity)getActivity(),owner);
}
@Override
public int getPreferredPosition() {
return 100;
}
}