use of com.ramussoft.pb.frames.components.JFontChooser in project ramus by Vitaliy-Yakovchuk.
the class SectorFontAttributePlugin 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 JFontChooser component;
private Font font;
{
component = new JFontChooser();
ResourceLoader.setJComponentsText(component);
}
@Override
public Object setValue(Object value) {
this.pin = (PaintSector.Pin) value;
font = pin.getSector().getFont();
component.setSelFont(font);
return value;
}
@Override
public Object getValue() {
return pin;
}
@Override
public JComponent getComponent() {
return component;
}
@Override
public void apply(Engine engine, Element element, Attribute attribute, Object value) {
PaintSector sector = pin.getSector();
sector.setFont(component.getSelFont());
sector.copyVisual(Sector.VISUAL_COPY_ADDED);
pin.getSector().getMovingArea().getRefactor().setUndoPoint();
}
@Override
public boolean isSaveAnyway() {
return !font.equals(component.getSelFont());
}
};
}
Aggregations