use of net.sf.latexdraw.models.interfaces.shape.IArrowableSingleShape in project latexdraw by arnobl.
the class TestPencilArrowStyle method testSelectRightArrowStyleROUNDINPencil.
@Test
public void testSelectRightArrowStyleROUNDINPencil() {
new CompositeGUIVoidCommand(activatePencil, pencilCreatesBezier, updateIns).execute();
ArrowStyle style = arrowRightCB.getSelectionModel().getSelectedItem();
selectArrowRightCB.execute(ArrowStyle.ROUND_IN);
ArrowStyle newStyle = arrowRightCB.getSelectionModel().getSelectedItem();
assertEquals(ArrowStyle.ROUND_IN, newStyle);
assertEquals(newStyle, ((IArrowableSingleShape) pencil.createShapeInstance()).getArrowAt(-1).getArrowStyle());
assertNotEquals(style, newStyle);
assertFalse(arrowPane.isVisible());
assertFalse(dotPane.isVisible());
assertFalse(barPane.isVisible());
assertFalse(bracketPane.isVisible());
assertFalse(rbracketPane.isVisible());
}
use of net.sf.latexdraw.models.interfaces.shape.IArrowableSingleShape in project latexdraw by arnobl.
the class PSTShapeView method getArrowsParametersCode.
/**
* @return The PST code corresponding to the arrow parameters of the shape. Or null if no arrow.
* @since 3.0
*/
protected StringBuilder getArrowsParametersCode() {
StringBuilder code = null;
if (shape instanceof IArrowableSingleShape) {
final IArrowableSingleShape arr = (IArrowableSingleShape) shape;
final ArrowStyle style1 = arr.getArrowStyle(0);
final ArrowStyle style2 = arr.getArrowStyle(-1);
if (style1 == ArrowStyle.NONE) {
if (style2 != ArrowStyle.NONE)
code = getArrowParametersCode(arr.getArrowAt(-1));
} else if (style2 == ArrowStyle.NONE)
code = getArrowParametersCode(arr.getArrowAt(0));
else if (style1.isSameKind(style2))
code = getArrowParametersCode(arr.getArrowAt(0));
else {
code = getArrowParametersCode(arr.getArrowAt(0));
code.append(',').append(getArrowParametersCode(arr.getArrowAt(-1)));
}
}
return code;
}
use of net.sf.latexdraw.models.interfaces.shape.IArrowableSingleShape in project latexdraw by arnobl.
the class PSTShapeView method getArrowsStyleCode.
/**
* @return The PST code corresponding to the style of the arrows (e.g. {|->}).
* @since 3.0
*/
protected StringBuilder getArrowsStyleCode() {
final StringBuilder code;
if (shape instanceof IArrowableSingleShape) {
final IArrowableSingleShape arr = (IArrowableSingleShape) shape;
final ArrowStyle style1 = arr.getArrowStyle(0);
final ArrowStyle style2 = arr.getArrowStyle(-1);
if (style1 == ArrowStyle.NONE && style2 == ArrowStyle.NONE)
code = null;
else
code = new StringBuilder().append('{').append(style1.getPSTToken()).append('-').append(style2.getPSTToken()).append('}');
} else
code = null;
return code;
}
use of net.sf.latexdraw.models.interfaces.shape.IArrowableSingleShape in project latexdraw by arnobl.
the class TestHandArrowStyle method testSelectRightArrowStyleHand.
@Test
public void testSelectRightArrowStyleHand() {
new CompositeGUIVoidCommand(selectionAddBezier, selectionAddBezier, activateHand, updateIns).execute();
ArrowStyle style = arrowRightCB.getSelectionModel().getSelectedItem();
selectArrowRightCB.execute(ArrowStyle.ROUND_IN);
ArrowStyle newStyle = arrowRightCB.getSelectionModel().getSelectedItem();
assertEquals(ArrowStyle.ROUND_IN, newStyle);
assertEquals(newStyle, ((IArrowableSingleShape) drawing.getSelection().getShapeAt(0)).getArrowAt(-1).getArrowStyle());
assertEquals(newStyle, ((IArrowableSingleShape) drawing.getSelection().getShapeAt(1)).getArrowAt(-1).getArrowStyle());
assertNotEquals(style, newStyle);
}
use of net.sf.latexdraw.models.interfaces.shape.IArrowableSingleShape in project latexdraw by arnobl.
the class TestHandArrowStyle method testSelectLeftArrowStyleHand.
@Test
public void testSelectLeftArrowStyleHand() {
new CompositeGUIVoidCommand(selectionAddBezier, selectionAddBezier, activateHand, updateIns).execute();
ArrowStyle style = arrowLeftCB.getSelectionModel().getSelectedItem();
selectArrowLeftCB.execute(ArrowStyle.BAR_IN);
ArrowStyle newStyle = arrowLeftCB.getSelectionModel().getSelectedItem();
assertEquals(ArrowStyle.BAR_IN, newStyle);
assertEquals(newStyle, ((IArrowableSingleShape) drawing.getSelection().getShapeAt(0)).getArrowAt(0).getArrowStyle());
assertEquals(newStyle, ((IArrowableSingleShape) drawing.getSelection().getShapeAt(1)).getArrowAt(0).getArrowStyle());
assertNotEquals(style, newStyle);
}
Aggregations