public Action(String name, ActionArgument[] arguments) { this.name = name; if (arguments != null) { List<ActionArgument> inputList= new ArrayList<>(); List<ActionArgument> outputList = new ArrayList<>(); for (ActionArgument argument : arguments) { argument.setAction(this); if (argument.getDirection().equals(ActionArgument.Direction.IN)) inputList.add(argument); if (argument.getDirection().equals(ActionArgument.Direction.OUT)) outputList.add(argument); } this.arguments = arguments; this.inputArguments = inputList.toArray(new ActionArgument[inputList.size()]); this.outputArguments = outputList.toArray(new ActionArgument[outputList.size()]); } else { this.arguments = new ActionArgument[0]; this.inputArguments = new ActionArgument[0]; this.outputArguments = new ActionArgument[0]; } }
private void generateActionArgument(ActionArgument actionArgument, Document descriptor, Element actionElement) { Element actionArgumentElement = appendNewElement(descriptor, actionElement, ELEMENT.argument); appendNewElementIfNotNull(descriptor, actionArgumentElement, ELEMENT.name, actionArgument.getName()); appendNewElementIfNotNull(descriptor, actionArgumentElement, ELEMENT.direction, actionArgument.getDirection().toString().toLowerCase(Locale.ROOT)); if (actionArgument.isReturnValue()) { // TODO: UPNP VIOLATION: WMP12 will discard RenderingControl service if it contains <retval> tags log.warning("UPnP specification violation: Not producing <retval> element to be compatible with WMP12: " + actionArgument); // appendNewElement(descriptor, actionArgumentElement, ELEMENT.retval); } appendNewElementIfNotNull(descriptor, actionArgumentElement, ELEMENT.relatedStateVariable, actionArgument.getRelatedStateVariableName()); }
public void hydrateActionArgument(MutableActionArgument actionArgument, Node actionArgumentNode) { NodeList argumentNodeChildren = actionArgumentNode.getChildNodes(); for (int i = 0; i < argumentNodeChildren.getLength(); i++) { Node argumentNodeChild = argumentNodeChildren.item(i); if (argumentNodeChild.getNodeType() != Node.ELEMENT_NODE) continue; if (ELEMENT.name.equals(argumentNodeChild)) { actionArgument.name = XMLUtil.getTextContent(argumentNodeChild); } else if (ELEMENT.direction.equals(argumentNodeChild)) { String directionString = XMLUtil.getTextContent(argumentNodeChild); try { actionArgument.direction = ActionArgument.Direction.valueOf(directionString.toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException ex) { // TODO: UPNP VIOLATION: Pelco SpectraIV-IP uses illegal value INOUT log.warning("UPnP specification violation: Invalid action argument direction, assuming 'IN': " + directionString); actionArgument.direction = ActionArgument.Direction.IN; } } else if (ELEMENT.relatedStateVariable.equals(argumentNodeChild)) { actionArgument.relatedStateVariable = XMLUtil.getTextContent(argumentNodeChild); } else if (ELEMENT.retval.equals(argumentNodeChild)) { actionArgument.retval = true; } } }
@Override public void endElement(ELEMENT element) throws SAXException { switch (element) { case name: getInstance().name = getCharacters(); break; case direction: String directionString = getCharacters(); try { getInstance().direction = ActionArgument.Direction.valueOf(directionString.toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException ex) { // TODO: UPNP VIOLATION: Pelco SpectraIV-IP uses illegal value INOUT log.warning("UPnP specification violation: Invalid action argument direction, assuming 'IN': " + directionString); getInstance().direction = ActionArgument.Direction.IN; } break; case relatedStateVariable: getInstance().relatedStateVariable = getCharacters(); break; case retval: getInstance().retval = true; break; } }
public void hydrateActionArgument(MutableActionArgument actionArgument, Node actionArgumentNode) { NodeList argumentNodeChildren = actionArgumentNode.getChildNodes(); for (int i = 0; i < argumentNodeChildren.getLength(); i++) { Node argumentNodeChild = argumentNodeChildren.item(i); if (argumentNodeChild.getNodeType() != Node.ELEMENT_NODE) continue; if (ELEMENT.name.equals(argumentNodeChild)) { actionArgument.name = XMLUtil.getTextContent(argumentNodeChild); } else if (ELEMENT.direction.equals(argumentNodeChild)) { String directionString = XMLUtil.getTextContent(argumentNodeChild); try { actionArgument.direction = ActionArgument.Direction.valueOf(directionString.toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException ex) { // TODO: UPNP VIOLATION: Pelco SpectraIV-IP uses illegal value INOUT log.warning("UPnP specification violation: Invalid action argument direction, assuming 'IN': " + directionString); actionArgument.direction = ActionArgument.Direction.IN; } } else if (ELEMENT.relatedStateVariable.equals(argumentNodeChild)) { actionArgument.relatedStateVariable = XMLUtil.getTextContent(argumentNodeChild); } else if (ELEMENT.retval.equals(argumentNodeChild)) { actionArgument.retval = true; } } }
public Action(String name, ActionArgument[] arguments) { this.name = name; if (arguments != null) { List<ActionArgument> inputList= new ArrayList<>(); List<ActionArgument> outputList = new ArrayList<>(); for (ActionArgument argument : arguments) { argument.setAction(this); if (argument.getDirection().equals(ActionArgument.Direction.IN)) inputList.add(argument); if (argument.getDirection().equals(ActionArgument.Direction.OUT)) outputList.add(argument); } this.arguments = arguments; this.inputArguments = inputList.toArray(new ActionArgument[inputList.size()]); this.outputArguments = outputList.toArray(new ActionArgument[outputList.size()]); } else { this.arguments = new ActionArgument[0]; this.inputArguments = new ActionArgument[0]; this.outputArguments = new ActionArgument[0]; } }
private void generateActionArgument(ActionArgument actionArgument, Document descriptor, Element actionElement) { Element actionArgumentElement = appendNewElement(descriptor, actionElement, ELEMENT.argument); appendNewElementIfNotNull(descriptor, actionArgumentElement, ELEMENT.name, actionArgument.getName()); appendNewElementIfNotNull(descriptor, actionArgumentElement, ELEMENT.direction, actionArgument.getDirection().toString().toLowerCase(Locale.ROOT)); if (actionArgument.isReturnValue()) { // TODO: UPNP VIOLATION: WMP12 will discard RenderingControl service if it contains <retval> tags log.warning("UPnP specification violation: Not producing <retval> element to be compatible with WMP12: " + actionArgument); // appendNewElement(descriptor, actionArgumentElement, ELEMENT.retval); } appendNewElementIfNotNull(descriptor, actionArgumentElement, ELEMENT.relatedStateVariable, actionArgument.getRelatedStateVariableName()); }
@Override public void endElement(ELEMENT element) throws SAXException { switch (element) { case name: getInstance().name = getCharacters(); break; case direction: String directionString = getCharacters(); try { getInstance().direction = ActionArgument.Direction.valueOf(directionString.toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException ex) { // TODO: UPNP VIOLATION: Pelco SpectraIV-IP uses illegal value INOUT log.warning("UPnP specification violation: Invalid action argument direction, assuming 'IN': " + directionString); getInstance().direction = ActionArgument.Direction.IN; } break; case relatedStateVariable: getInstance().relatedStateVariable = getCharacters(); break; case retval: getInstance().retval = true; break; } }
public void hydrateActionArgument(MutableActionArgument actionArgument, Node actionArgumentNode) { NodeList argumentNodeChildren = actionArgumentNode.getChildNodes(); for (int i = 0; i < argumentNodeChildren.getLength(); i++) { Node argumentNodeChild = argumentNodeChildren.item(i); if (argumentNodeChild.getNodeType() != Node.ELEMENT_NODE) continue; if (ELEMENT.name.equals(argumentNodeChild)) { actionArgument.name = XMLUtil.getTextContent(argumentNodeChild); } else if (ELEMENT.direction.equals(argumentNodeChild)) { String directionString = XMLUtil.getTextContent(argumentNodeChild); try { actionArgument.direction = ActionArgument.Direction.valueOf(directionString.toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException ex) { // TODO: UPNP VIOLATION: Pelco SpectraIV-IP uses illegal value INOUT log.warning("UPnP specification violation: Invalid action argument direction, assuming 'IN': " + directionString); actionArgument.direction = ActionArgument.Direction.IN; } } else if (ELEMENT.relatedStateVariable.equals(argumentNodeChild)) { actionArgument.relatedStateVariable = XMLUtil.getTextContent(argumentNodeChild); } else if (ELEMENT.retval.equals(argumentNodeChild)) { actionArgument.retval = true; } } }
public Action(String name, ActionArgument[] arguments) { this.name = name; if (arguments != null) { List<ActionArgument> inputList= new ArrayList(); List<ActionArgument> outputList = new ArrayList(); for (ActionArgument argument : arguments) { argument.setAction(this); if (argument.getDirection().equals(ActionArgument.Direction.IN)) inputList.add(argument); if (argument.getDirection().equals(ActionArgument.Direction.OUT)) outputList.add(argument); } this.arguments = arguments; this.inputArguments = inputList.toArray(new ActionArgument[inputList.size()]); this.outputArguments = outputList.toArray(new ActionArgument[outputList.size()]); } else { this.arguments = new ActionArgument[0]; this.inputArguments = new ActionArgument[0]; this.outputArguments = new ActionArgument[0]; } }
private void generateActionArgument(ActionArgument actionArgument, Document descriptor, Element actionElement) { Element actionArgumentElement = appendNewElement(descriptor, actionElement, ELEMENT.argument); appendNewElementIfNotNull(descriptor, actionArgumentElement, ELEMENT.name, actionArgument.getName()); appendNewElementIfNotNull(descriptor, actionArgumentElement, ELEMENT.direction, actionArgument.getDirection().toString().toLowerCase(Locale.ENGLISH)); if (actionArgument.isReturnValue()) { // TODO: UPNP VIOLATION: WMP12 will discard RenderingControl service if it contains <retval> tags log.warning("UPnP specification violation: Not producing <retval> element to be compatible with WMP12: " + actionArgument); // appendNewElement(descriptor, actionArgumentElement, ELEMENT.retval); } appendNewElementIfNotNull(descriptor, actionArgumentElement, ELEMENT.relatedStateVariable, actionArgument.getRelatedStateVariableName()); }
ActionArgument nodeActionArgument = (ActionArgument) node.getUserObject(); if (nodeActionArgument.getDirection().equals(ActionArgument.Direction.IN)) { setIcon(Application.createImageIcon(Workbench.class, "img/24/argument_in.png")); } else {
@Override public void endElement(ELEMENT element) throws SAXException { switch (element) { case name: getInstance().name = getCharacters(); break; case direction: String directionString = getCharacters(); try { getInstance().direction = ActionArgument.Direction.valueOf(directionString.toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException ex) { // TODO: UPNP VIOLATION: Pelco SpectraIV-IP uses illegal value INOUT log.warning("UPnP specification violation: Invalid action argument direction, assuming 'IN': " + directionString); getInstance().direction = ActionArgument.Direction.IN; } break; case relatedStateVariable: getInstance().relatedStateVariable = getCharacters(); break; case retval: getInstance().retval = true; break; } }
public Component getTableCellEditorComponent(JTable jTable, Object o, boolean b, int i, int i1) { if (getArgument().getDirection().equals(ActionArgument.Direction.OUT)) { if (textField.getText() != null && textField.getText().length() > 50) { JPanel panel = new JPanel(); panel.setBackground(Color.WHITE); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); JButton expandButton = new JButton("Expand"); expandButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { onExpandText(textField.getText()); } } ); panel.add(textField); panel.add(expandButton); return panel; } return textField; } return textField; }
@Override public boolean isCellEditable(int row, int column) { if (column == 1) { ActionArgument argument = argumentValuesModel.getValueAt(row); // TODO: Avoid double instantiation? return (argument.getDirection().equals(ActionArgument.Direction.IN)) || ((ArgumentValueCellEditor) getCellEditor(row, column)).handlesEditability(); } return false; }
public TextArgumentValueCellEditor(ActionArgument argument, ActionArgumentValue argumentValue) { super(argument, argumentValue); textField.setEditable(argument.getDirection().equals(ActionArgument.Direction.IN)); textField.setText(argumentValue != null ? argumentValue.toString() : ""); }