private void loadSubControllers() throws IOException {
    for (final String key : this.optionsViews.keySet()) {
      final ContentController controller = loadSubController(this.optionsViews.get(key));
      if (controller != null) {

        this.controllers.add(controller);

        this.component.getChildren().add(controller.getRootNode());
        controller.getRootNode().setVisible(false);

        controller.setName(key);

        ////
        final Button buttonNav = new Button(key);
        buttonNav.getStyleClass().add("nav-button");
        buttonNav.getStyleClass().add("xine-button");
        buttonNav.setPrefHeight(49);
        buttonNav.setOnAction(
            e -> {
              activeController(controller);
            });

        ////

        controller.setNavigationButton(buttonNav);
        this.navItems.getChildren().add(controller.getNavigationButton());

        // this.component.getChildren().add(controller.getRootNode());
      }
    }
  }
Ejemplo n.º 2
0
 private Button createButton(String styleClass, Runnable action) {
   Button button = new Button();
   button.getStyleClass().add(styleClass);
   button.setOnAction(
       (evt) -> {
         action.run();
         area.requestFocus();
       });
   button.setPrefWidth(20);
   button.setPrefHeight(20);
   return button;
 }
Ejemplo n.º 3
0
  public static void setJar(final Tile node) {
    node.data.put("type", "Jar");
    List<Node> toRemove = new ArrayList<>();
    for (Node n : node.node.getChildren()) {
      if (!n.getId().equals("delete")) {
        if (n.getId().equals("typeLabel")) {
          Label l = (Label) n;
          l.setText("jar");
          l.setTranslateY(l.getTranslateY() - 1);
        } else {
          toRemove.add(n);
        }
      }
    }

    VBox leftPadding = new VBox();
    leftPadding.setPrefWidth(14);
    VBox buttons = new VBox();
    VBox textBoxes = new VBox();
    VBox extra = new VBox();

    buttons.setSpacing(5);
    textBoxes.setSpacing(5);
    extra.setSpacing(5);

    buttons.setPadding(new Insets(7, 0, 0, 0));
    textBoxes.setPadding(new Insets(7, 0, 0, 0));
    extra.setPadding(new Insets(7, 0, 0, 0));

    textBoxes.setTranslateX(17);
    extra.setTranslateX(32);

    node.node.getChildren().removeAll(toRemove);

    final String name = "Package Name";
    final String name2 = "Jar Name";

    Button findPkg = new Button();
    final TextField pkgText = new TextField();
    final TextField jarName = new TextField();

    findPkg.getStyleClass().add("defaultButton");
    findPkg.setText("Find Package Name");
    findPkg.setPrefHeight(25);
    findPkg.setTranslateX(12);

    findPkg.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            String mainClassName = Util.packageNameFromTile();
            if (mainClassName != null) {
              pkgText.setText(mainClassName);
            }
          }
        });

    pkgText.setText(name);
    pkgText.setPrefSize(150, 27);
    pkgText.setFont(Font.font("Segoe UI"));
    pkgText.setId("textBox");
    pkgText
        .textProperty()
        .addListener(
            new ChangeListener<String>() {
              @Override
              public void changed(
                  ObservableValue<? extends String> observable, String oldValue, String newValue) {
                node.data.put("package", pkgText.getText().trim());
              }
            });
    pkgText
        .focusedProperty()
        .addListener(
            new ChangeListener<Boolean>() {
              @Override
              public void changed(
                  ObservableValue<? extends Boolean> observable,
                  Boolean oldValue,
                  Boolean newValue) {
                if (newValue == true && pkgText.getText().equals(name)) {
                  pkgText.setText("");
                } else if (newValue == false && pkgText.getText().trim().equals("")) {
                  pkgText.setText(name);
                }
              }
            });

    jarName.setText(name2);
    jarName.setPrefSize(150, 27);
    jarName.setFont(Font.font("Segoe UI"));
    jarName.setId("textBox");
    jarName
        .textProperty()
        .addListener(
            new ChangeListener<String>() {
              @Override
              public void changed(
                  ObservableValue<? extends String> observable, String oldValue, String newValue) {
                node.data.put("jarname", jarName.getText().trim());
              }
            });
    jarName
        .focusedProperty()
        .addListener(
            new ChangeListener<Boolean>() {
              @Override
              public void changed(
                  ObservableValue<? extends Boolean> observable,
                  Boolean oldValue,
                  Boolean newValue) {
                if (newValue == true && jarName.getText().equals(name2)) {
                  jarName.setText("");
                } else if (newValue == false && jarName.getText().trim().equals("")) {
                  jarName.setText(name2);
                }
              }
            });

    final String defTxt = "Additional Flags";
    final TextField flags = new TextField();
    flags.setText(defTxt);
    flags.setPrefSize(150, 27);
    flags.setFont(Font.font("Segoe UI"));
    flags.setId("textBox");

    flags
        .focusedProperty()
        .addListener(
            new ChangeListener<Boolean>() {
              @Override
              public void changed(
                  ObservableValue<? extends Boolean> observable,
                  Boolean oldValue,
                  Boolean newValue) {
                if (newValue == true && flags.getText().equals(defTxt)) {
                  flags.setText("");
                } else if (newValue == false && flags.getText().trim().equals("")) {
                  flags.setText(defTxt);
                }
              }
            });
    flags
        .textProperty()
        .addListener(
            new ChangeListener<String>() {
              @Override
              public void changed(
                  ObservableValue<? extends String> observable, String oldValue, String newValue) {
                node.data.put("flags", flags.getText().trim());
              }
            });

    final String defTxt2 = "Output Directory";
    final TextField outputDir = new TextField();
    outputDir.setText(defTxt2);
    outputDir.setPrefSize(150, 27);
    outputDir.setFont(Font.font("Segoe UI"));
    outputDir.setId("textBox");

    outputDir
        .focusedProperty()
        .addListener(
            new ChangeListener<Boolean>() {
              @Override
              public void changed(
                  ObservableValue<? extends Boolean> observable,
                  Boolean oldValue,
                  Boolean newValue) {
                if (newValue == true && outputDir.getText().equals(defTxt2)) {
                  outputDir.setText("");
                } else if (newValue == false && outputDir.getText().trim().equals("")) {
                  outputDir.setText(defTxt2);
                }
              }
            });
    outputDir
        .textProperty()
        .addListener(
            new ChangeListener<String>() {
              @Override
              public void changed(
                  ObservableValue<? extends String> observable, String oldValue, String newValue) {
                node.data.put("output", outputDir.getText().trim());
              }
            });

    buttons.getChildren().addAll(findPkg);
    textBoxes.getChildren().addAll(pkgText, jarName);
    extra.getChildren().addAll(flags, outputDir);
    node.node.getChildren().addAll(leftPadding, buttons, textBoxes, extra);
  }
Ejemplo n.º 4
0
  private Button createCommandLinksButton(ButtonType buttonType) {
    // look up the CommandLinkButtonType for the given ButtonType
    CommandLinksButtonType commandLink =
        typeMap.getOrDefault(buttonType, new CommandLinksButtonType(buttonType));

    // put the content inside a button
    final Button button = new Button();
    button.getStyleClass().addAll("command-link-button"); // $NON-NLS-1$
    button.setMaxHeight(Double.MAX_VALUE);
    button.setMaxWidth(Double.MAX_VALUE);
    button.setAlignment(Pos.CENTER_LEFT);

    final ButtonData buttonData = buttonType.getButtonData();
    button.setDefaultButton(buttonData != null && buttonData.isDefaultButton());
    button.setOnAction(ae -> setResult(buttonType));

    final Label titleLabel = new Label(commandLink.getButtonType().getText());
    titleLabel
        .minWidthProperty()
        .bind(
            new DoubleBinding() {
              {
                bind(titleLabel.prefWidthProperty());
              }

              @Override
              protected double computeValue() {
                return titleLabel.getPrefWidth() + 400;
              }
            });
    titleLabel.getStyleClass().addAll("line-1"); // $NON-NLS-1$
    titleLabel.setWrapText(true);
    titleLabel.setAlignment(Pos.TOP_LEFT);
    GridPane.setVgrow(titleLabel, Priority.NEVER);

    Label messageLabel = new Label(commandLink.getLongText());
    messageLabel.getStyleClass().addAll("line-2"); // $NON-NLS-1$
    messageLabel.setWrapText(true);
    messageLabel.setAlignment(Pos.TOP_LEFT);
    messageLabel.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(messageLabel, Priority.SOMETIMES);

    Node commandLinkImage = commandLink.getGraphic();
    Node view =
        commandLinkImage == null
            ? new ImageView(
                CommandLinksDialog.class.getResource("arrow-green-right.png").toExternalForm())
            : //$NON-NLS-1$
            commandLinkImage;
    Pane graphicContainer = new Pane(view);
    graphicContainer.getStyleClass().add("graphic-container"); // $NON-NLS-1$
    GridPane.setValignment(graphicContainer, VPos.TOP);
    GridPane.setMargin(graphicContainer, new Insets(0, 10, 0, 0));

    GridPane grid = new GridPane();
    grid.minWidthProperty().bind(titleLabel.prefWidthProperty());
    grid.setMaxHeight(Double.MAX_VALUE);
    grid.setMaxWidth(Double.MAX_VALUE);
    grid.getStyleClass().add("container"); // $NON-NLS-1$
    grid.add(graphicContainer, 0, 0, 1, 2);
    grid.add(titleLabel, 1, 0);
    grid.add(messageLabel, 1, 1);

    button.setGraphic(grid);
    button.minWidthProperty().bind(titleLabel.prefWidthProperty());

    if (commandLink.isHidden) {
      button.setVisible(false);
      button.setPrefHeight(1);
    }
    return button;
  }
Ejemplo n.º 5
0
  public static void launchForm() {
    loginForm.setTitle("Welcome to GEEK - Log in or Register");
    loginForm.setResizable(false);
    loginForm
        .getIcons()
        .add(new Image(LoginForm.class.getResource("../style_elements/logo.png").toExternalForm()));

    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);

    ImageView logo =
        new ImageView((LoginForm.class.getResource("../style_elements/logo.png").toExternalForm()));
    logo.setFitHeight(100);
    logo.setFitWidth(100);
    grid.setMargin(logo, new Insets(0, 0, 0, 72));
    grid.add(logo, 1, 1);

    username.setId("input_field");
    username.setPromptText("Username");
    username.setMinWidth(250);
    username.setFocusTraversable(false);
    grid.add(username, 1, 2);

    password.setId("input_field");
    password.setPromptText("Password");
    password.setMinWidth(250);
    password.setFocusTraversable(false);
    grid.add(password, 1, 3);

    sign_in_button.setId("sign_in_button");
    sign_in_button.setPrefHeight(35);
    sign_in_button.setCursor(Cursor.HAND);

    register_button.setId("register_button");
    register_button.setPrefHeight(35);
    register_button.setCursor(Cursor.HAND);

    HBox buttons = new HBox(10);
    buttons.setAlignment(Pos.CENTER);
    buttons.getChildren().addAll(sign_in_button, register_button);
    grid.add(buttons, 1, 4);

    HBox text = new HBox(3);
    text.setAlignment(Pos.CENTER);
    error_message_field.setFill(Color.WHITE);
    error_message_field.setId("error");
    text.getChildren().add(error_message_field);
    grid.add(text, 1, 6);

    setButtonsActions();

    Scene scene = new Scene(grid, 500, 500);
    scene
        .getStylesheets()
        .add(LoginForm.class.getResource("../style_elements/login_form.css").toExternalForm());
    loginForm.setScene(scene);
    loginForm.show();
    isOpen = true;
  }
Ejemplo n.º 6
0
  public void initComponents(final Stage parentStage) throws MalformedURLException {

    this.root = new StackPane();
    this.root.autosize();

    this.scene = new Scene(root, aboutWindowsWidth, aboutWindowsHeight, Color.web("#FFFFFF"));
    this.scene.getStylesheets().add(FileUtil.getStyleAsUrl("style"));
    this.scene.setFill(Color.TRANSPARENT);

    this.stage = new Stage();
    this.stage.setScene(scene);
    this.stage.initOwner(parentStage);
    this.stage.initModality(Modality.NONE);
    this.stage.initStyle(StageStyle.UNDECORATED);

    Group mainRoot = new Group();
    StackPane rootStack =
        new StackPane() {

          @Override
          protected void layoutChildren() {

            super.layoutChildren();
            stage.setWidth(scene.getWidth());
            stage.setHeight(scene.getHeight());
            stage.setX(parentStage.getX());
            stage.setY(parentStage.getY() + aboutWindowsPos);
          }
        };

    mainRoot.getChildren().add(rootStack);
    this.root.getChildren().add(mainRoot);

    HBox vb = new HBox();
    addDragListeners(vb);

    VBox leftContent = new VBox();
    leftContent.getStyleClass().add("about-content");

    Text aboutTitle = new Text("Our Address");
    Text company = new Text("MAP Consultancy Services");
    Text address1 = new Text("A/201, Yugandhar Sudama, Manpada Road,");
    Text address2 = new Text("Dombivli (E), Thane, Maharashtra");
    Text telephone = new Text("+91 9324788024 / +91 7738610004");
    Text email = new Text("*****@*****.**");
    Text website = new Text("website : http://www.mapconsultancyservices.com/");

    Button submitBtn = new Button("Submit");
    submitBtn.getStyleClass().add("map-submit-button");
    submitBtn.setMinWidth(79);
    submitBtn.setPrefHeight(29);
    leftContent
        .getChildren()
        .addAll(aboutTitle, company, address1, address2, telephone, email, website, submitBtn);

    VBox rightContent = new VBox();
    rightContent.setPrefSize(515, 410);
    rightContent.getStyleClass().add("map-content");

    File aboutUsFile = new File("resources/aboutus/aboutus.html");
    final URL urlGoogleMaps = aboutUsFile.toURI().toURL();
    WebView webView = new WebView();
    WebEngine webEngine = webView.getEngine();
    webEngine.load(urlGoogleMaps.toExternalForm());
    rightContent.getChildren().addAll(webView);

    vb.getChildren().addAll(leftContent, rightContent);
    rootStack.getChildren().add(vb);
  }