use of org.eclipse.sapphire.ValuePropertyBinding in project liferay-ide by liferay.
the class LabelPositionResource method createBinding.
@Override
protected PropertyBinding createBinding(Property property) {
PropertyBinding binding = null;
PropertyDef def = property.definition();
if (Position.PROP_X.equals(def) || Position.PROP_Y.equals(def)) {
binding = new ValuePropertyBinding() {
@Override
public String read() {
String retval = null;
if (LabelPositionResource.this._point != null) {
if (Position.PROP_X.equals(def)) {
retval = Integer.toString(LabelPositionResource.this._point.getX());
} else if (Position.PROP_Y.equals(def)) {
retval = Integer.toString(LabelPositionResource.this._point.getY());
}
}
return retval;
}
@Override
public void write(String value) {
if (LabelPositionResource.this._point == null) {
LabelPositionResource.this._point = new Point();
}
if (Position.PROP_X.equals(def)) {
LabelPositionResource.this._point.setX(Integer.parseInt(value));
} else if (Position.PROP_Y.equals(def)) {
LabelPositionResource.this._point.setY(Integer.parseInt(value));
}
/*
* if (Position.PROP_X.equals( def ) ||
* Position.PROP_Y.equals( def )) {
* WorkflowNodeMetadataObject parentMetadata =
* parent().adapt( WorkflowNodeMetadataResource.class
* ).getMetadata(); parentMetadata.setNodeLocation(
* LabelPositionResource.this.point ); }
*/
WorkflowNodeMetadataResource metadataResource = parent().adapt(WorkflowNodeMetadataResource.class);
metadataResource.saveMetadata();
}
};
}
if (binding != null) {
binding.init(property);
}
return binding;
}
Aggregations