use of java.beans.PropertyChangeEvent in project Payara by payara.
the class HealthHistory method changed.
@Override
public UnprocessedChangeEvents changed(PropertyChangeEvent[] events) {
Object oldVal;
Object newVal;
for (PropertyChangeEvent event : events) {
oldVal = event.getOldValue();
newVal = event.getNewValue();
if (oldVal instanceof ServerRef && newVal == null) {
ServerRef instance = (ServerRef) oldVal;
deleteInstance(instance.getRef());
} else if (newVal instanceof ServerRef && oldVal == null) {
ServerRef instance = (ServerRef) newVal;
addInstance(instance.getRef());
}
}
return null;
}
use of java.beans.PropertyChangeEvent in project yamcs-studio by yamcs.
the class WidgetConnectionEditPart method activate.
@Override
public void activate() {
if (!isActive()) {
super.activate();
getWidgetModel().getProperty(ConnectionModel.PROP_LINE_COLOR).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
getConnectionFigure().setForegroundColor(((OPIColor) evt.getNewValue()).getSWTColor());
}
});
getWidgetModel().getProperty(ConnectionModel.PROP_LINE_STYLE).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
getConnectionFigure().setLineStyle(getWidgetModel().getLineStyle());
}
});
getWidgetModel().getProperty(ConnectionModel.PROP_LINE_WIDTH).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
getConnectionFigure().setLineWidth(getWidgetModel().getLineWidth());
}
});
getWidgetModel().getProperty(ConnectionModel.PROP_ROUTER).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
updateRouter(getConnectionFigure());
}
});
getWidgetModel().getProperty(ConnectionModel.PROP_POINTS).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(final PropertyChangeEvent evt) {
if (getViewer() == null || getViewer().getControl() == null) {
return;
}
Runnable runnable = new Runnable() {
@Override
public void run() {
if (((PointList) evt.getOldValue()).size() != ((PointList) evt.getNewValue()).size())
updateRouter(getConnectionFigure());
else
refreshBendpoints(getConnectionFigure());
}
};
// It should update at the same rate as other widget at run time
if (getExecutionMode() == ExecutionMode.RUN_MODE) {
Display display = getViewer().getControl().getDisplay();
WidgetIgnorableUITask task = new WidgetIgnorableUITask(getWidgetModel().getProperty(ConnectionModel.PROP_POINTS), runnable, display);
GUIRefreshThread.getInstance(getExecutionMode() == ExecutionMode.RUN_MODE).addIgnorableTask(task);
} else
runnable.run();
}
});
getWidgetModel().getProperty(ConnectionModel.PROP_ARROW_LENGTH).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
updateArrowLength(getConnectionFigure());
}
});
getWidgetModel().getProperty(ConnectionModel.PROP_ARROW_TYPE).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
updateDecoration(getConnectionFigure());
updateArrowLength(getConnectionFigure());
}
});
getWidgetModel().getProperty(ConnectionModel.PROP_FILL_ARROW).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
updateDecoration(getConnectionFigure());
updateArrowLength(getConnectionFigure());
}
});
getWidgetModel().getProperty(ConnectionModel.PROP_ANTIALIAS).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
getConnectionFigure().setAntialias(getWidgetModel().isAntiAlias() ? SWT.ON : SWT.OFF);
for (Object obj : getConnectionFigure().getChildren()) {
if (obj instanceof Shape)
((Shape) obj).setAntialias(getWidgetModel().isAntiAlias() ? SWT.ON : SWT.OFF);
}
}
});
getWidgetModel().getProperty(ConnectionModel.PROP_LINE_JUMP_ADD).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
getConnectionFigure().setLineJumpAdd(getWidgetModel().getLineJumpAdd());
Runnable runnable = new Runnable() {
@Override
public void run() {
getConnectionFigure().repaint();
}
};
WidgetIgnorableUITask task = new WidgetIgnorableUITask(getWidgetModel().getProperty(ConnectionModel.PROP_LINE_JUMP_ADD), runnable, getViewer().getControl().getDisplay());
GUIRefreshThread.getInstance(getExecutionMode() == ExecutionMode.EDIT_MODE).addIgnorableTask(task);
}
});
getWidgetModel().getProperty(ConnectionModel.PROP_LINE_JUMP_SIZE).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
getConnectionFigure().setLineJumpSize(getWidgetModel().getLineJumpSize());
Runnable runnable = new Runnable() {
@Override
public void run() {
getConnectionFigure().repaint();
}
};
WidgetIgnorableUITask task = new WidgetIgnorableUITask(getWidgetModel().getProperty(ConnectionModel.PROP_LINE_JUMP_SIZE), runnable, getViewer().getControl().getDisplay());
GUIRefreshThread.getInstance(getExecutionMode() == ExecutionMode.EDIT_MODE).addIgnorableTask(task);
}
});
getWidgetModel().getProperty(ConnectionModel.PROP_LINE_JUMP_STYLE).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
getConnectionFigure().setLineJumpStyle(getWidgetModel().getLineJumpStyle());
Runnable runnable = new Runnable() {
@Override
public void run() {
getConnectionFigure().repaint();
}
};
WidgetIgnorableUITask task = new WidgetIgnorableUITask(getWidgetModel().getProperty(ConnectionModel.PROP_LINE_JUMP_SIZE), runnable, getViewer().getControl().getDisplay());
GUIRefreshThread.getInstance(getExecutionMode() == ExecutionMode.EDIT_MODE).addIgnorableTask(task);
}
});
getWidgetModel().getProperty(ConnectionModel.PROP_IS_LOADED_FROM_LINKING_CONTAINER).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
updateRouter(getConnectionFigure());
}
});
}
}
use of java.beans.PropertyChangeEvent in project yamcs-studio by yamcs.
the class TextInputEditpart method registerPropertyChangeHandlers.
@Override
protected void registerPropertyChangeHandlers() {
super.registerPropertyChangeHandlers();
if (getExecutionMode() == ExecutionMode.RUN_MODE) {
removeAllPropertyChangeHandlers(LabelModel.PROP_TEXT);
IWidgetPropertyChangeHandler handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, final IFigure figure) {
String text = (String) newValue;
if (getPV() == null) {
setFigureText(text);
if (getWidgetModel().isAutoSize()) {
Display.getCurrent().timerExec(10, new Runnable() {
@Override
public void run() {
performAutoSize();
}
});
}
}
// Output pv value even if pv name is empty, so setPVValuelistener can be triggered.
outputPVValue(text);
return false;
}
};
setPropertyChangeHandler(LabelModel.PROP_TEXT, handler);
}
IWidgetPropertyChangeHandler pvNameHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
registerLoadLimitsListener();
return false;
}
};
setPropertyChangeHandler(AbstractPVWidgetModel.PROP_PVNAME, pvNameHandler);
PropertyChangeListener updatePropSheetListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent arg0) {
updatePropSheet();
}
};
getWidgetModel().getProperty(TextInputModel.PROP_LIMITS_FROM_PV).addPropertyChangeListener(updatePropSheetListener);
getWidgetModel().getProperty(TextInputModel.PROP_SELECTOR_TYPE).addPropertyChangeListener(updatePropSheetListener);
PropertyChangeListener reCreateWidgetListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
reCreateWidget();
}
};
getWidgetModel().getProperty(TextInputModel.PROP_STYLE).addPropertyChangeListener(reCreateWidgetListener);
delegate.registerPropertyChangeHandlers();
}
use of java.beans.PropertyChangeEvent in project yamcs-studio by yamcs.
the class IntensityGraphEditPart method registerPropertyChangeHandlers.
@Override
protected void registerPropertyChangeHandlers() {
innerUpdateGraphAreaSizeProperty();
registerAxisPropertyChangeHandler();
registerROIPropertyChangeHandlers();
registerROIAmountChangeHandler();
IWidgetPropertyChangeHandler handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
if (newValue == null)
return false;
VType value = (VType) newValue;
if (value instanceof VNumberArray) {
setValue(((VNumberArray) value).getData());
return false;
}
((IntensityGraphFigure) figure).setDataArray(VTypeHelper.getDoubleArray(value));
return false;
}
};
setPropertyChangeHandler(AbstractPVWidgetModel.PROP_PVVALUE, handler);
getWidgetModel().getProperty(IntensityGraphModel.PROP_MIN).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
((IntensityGraphFigure) figure).setMin((Double) evt.getNewValue());
figure.repaint();
innerUpdateGraphAreaSizeProperty();
}
});
getWidgetModel().getProperty(IntensityGraphModel.PROP_MAX).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
((IntensityGraphFigure) figure).setMax((Double) evt.getNewValue());
figure.repaint();
innerUpdateGraphAreaSizeProperty();
}
});
getWidgetModel().getProperty(IntensityGraphModel.PROP_BORDER_STYLE).removeAllPropertyChangeListeners();
getWidgetModel().getProperty(IntensityGraphModel.PROP_BORDER_STYLE).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
figure.setBorder(BorderFactory.createBorder(BorderStyle.values()[(Integer) evt.getNewValue()], getWidgetModel().getBorderWidth(), getWidgetModel().getBorderColor(), getWidgetModel().getName()));
innerUpdateGraphAreaSizeProperty();
}
});
getWidgetModel().getProperty(IntensityGraphModel.PROP_BORDER_WIDTH).removeAllPropertyChangeListeners();
getWidgetModel().getProperty(IntensityGraphModel.PROP_BORDER_WIDTH).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
figure.setBorder(BorderFactory.createBorder(getWidgetModel().getBorderStyle(), (Integer) evt.getNewValue(), getWidgetModel().getBorderColor(), getWidgetModel().getName()));
innerUpdateGraphAreaSizeProperty();
}
});
handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((IntensityGraphFigure) figure).setDataWidth((Integer) newValue);
return true;
}
};
setPropertyChangeHandler(IntensityGraphModel.PROP_DATA_WIDTH, handler);
handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((IntensityGraphFigure) figure).setDataHeight((Integer) newValue);
return true;
}
};
setPropertyChangeHandler(IntensityGraphModel.PROP_DATA_HEIGHT, handler);
handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((IntensityGraphFigure) figure).setColorMap((ColorMap) newValue);
return true;
}
};
setPropertyChangeHandler(IntensityGraphModel.PROP_COLOR_MAP, handler);
handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((IntensityGraphFigure) figure).setCropLeft((Integer) newValue);
return true;
}
};
setPropertyChangeHandler(IntensityGraphModel.PROP_CROP_LEFT, handler);
handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((IntensityGraphFigure) figure).setCropRight((Integer) newValue);
return true;
}
};
setPropertyChangeHandler(IntensityGraphModel.PROP_CROP_RIGHT, handler);
handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((IntensityGraphFigure) figure).setCropTop((Integer) newValue);
return true;
}
};
setPropertyChangeHandler(IntensityGraphModel.PROP_CROP_TOP, handler);
handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((IntensityGraphFigure) figure).setCropBottom((Integer) newValue);
return true;
}
};
setPropertyChangeHandler(IntensityGraphModel.PROP_CROP_BOTTOM, handler);
getWidgetModel().getProperty(IntensityGraphModel.PROP_SHOW_RAMP).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
((IntensityGraphFigure) getFigure()).setShowRamp((Boolean) evt.getNewValue());
Dimension d = ((IntensityGraphFigure) getFigure()).getGraphAreaInsets();
innerTrig = true;
getWidgetModel().setPropertyValue(IntensityGraphModel.PROP_GRAPH_AREA_WIDTH, getWidgetModel().getWidth() - d.width);
innerTrig = false;
}
});
getWidgetModel().getProperty(IntensityGraphModel.PROP_WIDTH).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (!innerTrig) {
// if it is not triggered from inner
innerTrig = true;
Dimension d = ((IntensityGraphFigure) getFigure()).getGraphAreaInsets();
getWidgetModel().setPropertyValue(IntensityGraphModel.PROP_GRAPH_AREA_WIDTH, ((Integer) evt.getNewValue()) - d.width);
// reset innerTrig to false after each inner triggering
innerTrig = false;
} else
// if it is triggered from inner, do nothing
innerTrig = false;
}
});
getWidgetModel().getProperty(IntensityGraphModel.PROP_GRAPH_AREA_WIDTH).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (!innerTrig) {
innerTrig = true;
Dimension d = ((IntensityGraphFigure) getFigure()).getGraphAreaInsets();
getWidgetModel().setPropertyValue(IntensityGraphModel.PROP_WIDTH, ((Integer) evt.getNewValue()) + d.width);
// reset innerTrig to false after each inner triggering
innerTrig = false;
} else
innerTrig = false;
}
});
getWidgetModel().getProperty(IntensityGraphModel.PROP_HEIGHT).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (!innerTrig) {
innerTrig = true;
Dimension d = ((IntensityGraphFigure) getFigure()).getGraphAreaInsets();
getWidgetModel().setPropertyValue(IntensityGraphModel.PROP_GRAPH_AREA_HEIGHT, ((Integer) evt.getNewValue()) - d.height);
// reset innerTrig to false after each inner triggering
innerTrig = false;
} else
innerTrig = false;
}
});
getWidgetModel().getProperty(IntensityGraphModel.PROP_GRAPH_AREA_HEIGHT).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (!innerTrig) {
innerTrig = true;
Dimension d = ((IntensityGraphFigure) getFigure()).getGraphAreaInsets();
getWidgetModel().setPropertyValue(IntensityGraphModel.PROP_HEIGHT, ((Integer) evt.getNewValue()) + d.height);
// reset innerTrig to false after each inner triggering
innerTrig = false;
} else
innerTrig = false;
}
});
getWidgetModel().getProperty(IntensityGraphModel.PROP_RGB_MODE).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
updatePropSheet();
((IntensityGraphFigure) getFigure()).setInRGBMode((Boolean) (evt.getNewValue()));
}
});
handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((IntensityGraphFigure) getFigure()).setColorDepth(getWidgetModel().getColorDepth());
return false;
}
};
setPropertyChangeHandler(IntensityGraphModel.PROP_COLOR_DEPTH, handler);
handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((IntensityGraphFigure) getFigure()).setSingleLineProfiling((Boolean) newValue);
return false;
}
};
setPropertyChangeHandler(IntensityGraphModel.PROP_SINGLE_LINE_PROFILING, handler);
handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((IntensityGraphFigure) getFigure()).setROIColor(((OPIColor) newValue).getSWTColor());
return false;
}
};
setPropertyChangeHandler(IntensityGraphModel.PROP_ROI_COLOR, handler);
}
use of java.beans.PropertyChangeEvent in project BoofCV by lessthanoptimal.
the class ShowImageBlurApp method createRadialSelect.
private JPanel createRadialSelect() {
JPanel ret = new JPanel();
ret.setLayout(new BoxLayout(ret, BoxLayout.X_AXIS));
JLabel desc = new JLabel("Radius:");
radiusSpinner = new JSpinner(new SpinnerNumberModel(radius, 1, 30, 1));
radiusSpinner.addChangeListener(this);
radiusSpinner.setMaximumSize(radiusSpinner.getPreferredSize());
ret.add(Box.createRigidArea(new Dimension(10, 1)));
ret.add(desc);
ret.add(radiusSpinner);
// change the enabled status of the spinner
ret.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("enabled")) {
JPanel src = (JPanel) evt.getSource();
boolean value = (Boolean) evt.getNewValue();
src.getComponent(1).setEnabled(value);
src.getComponent(2).setEnabled(value);
}
}
});
return ret;
}
Aggregations