Пример #1
0
 public AbstractTab(String name, String id, Stage stage, D dto) {
   tab = new Tab(name);
   tab.setId(id);
   this.name = name;
   this.stage = stage;
   setDTO(dto);
   tab.setContent(addTabContent(stage));
 }
Пример #2
0
 @Override
 public void changed(
     ObservableValue<? extends TreeItem<Box>> observableValue,
     TreeItem<Box> boxTreeItem,
     TreeItem<Box> boxTreeItem2) {
   if (boxTreeItem2 == null) {
     return;
   }
   String id = Path.createPath(boxTreeItem2.getValue());
   Tab t = null;
   for (Tab tab : tabPane.getTabs()) {
     if (tab.getId().equals(id)) {
       tabPane.getSelectionModel().select(tab);
       t = tab;
     }
   }
   if (t == null) {
     t = new Tab(id);
     t.setId(id);
     tabPane.getTabs().addAll(t);
     t.setContent(new BoxPane(boxTreeItem2.getValue()));
     tabPane.getSelectionModel().select(t);
   }
 }
  private void createViewTab(final HeatChartMaster heatChart) {

    for (Tab selTab : pane.getTabs()) {
      if (selTab.getId() != null && selTab.getId().equalsIgnoreCase(heatChart.getChartNumber())) {
        pane.getSelectionModel().select(selTab);
        return;
      }
    }

    Tab tab = new Tab("View Heat Chart : " + heatChart.getChartNumber());
    tab.setId(heatChart.getChartNumber());

    VBox main = ViewLayout.getMainVBox("Heat Chart", "Details");

    GridPane form = new GridPane();
    form.setHgap(ViewLayout.H_SPACE);
    form.setVgap(ViewLayout.V_SPACE);

    Label equipmentLabel = new Label("Equipment");
    equipmentLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final ViewBox equipmentTextField = new ViewBox("Equipment", heatChart.equipmentProperty());

    Label customerLabel = new Label("Customer");
    customerLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final ViewBox customerTextField = new ViewBox("Customer", heatChart.customerProperty());

    Label poDetailsLabel = new Label("PO Details");
    poDetailsLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final ViewBox poDetailsTextField = new ViewBox("PO Details", heatChart.poDetailsProperty());

    Label drawingLabel = new Label("Drawing No.");
    drawingLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final ViewBox drawingTextField = new ViewBox("Drawing No.", heatChart.drawingNumberProperty());

    Label suryeyorLabel = new Label("Surveyor");
    suryeyorLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final ViewBox suryeyorTextField = new ViewBox("Suryeyor", heatChart.surveyorProperty());

    Label tagNumberLabel = new Label("Tag Number");
    suryeyorLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final ViewBox tagNumberTextField = new ViewBox("Tag Number", heatChart.tagNumberProperty());

    form.add(equipmentLabel, 0, 0);
    form.add(equipmentTextField, 1, 0);
    form.add(customerLabel, 2, 0);
    form.add(customerTextField, 3, 0);
    form.add(poDetailsLabel, 4, 0);
    form.add(poDetailsTextField, 5, 0);
    form.add(drawingLabel, 0, 1);
    form.add(drawingTextField, 1, 1);
    form.add(suryeyorLabel, 2, 1);
    form.add(suryeyorTextField, 3, 1);
    form.add(tagNumberLabel, 4, 1);
    form.add(tagNumberTextField, 5, 1);

    main.getChildren().addAll(form);

    final ObservableList<HeatChartSheets> data = FXCollections.observableArrayList();

    TableView<HeatChartSheets> table = TableUtil.createViewHeatChartSheetTable();

    data.setAll(heatChart.getHeatChartSheets());
    table.setItems(data);

    main.getChildren().addAll(ControlsUtil.makeScrollable(table));

    final HBox buttons = new HBox(ViewLayout.H_SPACE);
    buttons.setTranslateY(32);
    final Button printButton = new Button("Print");
    printButton.getStyleClass().add("submit-button");
    buttons.getChildren().addAll(printButton);

    main.getChildren().addAll(buttons);

    printButton.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent e) {

            printHeatChart.setHeatChart(heatChart);
            printHeatChart.restart();
          }
        });

    Context.getWindowBottomText()
        .textProperty()
        .bind(Bindings.format("%s", printHeatChart.stateProperty()));

    printHeatChart
        .stateProperty()
        .addListener(
            new ChangeListener<Worker.State>() {

              @Override
              public void changed(
                  ObservableValue<? extends Worker.State> observable,
                  Worker.State oldValue,
                  Worker.State newState) {

                if (newState == Worker.State.SUCCEEDED) {
                  Alert.showAlert(
                      Context.getWindowStage(),
                      "Alert",
                      "Alert",
                      "The report has been saved as " + printHeatChart.getValue());
                  Context.getHostServices().showDocument(printHeatChart.getValue());
                } else if (newState == Worker.State.FAILED) {
                  Alert.showAlert(
                      Context.getWindowStage(),
                      "Error",
                      "Error",
                      "Some error cooured. Details : " + printHeatChart.getException().getCause());
                }
              }
            });

    tab.setContent(ControlsUtil.makeScrollable(main));
    pane.getTabs().add(tab);
  }
Пример #4
0
  private void createEditTab(final UserMaster user) {

    for (Tab selTab : getTabs()) {
      if (selTab.getId() != null && selTab.getId().equalsIgnoreCase(user.getUserName())) {
        getSelectionModel().select(selTab);
        return;
      }
    }

    Tab tab = new Tab("Edit User : "******"User", "Details");

    GridPane form = new GridPane();
    form.setHgap(ViewLayout.H_SPACE);
    form.setVgap(ViewLayout.V_SPACE);

    Label userNameLabel = new Label("User Name");
    userNameLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    ViewBox userNameTextBox = new ViewBox(user.userNameProperty());

    Label passwordLabel = new Label("Password");
    passwordLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final PasswordBox passwordBox = new PasswordBox("Password", user.passwordProperty());

    Label confirmPasswordLabel = new Label("Confirm Password");
    confirmPasswordLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final PasswordBox confirmPasswordBox =
        new PasswordBox("Confirm Password", user.confirmPasswordProperty());

    Label roleLabel = new Label("Role");
    roleLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final RoleEditableComboBox roleChoiceBox =
        new RoleEditableComboBox("Role", user.roleProperty());

    form.add(userNameLabel, 0, 0);
    form.add(userNameTextBox, 1, 0);
    form.add(passwordLabel, 0, 1);
    form.add(passwordBox, 1, 1);
    form.add(confirmPasswordLabel, 0, 2);
    form.add(confirmPasswordBox, 1, 2);
    form.add(roleLabel, 0, 3);
    form.add(roleChoiceBox, 1, 3);

    main.getChildren().addAll(form);

    final HBox buttons = new HBox(ViewLayout.H_SPACE);
    buttons.setTranslateY(32);
    final Button updateButton = new Button("Update");
    updateButton.getStyleClass().add("submit-button");
    main.getChildren().addAll(buttons);

    updateButton.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent e) {

            if (Validator.validateUserData(user)) {

              ServiceManager.getUserDetailsService(user, PersistType.UPDATE).restart();
            }
          }
        });
    buttons.getChildren().addAll(updateButton);

    tab.setContent(ControlsUtil.makeScrollable(main));
    getTabs().add(tab);
  }