Package net.sf.graphiti.ui.commands

Examples of net.sf.graphiti.ui.commands.ParameterChangeValueCommand


        if (oldValue == null && str.isEmpty()
            || String.valueOf(oldValue).equals(value)) {
          return;
        }

        ParameterChangeValueCommand command = new ParameterChangeValueCommand(
            model, "Change value");
        Class<?> parameterType = model.getParameter((String) id)
            .getType();
        if (str.isEmpty()) {
          // get default value
          value = model.getParameter(parameterName).getDefault();
        } else {
          try {
            if (parameterType == Integer.class) {
              value = Integer.valueOf(str);
            } else if (parameterType == Float.class) {
              value = Float.valueOf(str);
            } else if (parameterType == Boolean.class) {
              if (!"true".equals(value) && !"false".equals(value)) {
                throw new IllegalArgumentException();
              }
              value = Boolean.valueOf(str);
            }
          } catch (RuntimeException e) {
            value = "invalid \"" + value + "\" value for "
                + parameterType.getSimpleName();
          }
        }
        command.setValue(parameterName, value);
        doRefresh = false;
        ((GraphEditor) part).executeCommand(command);
        doRefresh = true;
      }
    } catch (PartInitException e) {
View Full Code Here

TOP

Related Classes of net.sf.graphiti.ui.commands.ParameterChangeValueCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.