Java Code Examples for javafx.scene.layout.Region#setVisible()

The following examples show how to use javafx.scene.layout.Region#setVisible() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorkbenchView.java    From WorkbenchFX with Apache License 2.0 5 votes vote down vote up
/**
 * Stacks the {@code overlay} on top of the current view, together with its {@code glassPane} in
 * the background and makes the {@code glassPane} hide, whenever the overlay is hidden.
 *
 * @param overlay   to be stacked on top of the view
 * @param glassPane to be added in the background of the {@code overlay}
 */
final void addOverlay(Region overlay, GlassPane glassPane) {
  LOGGER.trace("addOverlay");
  overlay.setVisible(false);
  getChildren().addAll(glassPane, overlay);
  // make glass pane hide if overlay is not showing
  overlay.visibleProperty().addListener(observable -> glassPane.setHide(!overlay.isVisible()));
}
 
Example 2
Source File: SelectionStripSkin.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
/**
 * Constructor for all SkinBase instances.
 *
 * @param strip The strip for which this Skin should attach to.
 */
public SelectionStripSkin(SelectionStrip<T> strip) {
  super(strip);

  content = new HBox();
  content.setMinWidth(Region.USE_PREF_SIZE);
  content.setMaxWidth(Double.MAX_VALUE);
  content.setAlignment(Pos.CENTER_LEFT);

  leftBtn = new Region();
  leftBtn.getStyleClass().addAll("scroller", "left");
  leftBtn.setOpacity(0);
  leftBtn.setVisible(false);

  rightBtn = new Region();
  rightBtn.getStyleClass().addAll("scroller", "right");
  rightBtn.setOpacity(0);
  rightBtn.setVisible(false);

  leftFader = new Region();
  leftFader.setMouseTransparent(true);
  leftFader.getStyleClass().addAll("fader", "left");
  leftFader.setOpacity(0);

  rightFader = new Region();
  rightFader.setMouseTransparent(true);
  rightFader.getStyleClass().addAll("fader", "right");
  rightFader.setOpacity(0);

  getChildren().addAll(content, leftFader, rightFader, leftBtn, rightBtn);
  getChildren().forEach(child -> child.setManaged(false));

  Rectangle clip = new Rectangle();
  clip.widthProperty().bind(strip.widthProperty());
  clip.heightProperty().bind(strip.heightProperty());
  getSkinnable().setClip(clip);

  setupListeners();
  setupBindings();
  setupEventHandlers();

  strip.itemsProperty().addListener((Observable it) -> buildContent());
  buildContent();
}
 
Example 3
Source File: HeatControlSkin.java    From Enzo with Apache License 2.0 4 votes vote down vote up
private void initGraphics() {                        
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_HEIGHT * 0.1, 0, 0, 0);
    Color color = gradientLookup.getColorAt(getSkinnable().getValue() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue())); 
    background = new Circle(0.5 * PREFERRED_WIDTH, 0.5 * PREFERRED_HEIGHT, 0.5 * PREFERRED_WIDTH);
    background.setFill(new LinearGradient(0, 0, 0, PREFERRED_HEIGHT,
                                          false, CycleMethod.NO_CYCLE,
                                          new Stop(0, color.deriveColor(0, 1, 0.8, 1)),
                                          new Stop(1, color.deriveColor(0, 1, 0.6, 1))));
    background.setEffect(innerShadow);

    ticksCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ticksCanvas.setMouseTransparent(true);
    ticks = ticksCanvas.getGraphicsContext2D();

    targetIndicator = new Region();
    targetIndicator.getStyleClass().setAll("target-indicator");
    targetIndicatorRotate = new Rotate(180 - getSkinnable().getStartAngle() - getSkinnable().getMinValue() * angleStep);
    targetIndicator.getTransforms().setAll(targetIndicatorRotate);       
    targetExceeded = false;
    targetIndicator.setVisible(getSkinnable().isTargetEnabled());

    valueIndicator = new Region();
    valueIndicator.getStyleClass().setAll("value-indicator");
    valueIndicatorRotate = new Rotate(180 - getSkinnable().getStartAngle());
    valueIndicatorRotate.setAngle(valueIndicatorRotate.getAngle() + (getSkinnable().getValue() - getSkinnable().getOldValue() - getSkinnable().getMinValue()) * angleStep);
    valueIndicator.getTransforms().setAll(valueIndicatorRotate);

    infoText = new Text(getSkinnable().getInfoText().toUpperCase());
    infoText.setTextOrigin(VPos.CENTER);
    infoText.setFont(Fonts.opensansSemiBold(0.06 * PREFERRED_HEIGHT));
    infoText.setMouseTransparent(true);
    infoText.getStyleClass().setAll("info-text");        

    value = new Text(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getValue()));
    value.setMouseTransparent(true);
    value.setTextOrigin(VPos.CENTER);
    value.setFont(Fonts.opensansBold(0.32 * PREFERRED_HEIGHT));
    value.setMouseTransparent(true);
    value.getStyleClass().setAll("value");

    // Add all nodes
    pane = new Pane();
    pane.getChildren().setAll(background,                                  
                              ticksCanvas,
                              valueIndicator,
                              targetIndicator,
                              infoText,
                              value);
    
    getChildren().setAll(pane);
}
 
Example 4
Source File: WorkbenchView.java    From WorkbenchFX with Apache License 2.0 2 votes vote down vote up
/**
 * Makes the {@code overlay} visible.
 *
 * @param overlay to be made visible
 */
final void showOverlay(Region overlay) {
  LOGGER.trace("showOverlay");
  overlay.setVisible(true);
}
 
Example 5
Source File: WorkbenchView.java    From WorkbenchFX with Apache License 2.0 2 votes vote down vote up
/**
 * Makes the {@code overlay} <b>in</b>visible.
 *
 * @param overlay to be made <b>in</b>visible
 */
final void hideOverlay(Region overlay) {
  LOGGER.trace("hideOverlay");
  overlay.setVisible(false);
}