use of eu.ggnet.dwoss.rights.ee.entity.Operator in project dwoss by gg-net.
the class RightsManagmentController method initialize.
/**
* Initializes the controller class.
* <p>
* @param url
* @param rb
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
userlist.setCellFactory(new OperatorListCell.Factory());
ReadOnlyObjectProperty<Operator> opProp = userlist.getSelectionModel().selectedItemProperty();
addRightButton.visibleProperty().bind(deactiveRights.getSelectionModel().selectedIndexProperty().greaterThanOrEqualTo(0).and(opProp.isNotNull()));
removeRightButton.visibleProperty().bind(activeRights.getSelectionModel().selectedIndexProperty().greaterThanOrEqualTo(0).and(opProp.isNotNull()));
addPersonaButton.visibleProperty().bind(deactivePersonas.getSelectionModel().selectedIndexProperty().greaterThanOrEqualTo(0).and(opProp.isNotNull()));
removePersonaButton.visibleProperty().bind(activePersonas.getSelectionModel().selectedIndexProperty().greaterThanOrEqualTo(0).and(opProp.isNotNull()));
userlist.setOnMouseClicked((event) -> {
if (event.getButton().equals(MouseButton.PRIMARY)) {
Operator op = userlist.getSelectionModel().getSelectedItem();
if (event.getClickCount() == 1) {
setSelectedOperator(op);
} else if (op != null) {
openOperatorManagment(op);
}
}
});
activePersonas.setCellFactory(new PersonaListCell.Factory());
activePersonas.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
deactivePersonas.setCellFactory(new PersonaListCell.Factory());
deactivePersonas.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
activeRights.setCellFactory(new RightsListCell.Factory());
activeRights.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
deactiveRights.setCellFactory(new RightsListCell.Factory());
deactiveRights.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
allRights.setCellFactory(new RightsListCell.Factory());
deactivatedRightsList = FXCollections.observableArrayList(AtomicRight.values());
deactivatedPersonasList = FXCollections.observableArrayList();
Bindings.bindBidirectional(deactiveRights.itemsProperty(), new SimpleListProperty<>(deactivatedRightsList));
Bindings.bindBidirectional(deactivePersonas.itemsProperty(), new SimpleListProperty<>(deactivatedPersonasList));
deactiveRights.getItems().addAll();
activePersonas.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent t) {
if (t.getClickCount() > 1) {
if (activePersonas.getSelectionModel().getSelectedItem() != null)
openPersonaManagment(activePersonas.getSelectionModel().getSelectedItem());
return;
}
deactivePersonas.getSelectionModel().clearSelection();
activeRights.getSelectionModel().clearSelection();
deactiveRights.getSelectionModel().clearSelection();
}
});
deactivePersonas.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent t) {
if (t.getClickCount() > 1) {
if (deactivePersonas.getSelectionModel().getSelectedItem() != null)
openPersonaManagment(deactivePersonas.getSelectionModel().getSelectedItem());
return;
}
activePersonas.getSelectionModel().clearSelection();
activeRights.getSelectionModel().clearSelection();
deactiveRights.getSelectionModel().clearSelection();
}
});
activeRights.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent t) {
deactivePersonas.getSelectionModel().clearSelection();
activePersonas.getSelectionModel().clearSelection();
deactiveRights.getSelectionModel().clearSelection();
}
});
deactiveRights.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent t) {
deactivePersonas.getSelectionModel().clearSelection();
activePersonas.getSelectionModel().clearSelection();
activeRights.getSelectionModel().clearSelection();
}
});
refreshAll();
}
use of eu.ggnet.dwoss.rights.ee.entity.Operator in project dwoss by gg-net.
the class RightsManagmentController method handleRemovePersonaButton.
@FXML
private void handleRemovePersonaButton() {
Operator op = userlist.getSelectionModel().getSelectedItem();
List<Persona> selectedItems = new ArrayList<>(activePersonas.getSelectionModel().getSelectedItems());
op.removeAllPersona(selectedItems);
List<Persona> removed = new ArrayList<>(allPersonas);
removed.removeAll(op.getPersonas());
resetDeactivePersonas();
resetDeactiveRights();
resetAllRights();
// setSelectedOperator(op);
Dl.remote().lookup(RightsAgent.class).store(op);
}
use of eu.ggnet.dwoss.rights.ee.entity.Operator in project dwoss by gg-net.
the class RightsManagmentController method handleAddRightButton.
@FXML
private void handleAddRightButton() {
Operator op = userlist.getSelectionModel().getSelectedItem();
List<AtomicRight> selectedItems = new ArrayList<>(deactiveRights.getSelectionModel().getSelectedItems());
System.out.println("SelectedIt: " + selectedItems);
op.addAllRight(selectedItems);
resetDeactiveRights();
resetAllRights();
// setSelectedOperator(op);
Dl.remote().lookup(RightsAgent.class).store(op);
}
use of eu.ggnet.dwoss.rights.ee.entity.Operator in project dwoss by gg-net.
the class OperatorEaoStub method findAll.
@Override
public List<Operator> findAll() {
Operator operator = new Operator("Hans");
operator.add(AtomicRight.CREATE_ANNULATION_INVOICE);
operator.add(AtomicRight.CREATE_COMPLAINT);
return Arrays.asList(operator, new Operator("Peter"));
}
use of eu.ggnet.dwoss.rights.ee.entity.Operator in project dwoss by gg-net.
the class RightsAgentBean method findOperatorByUsername.
/**
* Search a Operator by the Username and fetch it eager.
* <p>
* @param username
* @return
*/
@Override
public Operator findOperatorByUsername(String username) {
Operator singleResult = new OperatorEao(em).findByUsername(username);
singleResult.fetchEager();
return singleResult;
}
Aggregations