本文整理汇总了Java中org.apache.taverna.lang.ui.ValidatingUserInputDialog.addTextComponentValidation方法的典型用法代码示例。如果您正苦于以下问题:Java ValidatingUserInputDialog.addTextComponentValidation方法的具体用法?Java ValidatingUserInputDialog.addTextComponentValidation怎么用?Java ValidatingUserInputDialog.addTextComponentValidation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.taverna.lang.ui.ValidatingUserInputDialog
的用法示例。
在下文中一共展示了ValidatingUserInputDialog.addTextComponentValidation方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import org.apache.taverna.lang.ui.ValidatingUserInputDialog; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
Set<String> usedOutputPorts = new HashSet<>();
for (OutputWorkflowPort usedOutputPort : dataflow.getOutputPorts())
if (!usedOutputPort.getName().equals(port.getName()))
usedOutputPorts.add(usedOutputPort.getName());
DataflowOutputPortPanel inputPanel = new DataflowOutputPortPanel();
ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
"Edit Workflow Output Port", inputPanel);
vuid.addTextComponentValidation(inputPanel.getPortNameField(),
"Set the workflow output port name.", usedOutputPorts,
"Duplicate workflow output port name.",
"[\\p{L}\\p{Digit}_.]+", "Invalid workflow output port name.");
vuid.setSize(new Dimension(400, 200));
inputPanel.setPortName(port.getName());
try {
if (vuid.show(component))
changeOutputPort(inputPanel);
} catch (EditException ex) {
logger.debug("Rename workflow output port failed", ex);
}
}
示例2: actionPerformed
import org.apache.taverna.lang.ui.ValidatingUserInputDialog; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
Set<String> usedProcessors = new HashSet<>();
for (Processor usedProcessor : dataflow.getProcessors())
if (!usedProcessor.getName().equals(processor.getName()))
usedProcessors.add(usedProcessor.getName());
ProcessorPanel inputPanel = new ProcessorPanel();
ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
"Rename service", inputPanel);
vuid.addTextComponentValidation(inputPanel.getProcessorNameField(),
"Set the service name.", usedProcessors, "Duplicate service.",
"[\\p{L}\\p{Digit}_.]+", "Invalid service name.");
vuid.setSize(new Dimension(400, 200));
inputPanel.setProcessorName(processor.getName());
try {
if (vuid.show(component))
changeProcessorName(inputPanel);
} catch (EditException e1) {
logger.debug("Rename service (processor) failed", e1);
}
}
示例3: actionPerformed
import org.apache.taverna.lang.ui.ValidatingUserInputDialog; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
try {
Set<String> usedInputPorts = new HashSet<>();
for (InputWorkflowPort inputPort : dataflow.getInputPorts())
usedInputPorts.add(inputPort.getName());
DataflowInputPortPanel inputPanel = new DataflowInputPortPanel();
ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
"Add Workflow Input Port", inputPanel);
vuid.addTextComponentValidation(inputPanel.getPortNameField(),
"Set the workflow input port name.", usedInputPorts,
"Duplicate workflow input port name.",
"[\\p{L}\\p{Digit}_.]+",
"Invalid workflow input port name.");
vuid.addMessageComponent(inputPanel.getSingleValueButton(),
"Set the input port type.");
vuid.addMessageComponent(inputPanel.getListValueButton(),
"Set the input port list depth.");
vuid.setSize(new Dimension(400, 250));
inputPanel.setPortDepth(0);
if (vuid.show(component)) {
InputWorkflowPort dataflowInputPort = new InputWorkflowPort();
dataflowInputPort.setName(inputPanel.getPortName());
dataflowInputPort.setDepth(inputPanel.getPortDepth());
editManager.doDataflowEdit(dataflow.getParent(),
new AddWorkflowInputPortEdit(dataflow,
dataflowInputPort));
}
} catch (EditException e) {
logger.warn("Adding a new workflow input port failed");
}
}
示例4: actionPerformed
import org.apache.taverna.lang.ui.ValidatingUserInputDialog; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
try {
Set<String> usedOutputPorts = new HashSet<>();
for (OutputWorkflowPort outputPort : dataflow.getOutputPorts())
usedOutputPorts.add(outputPort.getName());
DataflowOutputPortPanel inputPanel = new DataflowOutputPortPanel();
ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
"Add Workflow Output Port", inputPanel);
vuid.addTextComponentValidation(inputPanel.getPortNameField(),
"Set the workflow output port name.", usedOutputPorts,
"Duplicate workflow output port name.",
"[\\p{L}\\p{Digit}_.]+",
"Invalid workflow output port name.");
vuid.setSize(new Dimension(400, 200));
if (vuid.show(component)) {
String portName = inputPanel.getPortName();
OutputWorkflowPort dataflowOutputPort = new OutputWorkflowPort();
dataflowOutputPort.setName(portName);
editManager.doDataflowEdit(dataflow.getParent(),
new AddWorkflowOutputPortEdit(dataflow,
dataflowOutputPort));
}
} catch (EditException e) {
logger.debug("Create workflow output port failed", e);
}
}
示例5: actionPerformed
import org.apache.taverna.lang.ui.ValidatingUserInputDialog; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
Set<String> usedInputPorts = new HashSet<>();
for (InputWorkflowPort usedInputPort : dataflow.getInputPorts())
if (!usedInputPort.getName().equals(port.getName()))
usedInputPorts.add(usedInputPort.getName());
DataflowInputPortPanel inputPanel = new DataflowInputPortPanel();
ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
"Edit Workflow Input Port", inputPanel);
vuid.addTextComponentValidation(inputPanel.getPortNameField(),
"Set the workflow input port name.", usedInputPorts,
"Duplicate workflow input port name.", "[\\p{L}\\p{Digit}_.]+",
"Invalid workflow input port name.");
vuid.addMessageComponent(inputPanel.getSingleValueButton(),
"Set the input port type.");
vuid.addMessageComponent(inputPanel.getListValueButton(),
"Set the input port list depth.");
vuid.setSize(new Dimension(400, 250));
inputPanel.setPortName(port.getName());
inputPanel.setPortDepth(port.getDepth());
try {
if (vuid.show(component))
changeInputPort(inputPanel);
} catch (EditException e1) {
logger.warn("Rename workflow input port failed", e1);
}
}
示例6: actionPerformed
import org.apache.taverna.lang.ui.ValidatingUserInputDialog; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
Preferences prefs = Preferences.userNodeForPackage(getClass());
String currentUrl = prefs.get("currentUrl",
"http://www.mygrid.org.uk/");
UrlPanel urlPanel = new UrlPanel();
ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
"Add an http URL", urlPanel);
vuid.addTextComponentValidation(urlPanel.getUrlField(),
"Set the URL.", null, "", URL_REGEX,
"Not a valid http URL.");
vuid.setSize(new Dimension(400, 200));
urlPanel.setUrl(currentUrl);
if (vuid.show(RegistrationPanel.this)) {
String urlString = urlPanel.getUrl();
try {
URL url = new URL(urlString);
prefs.put("currentUrl", url.toString());
DefaultMutableTreeNode node = getSelectedNode();
@SuppressWarnings("unused")
DefaultMutableTreeNode added = addPojo(node, url, 0);
setStatus("Added URL : " + url, null);
} catch (MalformedURLException e1) {
setStatus("Invalid URL.", null);
}
}
}
示例7: showDialogue
import org.apache.taverna.lang.ui.ValidatingUserInputDialog; //导入方法依赖的package包/类
protected void showDialogue(OutputWorkflowPort portTemplate) {
Set<String> usedOutputPorts = new HashSet<String>();
for (OutputWorkflowPort usedInputPort : workflow.getOutputPorts()) {
usedOutputPorts.add(usedInputPort.getName());
}
DataflowOutputPortPanel outputPanel = new DataflowOutputPortPanel();
ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
ADD_WORKFLOW_OUTPUT_PORT, outputPanel);
vuid.addTextComponentValidation(outputPanel.getPortNameField(),
SET_THE_WORKFLOW_OUTPUT_PORT_NAME, usedOutputPorts,
DUPLICATE_WORKFLOW_OUTPUT_PORT_NAME,
VALID_PORT_NAME_REGEX, INVALID_WORKFLOW_OUTPUT_PORT_NAME);
vuid.setSize(OUTPUT_PORT_DIALOGUE_SIZE);
outputPanel.setPortName(portTemplate.getName());
if (vuid.show(parentComponent)) {
OutputWorkflowPort outputWorkflowPort = new OutputWorkflowPort();
outputWorkflowPort.setName(outputPanel.getPortName());
List<Edit<?>> editList = new ArrayList<Edit<?>>();
editList.add(new AddWorkflowOutputPortEdit(workflow, outputWorkflowPort));
DataLink dataLink = new DataLink();
dataLink.setReceivesFrom((SenderPort) port);
dataLink.setSendsTo(outputWorkflowPort);
editList.add(new AddDataLinkEdit(workflow, dataLink));
try {
CompoundEdit compoundEdit = new CompoundEdit(editList);
editManager.doDataflowEdit(workflow.getParent(), compoundEdit);
} catch (EditException ex) {
logger.warn("Can't create or connect new workflow output port", ex);
}
}
}