// ------------------------------------------------ // Set and Get the values of the properties // ------------------------------------------------ public void setValue(int _index, Value _value) { switch (_index) { case 0: setValue(_value.getDouble()); break; case 1: setMinimum(_value.getDouble()); break; case 2: setMaximum(_value.getDouble()); break; case 3: { DecimalFormat newFormat; if (_value.getObject() instanceof DecimalFormat) { newFormat = (DecimalFormat) _value.getObject(); } else { newFormat = null; } if (format == newFormat) { return; // and save time } format = newFormat; if (format != null) { bar.setString(format.format(variable)); bar.setStringPainted(true); } else { bar.setStringPainted(false); } } break; case 4: if (bar.getOrientation() != _value.getInteger()) { bar.setOrientation(_value.getInteger()); } break; default: super.setValue(_index - 5, _value); break; } }
// ------------------------------------------------ // Set and Get the values of the properties // ------------------------------------------------ public void setValue(int _index, Value _value) { switch (_index) { case 0: // title String ejsWindow = getProperty("_ejs_window_"); // $NON-NLS-1$ if (ejsWindow != null) { frame.setTitle(_value.getString() + " " + ejsWindow); // $NON-NLS-1$ } else { frame.setTitle(_value.getString()); } break; case 1: frame.setResizable(_value.getBoolean()); break; case 2: // exit if (getProperty("_ejs_") == null) { // $NON-NLS-1$ if (_value.getBoolean()) { frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } else { frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); } } break; case 3: // action removeAction(ControlElement.ACTION, getProperty("onExit")); // $NON-NLS-1$ addAction(ControlElement.ACTION, _value.getString()); break; case NAME: // Overrides ControlElement's 'name' super.setValue(ControlWindow.NAME, _value); if ((getGroup() != null) && (getGroup().getOwnerFrame() == getComponent())) { String replacement = getGroup().getReplaceOwnerName(); if ((replacement != null) && replacement.equals(_value.getString())) { getGroup().setOwnerFrame(getGroup().getReplaceOwnerFrame()); } else { getGroup().setOwnerFrame(frame); } } break; default: super.setValue(_index - 4, _value); break; } }