public DrawerLayout() {
    AnchorPane.setTopAnchor(toggleLayer, 0d);
    AnchorPane.setRightAnchor(toggleLayer, 0d);
    AnchorPane.setBottomAnchor(toggleLayer, 0d);
    AnchorPane.setLeftAnchor(toggleLayer, 0d);
    toggleLayer.setBackground(
        new Background(new BackgroundFill(Color.BLACK, new CornerRadii(0d), new Insets(0))));
    toggleLayer.setOpacity(0);
    toggleLayer.setVisible(false);

    toggleLayer.setOnMouseClicked(
        evt -> {
          if (evt.getButton().equals(MouseButton.PRIMARY)) {
            if (drawerOpened) {
              closeDrawer();
            }
          }
        });

    tableScreen.bind(widthProperty().lessThan(responsiveWidth).or(responsiveWidth.isEqualTo(0)));
    tableScreen.addListener(
        (observable, oldValue, newValue) -> {
          responsiveBehavior(newValue);
        });
  }
Esempio n. 2
0
  public ToggleSwitch(boolean state) {
    Button switchBtn = new Button();
    switchBtn.setPrefWidth(40);
    switchBtn.setMaxWidth(40);
    switchedOn.set(!state);
    switchBtn.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent t) {
            switchedOn.set(!switchedOn.get());
          }
        });
    //        switchedOn.set(state);
    setGraphic(switchBtn);

    switchedOn.addListener(
        new ChangeListener<Boolean>() {
          @Override
          public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
            if (t1) {
              setText(" ON  ");
              setStyle("-fx-background-color: green;-fx-text-fill:white;");
              setContentDisplay(ContentDisplay.RIGHT);
            } else {
              setText(" OFF ");
              setStyle("-fx-background-color: grey;-fx-text-fill:white;");
              setContentDisplay(ContentDisplay.LEFT);
            }
          }
        });

    switchedOn.set(state);
  }
Esempio n. 3
0
  private static SimpleBooleanProperty createBooleanProperty(
      final String name, final boolean defaultValue) {
    final SimpleBooleanProperty property =
        new SimpleBooleanProperty(null, name, p.getBoolean(name, defaultValue));
    property.addListener(booleanChangeListener);

    return property;
  }
Esempio n. 4
0
 static {
   isProxyingEnabled.addListener(
       (observable, oldValue, newValue) -> {
         if (newValue) {
           System.setProperty("http.proxySet", "true");
           System.setProperty("http.proxyHost", "127.0.0.1");
           System.setProperty("http.proxyPort", "8080");
           System.setProperty("https.proxySet", "true");
           System.setProperty("https.proxyHost", "127.0.0.1");
           System.setProperty("https.proxyPort", "8080");
         } else {
           System.clearProperty("http.proxySet");
           System.clearProperty("http.proxyHost");
           System.clearProperty("http.proxyPort");
           System.clearProperty("https.proxySet");
           System.clearProperty("https.proxyHost");
           System.clearProperty("https.proxyPort");
         }
       });
 }