/** Initializes the controller class. */
 @Override
 public void initialize(URL url, ResourceBundle rb) {
   logger.entry();
   OkButton.disableProperty()
       .bind(
           Bindings.isEmpty(FederationExecutionName.textProperty())
               .or(Bindings.isEmpty(FederateType.textProperty())));
   logger.exit();
 }
コード例 #2
0
  private Bindings getBindings(Execution execution, JCRSessionWrapper session)
      throws RepositoryException {
    EnvironmentImpl environment = EnvironmentImpl.getCurrent();
    final Map<String, Object> vars = ((ExecutionImpl) execution).getVariables();
    Locale locale = (Locale) vars.get("locale");
    final Bindings bindings = new MyBindings(environment);
    ResourceBundle resourceBundle =
        JahiaResourceBundle.lookupBundle(
            "org.jahia.services.workflow."
                + ((ExecutionImpl) execution).getProcessDefinition().getKey(),
            locale);
    bindings.put("bundle", resourceBundle);
    JahiaUser jahiaUser =
        ServicesRegistry.getInstance()
            .getJahiaUserManagerService()
            .lookupUserByKey((String) vars.get("user"));
    bindings.put("user", jahiaUser);
    bindings.put("date", new DateTool());
    bindings.put("submissionDate", Calendar.getInstance());
    bindings.put("locale", locale);
    bindings.put("workspace", vars.get("workspace"));

    List<JCRNodeWrapper> nodes = new LinkedList<JCRNodeWrapper>();
    @SuppressWarnings("unchecked")
    List<String> stringList = (List<String>) vars.get("nodeIds");
    for (String s : stringList) {
      JCRNodeWrapper nodeByUUID = session.getNodeByUUID(s);
      if (!nodeByUUID.isNodeType("jnt:translation")) {
        nodes.add(nodeByUUID);
      }
    }
    bindings.put("nodes", nodes);
    return bindings;
  }
コード例 #3
0
  private void initializeFilteredPersonnelTableView() {
    personnelNameColumn.setCellValueFactory(new PropertyValueFactory<Official, String>("name"));
    personnelRankColumn.setCellValueFactory(
        new Callback<TableColumn.CellDataFeatures<Official, String>, ObservableValue<String>>() {
          @Override
          public ObservableValue<String> call(CellDataFeatures<Official, String> arg0) {
            final Official official = arg0.getValue();
            final StringExpression concat =
                Bindings.selectString(official.rankProperty(), "designation");
            return concat;
          }
        });
    Bindings.bindContent(officialsFilteredTableView.getItems(), officialFilteredList);
    gameData
        .getOfficials()
        .addListener(
            new ListChangeListener<Official>() {
              @Override
              public void onChanged(Change<? extends Official> arg0) {
                updateOfficialFiltersResult();
              }
            });

    // TODO initialize assignOfficialMenuItem to be sure that it's not
    // enable if not correct values are selected
  }
コード例 #4
0
  private void initializeSkillFilterTab() {
    skillFilterComboBox.getItems().addAll(skills);
    PropertyListCellFactory<Skill> propertyListCellFactory =
        new PropertyListCellFactory<>("name", null);
    skillFilterComboBox.setButtonCell(
        new ListCell<Skill>() {
          @Override
          protected void updateItem(Skill arg0, boolean arg1) {
            super.updateItem(arg0, arg1);
            if (arg1 || arg0 == null) {
              this.setText(null);
            } else {
              this.setText(arg0.getName());
            }
          }
        });
    skillFilterComboBox.setCellFactory(propertyListCellFactory);
    skillFiltersNameColumn.setCellValueFactory(
        new Callback<CellDataFeatures<SkillFilter, String>, ObservableValue<String>>() {
          @Override
          public ObservableValue<String> call(CellDataFeatures<SkillFilter, String> arg0) {
            return Bindings.selectString(arg0.getValue().skillProperty(), "name");
          }
        });

    skillFilterMinValueColumn.setCellValueFactory(
        new PropertyValueFactory<SkillFilter, Integer>("minValue"));
    skillFilterMaxValueColumn.setCellValueFactory(
        new PropertyValueFactory<SkillFilter, Integer>("maxValue"));
    skillFiltersTableView
        .getItems()
        .addListener(
            new ListChangeListener<SkillFilter>() {
              @Override
              public void onChanged(Change<? extends SkillFilter> arg0) {
                while (arg0.next()) {
                  for (SkillFilter skillFilter : arg0.getAddedSubList()) {
                    final Skill skill = skillFilter.getSkill();
                    TableColumn<Official, Number> skillColumn = new TableColumn<>(skill.getName());
                    skillColumn.setCellValueFactory(
                        new Callback<
                            CellDataFeatures<Official, Number>, ObservableValue<Number>>() {
                          @Override
                          public ObservableValue<Number> call(
                              CellDataFeatures<Official, Number> arg0) {
                            Official official = arg0.getValue();
                            IntegerBinding selectInteger =
                                Bindings.selectInteger(
                                    official.skillLevelsProperty().valueAt(skill), "level");
                            selectInteger.addListener(
                                new ChangeListener<Number>() {
                                  @Override
                                  public void changed(
                                      ObservableValue<? extends Number> arg0,
                                      Number arg1,
                                      Number arg2) {
                                    updateOfficialFiltersResult();
                                  }
                                });
                            return selectInteger;
                          }
                        });
                    officialsFilteredTableView.getColumns().add(skillColumn);
                    skillFiltersColumn.put(skill, skillColumn);
                  }

                  for (SkillFilter skillFilter : arg0.getRemoved()) {
                    final Skill skill = skillFilter.getSkill();
                    TableColumn<Official, Number> column = skillFiltersColumn.remove(skill);

                    if (column != null) {
                      officialsFilteredTableView.getColumns().remove(column);
                    }
                  }
                }
              }
            });
    Bindings.bindContent(skillFiltersMatcher.getMatchers(), skillFiltersTableView.getItems());
  }
コード例 #5
0
  @Override
  // This method is called by the FXMLLoader when initialization is complete
  public void initialize(URL fxmlFileLocation, ResourceBundle resources) {
    assert civilianAdministratorCheckBox != null
        : "fx:id=\"civilianAdministratorCheckBox\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    assert officialsFilteredTableView != null
        : "fx:id=\"filteredPersonnelTableView\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    assert groundOfficerFilterCheckBox != null
        : "fx:id=\"groundOfficerFilterCheckBox\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    assert navalOfficerFilterCheckBox != null
        : "fx:id=\"navalOfficerFilterCheckBox\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    assert personnelNameColumn != null
        : "fx:id=\"personnelNameColumn\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    assert personnelRankColumn != null
        : "fx:id=\"personnelRankColumn\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";

    assert scientistFilterCheckBox != null
        : "fx:id=\"scientistFilterCheckBox\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    assert skillFilterComboBox != null
        : "fx:id=\"skillFilterComboBox\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    assert skillFilterMaxValueColumn != null
        : "fx:id=\"skillFilterMaxValueColumn\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    assert skillFilterMaxValueComponent != null
        : "fx:id=\"skillFilterMaxValueComponent\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    assert skillFilterMinValueColumn != null
        : "fx:id=\"skillFilterMinValueColumn\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    assert skillFilterMinValueComponent != null
        : "fx:id=\"skillFilterMinValueComponent\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    assert skillFiltersNameColumn != null
        : "fx:id=\"skillFiltersNameColumn\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    assert skillFiltersTableView != null
        : "fx:id=\"skillFiltersTableView\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    assert assignmentsFilterComboBox != null;
    assert assigmentsListView != null;
    assert createTeamMenuItem != null
        : "fx:id=\"createTeamMenuItem\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    assert assignOfficialMenuItem != null;
    assert skillsTableView != null
        : "fx:id=\"skillsTableView\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    assert skillColumn != null
        : "fx:id=\"skillColumn\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    assert levelColumn != null
        : "fx:id=\"levelColumn\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'.";
    // initialize your logic here: all @FXML variables will have been
    // injected
    initializeCompositeMatcher();

    initializeFilteredPersonnelTableView();

    initializeSkillFilterTab();

    initializeAssignmentListViewAndFilters();

    createTeamMenuItem
        .disableProperty()
        .bind(
            Bindings.select(officialsFilteredTableView.selectionModelProperty(), "selectedItem")
                .isNull());

    final ObjectBinding<Official> selectedPersonnel =
        Bindings.select(officialsFilteredTableView.selectionModelProperty(), "selectedItem");

    detailsPaneController
        .officialProperty()
        .bind(officialsFilteredTableView.getSelectionModel().selectedItemProperty());
    skillColumn.setCellValueFactory(
        new Callback<CellDataFeatures<SkillLevel, String>, ObservableValue<String>>() {
          public ObservableValue<String> call(CellDataFeatures<SkillLevel, String> p) {
            SkillLevel value = p.getValue();
            return Bindings.selectString(value, "skill", "name");
          }
        });
    levelColumn.setCellValueFactory(new PropertyValueFactory<SkillLevel, Integer>("level"));

    selectedPersonnel.addListener(
        new ChangeListener<Official>() {
          @Override
          public void changed(
              ObservableValue<? extends Official> arg0, Official arg1, Official arg2) {
            updateSkills();
          }
        });

    updateOfficialFiltersResult();
  }