use of net.sf.latexdraw.model.api.shape.ArrowStyle in project latexdraw by arnobl.
the class ShapeArrowCustomiser method initialize.
@Override
public void initialize(final URL location, final ResourceBundle resources) {
super.initialize(location, resources);
mainPane.managedProperty().bind(mainPane.visibleProperty());
dotPane.managedProperty().bind(dotPane.visibleProperty());
arrowPane.managedProperty().bind(arrowPane.visibleProperty());
barPane.managedProperty().bind(barPane.visibleProperty());
bracketPane.managedProperty().bind(bracketPane.visibleProperty());
rbracketPane.managedProperty().bind(rbracketPane.visibleProperty());
final Map<ArrowStyle, Image> cacheLeft = new EnumMap<>(ArrowStyle.class);
// NON-NLS
cacheLeft.put(ArrowStyle.NONE, new Image("/res/arrowStyles/line.none.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.BAR_END, new Image("/res/arrowStyles/line.barEnd.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.BAR_IN, new Image("/res/arrowStyles/line.barIn.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.CIRCLE_END, new Image("/res/arrowStyles/line.circle.end.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.CIRCLE_IN, new Image("/res/arrowStyles/line.circle.in.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.DISK_END, new Image("/res/arrowStyles/line.disk.end.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.DISK_IN, new Image("/res/arrowStyles/line.disk.in.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.LEFT_ARROW, new Image("/res/arrowStyles/line.arrow.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.RIGHT_ARROW, new Image("/res/arrowStyles/line.rarrow.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.LEFT_ROUND_BRACKET, new Image("/res/arrowStyles/line.arc.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.RIGHT_ROUND_BRACKET, new Image("/res/arrowStyles/line.arc.r.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.LEFT_SQUARE_BRACKET, new Image("/res/arrowStyles/line.bracket.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.RIGHT_SQUARE_BRACKET, new Image("/res/arrowStyles/line.bracket.r.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.LEFT_DBLE_ARROW, new Image("/res/arrowStyles/line.dbleArrow.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.RIGHT_DBLE_ARROW, new Image("/res/arrowStyles/line.rdbleArrow.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.ROUND_IN, new Image("/res/arrowStyles/line.roundIn.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.ROUND_END, new Image("/res/arrowStyles/line.roundEnd.left.png"));
// NON-NLS
cacheLeft.put(ArrowStyle.SQUARE_END, new Image("/res/arrowStyles/lineEnd.left.png"));
initComboBox(arrowLeftCB, cacheLeft, ArrowStyle.values());
final Map<ArrowStyle, Image> cacheRight = new EnumMap<>(ArrowStyle.class);
// NON-NLS
cacheRight.put(ArrowStyle.NONE, new Image("/res/arrowStyles/line.none.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.BAR_END, new Image("/res/arrowStyles/line.barEnd.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.BAR_IN, new Image("/res/arrowStyles/line.barIn.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.CIRCLE_END, new Image("/res/arrowStyles/line.circle.end.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.CIRCLE_IN, new Image("/res/arrowStyles/line.circle.in.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.DISK_END, new Image("/res/arrowStyles/line.disk.end.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.DISK_IN, new Image("/res/arrowStyles/line.disk.in.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.RIGHT_ARROW, new Image("/res/arrowStyles/line.arrow.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.LEFT_ARROW, new Image("/res/arrowStyles/line.rarrow.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.RIGHT_ROUND_BRACKET, new Image("/res/arrowStyles/line.arc.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.LEFT_ROUND_BRACKET, new Image("/res/arrowStyles/line.arc.r.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.RIGHT_SQUARE_BRACKET, new Image("/res/arrowStyles/line.bracket.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.LEFT_SQUARE_BRACKET, new Image("/res/arrowStyles/line.bracket.r.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.RIGHT_DBLE_ARROW, new Image("/res/arrowStyles/line.dbleArrow.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.LEFT_DBLE_ARROW, new Image("/res/arrowStyles/line.rdbleArrow.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.ROUND_IN, new Image("/res/arrowStyles/line.roundIn.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.ROUND_END, new Image("/res/arrowStyles/line.roundEnd.right.png"));
// NON-NLS
cacheRight.put(ArrowStyle.SQUARE_END, new Image("/res/arrowStyles/lineEnd.right.png"));
initComboBox(arrowRightCB, cacheRight, ArrowStyle.values());
}
use of net.sf.latexdraw.model.api.shape.ArrowStyle in project latexdraw by arnobl.
the class ShapeArrowCustomiser method update.
@Override
protected void update(final Group shape) {
if (shape.isTypeOf(Arrowable.class)) {
setActivated(true);
final Arrow arr1 = shape.getArrowAt(0);
final Arrow arr2 = shape.getArrowAt(-1);
final ArrowStyle arrStyle1 = arr1.getArrowStyle();
final ArrowStyle arrStyle2 = arr2.getArrowStyle();
arrowLeftCB.setValue(arrStyle1);
arrowRightCB.setValue(arrStyle2);
// Updating the value of the widgets.
updateArrowWidgets(arr1, arrStyle2);
updateArrowDotWidgets(arr1, arrStyle2);
updateArrowBarWidgets(arr1, arrStyle2);
updateArrowSBracketWidgets(arr1, arrStyle2);
updateArrowRBracketWidgets(arr1, arrStyle2);
} else {
setActivated(false);
}
}
use of net.sf.latexdraw.model.api.shape.ArrowStyle in project latexdraw by arnobl.
the class TestHandArrowStyle method testSelectLeftArrowStyleHand.
@Test
public void testSelectLeftArrowStyleHand() {
Cmds.of(selectionAddBezier, selectionAddBezier, activateHand, updateIns).execute();
final ArrowStyle style = arrowLeftCB.getSelectionModel().getSelectedItem();
selectArrowLeftCB.execute(ArrowStyle.BAR_IN);
waitFXEvents.execute();
final ArrowStyle newStyle = arrowLeftCB.getSelectionModel().getSelectedItem();
assertEquals(ArrowStyle.BAR_IN, newStyle);
assertEquals(newStyle, ((ArrowableSingleShape) drawing.getSelection().getShapeAt(0).orElseThrow()).getArrowAt(0).getArrowStyle());
assertEquals(newStyle, ((ArrowableSingleShape) drawing.getSelection().getShapeAt(1).orElseThrow()).getArrowAt(0).getArrowStyle());
assertNotEquals(style, newStyle);
}
use of net.sf.latexdraw.model.api.shape.ArrowStyle in project latexdraw by arnobl.
the class TestPencilArrowStyle method testSelectLeftArrowStyleRIGHTDBLEARROWPencil.
@Test
public void testSelectLeftArrowStyleRIGHTDBLEARROWPencil() {
Cmds.of(activatePencil, pencilCreatesBezier, updateIns).execute();
final ArrowStyle style = arrowLeftCB.getSelectionModel().getSelectedItem();
Cmds.of(() -> selectArrowLeftCB.execute(ArrowStyle.RIGHT_DBLE_ARROW)).execute();
final ArrowStyle newStyle = arrowLeftCB.getSelectionModel().getSelectedItem();
assertEquals(ArrowStyle.RIGHT_DBLE_ARROW, newStyle);
assertEquals(newStyle, ((ArrowableSingleShape) editing.createShapeInstance()).getArrowAt(0).getArrowStyle());
assertNotEquals(style, newStyle);
assertTrue(arrowPane.isVisible());
assertFalse(dotPane.isVisible());
assertFalse(barPane.isVisible());
assertFalse(bracketPane.isVisible());
assertFalse(rbracketPane.isVisible());
}
use of net.sf.latexdraw.model.api.shape.ArrowStyle in project latexdraw by arnobl.
the class TestPencilArrowStyle method testSelectRightArrowStyleLEFTARROWPencil.
@Test
public void testSelectRightArrowStyleLEFTARROWPencil() {
Cmds.of(activatePencil, pencilCreatesBezier, updateIns).execute();
final ArrowStyle style = arrowRightCB.getSelectionModel().getSelectedItem();
Cmds.of(() -> selectArrowRightCB.execute(ArrowStyle.LEFT_ARROW)).execute();
final ArrowStyle newStyle = arrowRightCB.getSelectionModel().getSelectedItem();
assertEquals(ArrowStyle.LEFT_ARROW, newStyle);
assertEquals(newStyle, ((ArrowableSingleShape) editing.createShapeInstance()).getArrowAt(-1).getArrowStyle());
assertNotEquals(style, newStyle);
assertTrue(arrowPane.isVisible());
assertFalse(dotPane.isVisible());
assertFalse(barPane.isVisible());
assertFalse(bracketPane.isVisible());
assertFalse(rbracketPane.isVisible());
}
Aggregations