use of javafx.scene.shape.Shape in project contentment by GeePawHill.
the class TypeFace method color.
public static Style color(Paint stroke, Paint fill, Double opacity) {
StyleApplier applier = new StyleApplier() {
@Override
public void apply(Shape shape) {
shape.setStroke(stroke);
shape.setFill(fill);
shape.setOpacity(opacity);
}
};
String value = "Stroke: " + stroke.toString() + " Fill: " + fill.toString() + " Opacity: " + opacity;
return new Style(COLOR, applier, value);
}
use of javafx.scene.shape.Shape in project lttng-scope by lttng.
the class TimeGraphWidgetDrawnEventsTest method testRegisteredButNotEnabledProvider.
/**
* Test that a provider that is not registered but (somehow) enabled does
* not paint its event.
*/
@Test
public void testRegisteredButNotEnabledProvider() {
TimeGraphDrawnEventProvider provider1 = new StubDrawnEventProvider1();
TimeGraphDrawnEventProvider provider2 = new StubDrawnEventProvider2();
MANAGER.getRegisteredProviders().add(provider1);
MANAGER.getRegisteredProviders().add(provider2);
provider1.enabledProperty().set(false);
provider2.enabledProperty().set(true);
repaint();
Collection<Shape> events = getRenderedEvents();
assertEquals(StubDrawnEventProvider2.NB_SYMBOLS, events.size());
}
use of javafx.scene.shape.Shape in project lttng-scope by lttng.
the class TimeGraphWidgetDrawnEventsTest method testEnabledButNotRegisteredProvider.
/**
* Test that a provider that is registered but not enabled does not paint
* its events.
*/
@Test
public void testEnabledButNotRegisteredProvider() {
TimeGraphDrawnEventProvider provider = new StubDrawnEventProvider1();
provider.enabledProperty().set(true);
repaint();
Collection<Shape> events = getRenderedEvents();
assertTrue(events.isEmpty());
}
use of javafx.scene.shape.Shape in project lttng-scope by lttng.
the class TimeGraphWidgetDrawnEventsTest method testManyProviders.
/**
* Test several enabled+registered providers at the same time. They should
* all paint their own events.
*/
@Test
public void testManyProviders() {
TimeGraphDrawnEventProvider provider1 = new StubDrawnEventProvider1();
TimeGraphDrawnEventProvider provider2 = new StubDrawnEventProvider2();
MANAGER.getRegisteredProviders().add(provider1);
MANAGER.getRegisteredProviders().add(provider2);
provider1.enabledProperty().set(true);
provider2.enabledProperty().set(true);
repaint();
Collection<Shape> events = getRenderedEvents();
assertEquals(StubDrawnEventProvider1.NB_SYMBOLS + StubDrawnEventProvider2.NB_SYMBOLS, events.size());
}
use of javafx.scene.shape.Shape in project latexdraw by arnobl.
the class ViewShape method getActivatedGroupNodes.
private static Collection<Shape> getActivatedGroupNodes(final Group gp) {
// Adding all the shape children
final Collection<Shape> shapes = gp.getChildren().stream().filter(node -> node instanceof Shape && node.isVisible() && !node.isDisable()).map(node -> (Shape) node).collect(Collectors.toList());
// Adding all the view shape children
shapes.addAll(gp.getChildren().stream().filter(node -> node instanceof ViewShape<?> && node.isVisible() && !node.isDisable()).map(vs -> ((ViewShape<?>) vs).getActivatedShapes()).flatMap(st -> st.stream()).collect(Collectors.toList()));
// Adding the shapes contained in groups that are not view shapes
shapes.addAll(gp.getChildren().stream().filter(node -> node instanceof Group && !(node instanceof ViewShape<?>)).map(node -> getActivatedGroupNodes((Group) node)).flatMap(st -> st.stream()).collect(Collectors.toList()));
// Adding the images contained in the group
shapes.addAll(gp.getChildren().stream().filter(node -> node instanceof ImageView && node.isVisible() && !node.isDisable()).map(node -> {
final Bounds bounds = node.getBoundsInParent();
Rectangle rec = new Rectangle(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight());
rec.setFill(Color.WHITE);
rec.getTransforms().setAll(gp.getLocalToSceneTransform());
return rec;
}).collect(Collectors.toList()));
return shapes;
}
Aggregations