use of com.ramussoft.pb.frames.components.LineStyleChooser in project ramus by Vitaliy-Yakovchuk.
the class LineStyleAttributePlugin method getAttributeEditor.
@Override
public AttributeEditor getAttributeEditor(final Engine engine, final AccessRules rules, final Element element, final Attribute attribute, AttributeEditor old) {
if (old != null)
old.close();
return new AbstractAttributeEditor() {
private PaintSector.Pin pin;
private LineStyleChooser component;
private Stroke stroke;
{
component = new LineStyleChooser();
}
@Override
public Object setValue(Object value) {
this.pin = (PaintSector.Pin) value;
stroke = pin.getSector().getStroke();
component.setStroke(stroke);
return value;
}
@Override
public Object getValue() {
return pin;
}
@Override
public void apply(Engine engine, Element element, Attribute attribute, Object value) {
LineStyleAttributePlugin.this.apply(component.getStroke(), pin);
}
@Override
public JComponent getComponent() {
return component;
}
@Override
public boolean isSaveAnyway() {
return !stroke.equals(component.getStroke());
}
};
}
Aggregations