コード例 #1
0
  public EditValidation() {

    try {
      createAgencyTab();

      createCustomerTab();

      createItemTab();

      createLaboratoryTab();

      createResultTab();

      createSpecificationTab();

      createTestTab();
    } catch (Exception e) {
      LoggerUtil.getLogger().debug(e);
      Alert.showAlert(
          Context.getWindowStage(),
          "Error",
          "Error",
          "Some error occured. Details...\n" + e.getMessage());
    }
  }
コード例 #2
0
  @Override
  public Node showView() {

    Tab tab = new Tab("View Heat CHart : Search");

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

      final ObservableList<HeatChartMaster> mailboxData = FXCollections.observableArrayList();
      main.getChildren()
          .addAll(SearchBoxUtil.getHeatChartSearchBox("Heat Chart Number", mailboxData));

      final TableView<HeatChartMaster> tableMailbox = TableUtil.createSearchHeatChartTable();

      main.getChildren().add(ControlsUtil.makeScrollable(tableMailbox));

      tableMailbox.setItems(mailboxData);

      tableMailbox.setOnMouseClicked(
          new EventHandler<MouseEvent>() {

            @Override
            public void handle(MouseEvent mouseEvent) {

              if (mouseEvent.getClickCount() == 2) {

                HeatChartMaster selHeatChart = tableMailbox.getSelectionModel().getSelectedItem();
                if (selHeatChart != null) {

                  createViewTab(selHeatChart);
                }
              }
            }
          });

      EventHandler<ActionEvent> viewHeatChartEventHandler =
          new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent e) {

              HeatChartMaster heatChart = tableMailbox.getSelectionModel().getSelectedItem();
              if (heatChart != null) {

                createViewTab(heatChart);
              }
            }
          };

      tableMailbox.setContextMenu(
          TableContextMenu.getViewHeatChartContextMenu(viewHeatChartEventHandler));

      tab.setContent(ControlsUtil.makeScrollable(main));
      tab.setClosable(false);
      pane.getTabs().add(tab);
      pane.setSide(Side.TOP);

      return pane;
    } catch (HibernateException e) {
      LoggerUtil.getLogger().debug(e);
      Alert.showAlert(
          Context.getWindowStage(),
          "Error",
          "Error",
          "Some error occured. Details...\n" + e.getMessage());

      return new ErrorView().showView();
    } catch (MalformedURLException ex) {
      LoggerUtil.getLogger().debug(ex);
      Alert.showAlert(
          Context.getWindowStage(),
          "Error",
          "Error",
          "Some error occured. Details...\n" + ex.getMessage());

      return new ErrorView().showView();
    }
  }
コード例 #3
0
  public EditUser() {

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

    try {
      VBox main = ViewLayout.getMainVBox("Edit User", "Details");

      final TableView<UserMaster> table = TableUtil.createEditUserTable();

      main.getChildren().add(table);

      final ObservableList<UserMaster> mailboxData =
          FXCollections.observableArrayList(UserData.getUserList());

      table.setItems(mailboxData);

      EventHandler<ActionEvent> editUserEventHandler =
          new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent actionEvent) {

              UserMaster user = table.getSelectionModel().getSelectedItem();
              if (user != null) {

                createEditTab(user);
              }
            }
          };

      EventHandler<ActionEvent> deleteUserEventHandler =
          new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent actionEvent) {

              final UserMaster user = table.getSelectionModel().getSelectedItem();

              EventHandler<ActionEvent> delUserEvent =
                  new EventHandler<ActionEvent>() {

                    @Override
                    public void handle(ActionEvent arg0) {

                      PersistUserDetails pud =
                          ServiceManager.getUserDetailsService(user, PersistType.DELETE);

                      pud.restart();

                      pud.setOnSucceeded(
                          new EventHandler<WorkerStateEvent>() {

                            @Override
                            public void handle(WorkerStateEvent e) {

                              mailboxData.remove(user);
                            }
                          });
                    }
                  };

              Confirm.showConfirm(
                  Context.getWindowStage(),
                  "Confirm",
                  "Confirm",
                  "Delete User : "******". Are you sure?",
                  delUserEvent);
            }
          };

      table.setContextMenu(
          TableContextMenu.getEditUserContextMenu(editUserEventHandler, deleteUserEventHandler));

      table.setOnMouseClicked(
          new EventHandler<MouseEvent>() {

            @Override
            public void handle(MouseEvent mouseEvent) {

              if (mouseEvent.getClickCount() == 2) {

                UserMaster user = table.getSelectionModel().getSelectedItem();

                if (user != null) {
                  createEditTab(user);
                }
              }
            }
          });

      tab.setContent(ControlsUtil.makeScrollable(main));
      tab.setClosable(false);
      getTabs().add(tab);
      setSide(Side.TOP);
    } catch (Exception e) {
      LoggerUtil.getLogger().debug(e);
      Alert.showAlert(
          Context.getWindowStage(),
          "Error",
          "Error",
          "Some error occured. Details...\n" + e.getMessage());
    }
  }