use of net.sf.latexdraw.models.interfaces.shape.FillingStyle in project latexdraw by arnobl.
the class ShapeFillingCustomiser method update.
@Override
protected void update(final IGroup shape) {
if (shape.isInteriorStylable()) {
setActivated(true);
final FillingStyle style = shape.getFillingStyle();
final boolean isFillable = style.isFilled();
final boolean hatchings = style.isHatchings();
final boolean gradient = style.isGradient();
// Updating the visibility of the widgets.
gradientPane.setVisible(gradient);
hatchingsPane.setVisible(hatchings);
fillPane.setVisible(isFillable);
fillStyleCB.getSelectionModel().select(style);
if (isFillable) {
fillColButton.setValue(shape.getFillingCol().toJFX());
}
if (hatchings) {
hatchColButton.setValue(shape.getHatchingsCol().toJFX());
hatchAngleField.getValueFactory().setValue(Math.toDegrees(shape.getHatchingsAngle()));
hatchSepField.getValueFactory().setValue(shape.getHatchingsSep());
hatchWidthField.getValueFactory().setValue(shape.getHatchingsWidth());
} else if (gradient) {
gradStartColButton.setValue(shape.getGradColStart().toJFX());
gradEndColButton.setValue(shape.getGradColEnd().toJFX());
gradAngleField.getValueFactory().setValue(Math.toDegrees(shape.getGradAngle()));
gradMidPtField.getValueFactory().setValue(shape.getGradMidPt());
}
} else {
setActivated(false);
}
}
use of net.sf.latexdraw.models.interfaces.shape.FillingStyle in project latexdraw by arnobl.
the class TestPencilFillingStyle method testSelectFillingPlainPencil.
@Test
public void testSelectFillingPlainPencil() {
new CompositeGUIVoidCommand(activatePencil, pencilCreatesRec, updateIns).execute();
FillingStyle style = fillStyleCB.getSelectionModel().getSelectedItem();
selectStyle.execute(FillingStyle.PLAIN);
FillingStyle newStyle = fillStyleCB.getSelectionModel().getSelectedItem();
assertEquals(newStyle, pencil.createShapeInstance().getFillingStyle());
assertNotEquals(style, newStyle);
}
use of net.sf.latexdraw.models.interfaces.shape.FillingStyle in project latexdraw by arnobl.
the class TestHandFillingStyle method testSelectFillingPlainHand.
@Test
public void testSelectFillingPlainHand() {
new CompositeGUIVoidCommand(activateHand, selectionAddDot, selectionAddRec, selectionAddBezier, updateIns).execute();
FillingStyle style = fillStyleCB.getSelectionModel().getSelectedItem();
selectStyle.execute(FillingStyle.PLAIN);
FillingStyle newStyle = fillStyleCB.getSelectionModel().getSelectedItem();
assertEquals(newStyle, drawing.getSelection().getShapeAt(1).getFillingStyle());
assertEquals(newStyle, drawing.getSelection().getShapeAt(2).getFillingStyle());
assertNotEquals(style, newStyle);
}
use of net.sf.latexdraw.models.interfaces.shape.FillingStyle in project latexdraw by arnobl.
the class ShapeFillingCustomiser method initialize.
@Override
public void initialize(final URL location, final ResourceBundle resources) {
mainPane.managedProperty().bind(mainPane.visibleProperty());
fillPane.managedProperty().bind(fillPane.visibleProperty());
hatchingsPane.managedProperty().bind(hatchingsPane.visibleProperty());
gradientPane.managedProperty().bind(gradientPane.visibleProperty());
final Map<FillingStyle, Image> cache = new EnumMap<>(FillingStyle.class);
// NON-NLS
cache.put(FillingStyle.NONE, new Image("/res/hatch/hatch.none.png"));
// NON-NLS
cache.put(FillingStyle.PLAIN, new Image("/res/hatch/hatch.solid.png"));
// NON-NLS
cache.put(FillingStyle.CLINES, new Image("/res/hatch/hatch.cross.png"));
// NON-NLS
cache.put(FillingStyle.CLINES_PLAIN, new Image("/res/hatch/hatchf.cross.png"));
// NON-NLS
cache.put(FillingStyle.HLINES, new Image("/res/hatch/hatch.horiz.png"));
// NON-NLS
cache.put(FillingStyle.HLINES_PLAIN, new Image("/res/hatch/hatchf.horiz.png"));
// NON-NLS
cache.put(FillingStyle.VLINES, new Image("/res/hatch/hatch.vert.png"));
// NON-NLS
cache.put(FillingStyle.VLINES_PLAIN, new Image("/res/hatch/hatchf.vert.png"));
// NON-NLS
cache.put(FillingStyle.GRAD, new Image("/res/hatch/gradient.png"));
initComboBox(fillStyleCB, cache, FillingStyle.values());
}
Aggregations