use of net.sf.latexdraw.model.api.shape.FillingStyle in project latexdraw by arnobl.
the class TestPencilFillingStyle method testSelectFillingPlainPencil.
@Test
public void testSelectFillingPlainPencil() {
Cmds.of(activatePencil, pencilCreatesRec, updateIns).execute();
final FillingStyle style = fillStyleCB.getSelectionModel().getSelectedItem();
Cmds.of(() -> selectStyle.execute(FillingStyle.PLAIN)).execute();
final FillingStyle newStyle = fillStyleCB.getSelectionModel().getSelectedItem();
assertEquals(newStyle, editing.createShapeInstance().getFillingStyle());
assertNotEquals(style, newStyle);
}
use of net.sf.latexdraw.model.api.shape.FillingStyle in project latexdraw by arnobl.
the class TestHandFillingStyle method testSelectFillingPlainHand.
@Test
public void testSelectFillingPlainHand() {
Cmds.of(activateHand, selectionAddDot, selectionAddRec, selectionAddBezier, updateIns).execute();
final FillingStyle style = fillStyleCB.getSelectionModel().getSelectedItem();
selectStyle.execute(FillingStyle.PLAIN);
waitFXEvents.execute();
final FillingStyle newStyle = fillStyleCB.getSelectionModel().getSelectedItem();
assertEquals(newStyle, drawing.getSelection().getShapeAt(1).orElseThrow().getFillingStyle());
assertEquals(newStyle, drawing.getSelection().getShapeAt(2).orElseThrow().getFillingStyle());
assertNotEquals(style, newStyle);
}
use of net.sf.latexdraw.model.api.shape.FillingStyle in project latexdraw by arnobl.
the class ShapeFillingCustomiser method initialize.
@Override
public void initialize(final URL location, final ResourceBundle resources) {
super.initialize(location, 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());
}
use of net.sf.latexdraw.model.api.shape.FillingStyle in project latexdraw by arnobl.
the class ShapeFillingCustomiser method update.
@Override
protected void update(final Group 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);
}
}
Aggregations