public boolean validarDatosRegistro( String rfc, String nombre, String domicilio, String telefono, ObservableList<ClienteEntity> dataCliente) { boolean telefonoEsNumerico = InputValidator.textIsNumericOnly(telefono); boolean isRFC = InputValidator.isRFC(rfc); if ((rfc.length() != 0) && (nombre.length() != 0) && (domicilio.length() != 0) && (telefono.length() != 0) && telefonoEsNumerico && isRFC && (telefono.length() == 10)) { final boolean[] isRepetido = {false}; dataCliente.forEach( clienteEntity -> { if (clienteEntity.getIdCliente().equals(rfc)) { isRepetido[0] = true; } }); if (!isRepetido[0]) { return true; } else { getWarningAlert("Cuidado", "Atencion", "El RFC ya existe en la base de datos!"); return false; } } else { getWarningAlert( "Cuidado", "¡Atencion!", "Algunos datos no son correctos\n o están incompletos."); return false; } }
@Override protected void doAdd(int index, Vital element) { element.addListener(this); elementObserver.attachListener(element); vitals.add(index, element); numericList.forEach((fx) -> addNumeric(fx)); }
// Kustutab listist tehtud sündmuse public void kustutaButtonVajutatud() { ObservableList<Kodut66.Input> inputM22ratud, k6ikInputs; k6ikInputs = table.getItems(); inputM22ratud = table.getSelectionModel().getSelectedItems(); inputM22ratud.forEach(k6ikInputs::remove); }
public List<Data> getSurveyData() { List<Data> triggerData = new ArrayList<Data>(); surveys.forEach( trigger -> { triggerData.add(trigger.getData()); }); return triggerData; }
public List<Data> getVariableData() { List<Data> triggerData = new ArrayList<Data>(); variables.forEach( trigger -> { triggerData.add(trigger.getData()); }); // Only add the user-created variables? return triggerData; }
// ******************** Misc ********************************************** private static void calcNoOfNodes(Node node) { if (node instanceof Parent) { if (((Parent) node).getChildrenUnmodifiable().size() != 0) { ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable(); noOfNodes += tempChildren.size(); tempChildren.forEach(n -> calcNoOfNodes(n)); } } }
@Override protected Vital doSet(int index, Vital element) { Vital removed = vitals.set(index, element); removed.removeListener(this); elementObserver.detachListener(removed); elementObserver.attachListener(element); removed.addListener(this); numericList.forEach((fx) -> addNumeric(fx)); return removed; }
public void setFddObjectModel(FddObjectModel fddObjectModel) { logger.entry(); if (fddObjectModel != null) { fddObjectModel .getInteractionClasses() .values() .stream() .forEach( (value) -> { interactions.add(new InteractionState(value)); }); InteractionTableView.setItems(interactions); interactions.forEach( (interaction) -> { interaction .onProperty() .addListener( (observable, oldValue, newValue) -> { if (!newValue) { cb.setSelected(false); } else if (interactions.stream().allMatch(a -> a.isOn())) { cb.setSelected(true); } }); }); InteractionTableColumn.setCellValueFactory(new PropertyValueFactory<>("interactionName")); CheckTableColumn.setCellValueFactory( new Callback< TableColumn.CellDataFeatures<InteractionState, Boolean>, ObservableValue<Boolean>>() { @Override public ObservableValue<Boolean> call( TableColumn.CellDataFeatures<InteractionState, Boolean> param) { return param.getValue().onProperty(); } }); CheckTableColumn.setCellFactory(CheckBoxTableCell.forTableColumn(CheckTableColumn)); cb.setUserData(CheckTableColumn); cb.setOnAction( (ActionEvent event) -> { CheckBox cb1 = (CheckBox) event.getSource(); TableColumn tc = (TableColumn) cb1.getUserData(); InteractionTableView.getItems() .stream() .forEach( (item) -> { item.setOn(cb1.isSelected()); }); }); CheckTableColumn.setGraphic(cb); } logger.exit(); }
@Override public void acaoExcluir(int botao) { itens = tabelaLista.getSelectionModel().getSelectedItems(); if (Validar.exclusao(itens, cenaController.getBotaoExcluir())) { itens.forEach( (Despesa d) -> { d.excluir(); new Conta().alterarSaldo(Operacao.INCREMENTAR, d.getIdConta(), d.getValor()); }); Janela.showTooltip(Status.SUCESSO, idioma.getMensagem("operacao_sucesso"), Duracao.CURTA); acaoFiltrar(true); } }
private void deleteSelectedEntrys() { ObservableList<PolizistDaten> Nutzerauswahl = Tabelle.getSelectionModel().getSelectedItems(); if (Nutzerauswahl.isEmpty()) { IM.setErrorText("Es muss mindestens ein Eintrag ausgewählt sein"); return; } Nutzerauswahl.forEach( PolizistDaten -> { try { DH.getAnfrageObjekt() .executeUpdate( "DELETE FROM POLIZIST WHERE PersonenID = " + PolizistDaten.getPersonenID()); } catch (SQLException e) { IM.setErrorText("Löschen fehlgeschlagen", e); } }); refreshPolizistAnsicht(); }
public VitalModelImpl(DeviceListModel deviceListModel, ObservableList<NumericFx> numericList) { this.deviceListModel = deviceListModel; this.numericList = numericList; numericList.addListener( new OnListChange<>((fx) -> addNumeric(fx), null, (fx) -> removeNumeric(fx))); numericList.forEach((fx) -> addNumeric(fx)); this.elementObserver = new ElementObserver<Vital>( extractor, new Callback<Vital, InvalidationListener>() { @Override public InvalidationListener call(final Vital e) { return new InvalidationListener() { @Override public void invalidated(Observable observable) { beginChange(); int i = 0; final int size = size(); for (; i < size; ++i) { if (get(i) == e) { nextUpdate(i); } } endChange(); } }; } }, this); addListener( new ListChangeListener<Vital>() { @Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends Vital> c) { updateState(); } }); }
// Сохранение в базу данных public static void setList(ObservableList<ContructorViewer> list) { if (list.size() == contructorsDB.size()) { for (int i = 0; i < list.size(); i++) { contructorsDB.get(i).setName(list.get(i).getName()); } contructorsDB.forEach(contructor -> contrImpl.update(contructor)); } else { List<Contructor> contructorsDBNEW = new ArrayList<Contructor>(); list.forEach( new Consumer<ContructorViewer>() { @Override public void accept(ContructorViewer contr) { // TODO Auto-generated method stub contructorsDBNEW.add(new Contructor(contr.getName())); } }); contructorsDB.forEach(contructor -> contrImpl.delete(contructor)); contructorsDBNEW.forEach(contructor -> contrImpl.create(contructor)); } }
public void onInvertContextMenu() { ObservableList<FileItem> selected = tableView.getSelectionModel().getSelectedItems(); selected.forEach(fileItem -> fileItem.setSelected(!fileItem.isSelected())); }
public void onDeselectContextMenu() { ObservableList<FileItem> selected = tableView.getSelectionModel().getSelectedItems(); selected.forEach(fileItem -> fileItem.setSelected(false)); }
public List<Data> getUIElementData() { List<Data> uiData = new ArrayList<Data>(); uielements.forEach(element -> uiData.add(element.getData())); return uiData; }
public MyTab createTab() { MyTab tab = new MyTab() { @Override public ButtonType close() { if (Objects.nonNull(this.getPath())) closedPaths.add(Optional.ofNullable(current.currentTab().getPath())); ButtonType closeType = super.close(); Platform.runLater( () -> { ObservableList<Tab> tabs = controller.getTabPane().getTabs(); if (tabs.isEmpty()) { controller.newDoc(null); } }); return closeType; } }; tab.setOnCloseRequest( event -> { event.consume(); tab.close(); }); MenuItem menuItem0 = new MenuItem("Close"); menuItem0.setOnAction( actionEvent -> { tab.close(); }); MenuItem menuItem1 = new MenuItem("Close All"); menuItem1.setOnAction( actionEvent -> { ObservableList<Tab> tabs = controller.getTabPane().getTabs(); ObservableList<Tab> clonedTabs = FXCollections.observableArrayList(tabs); if (clonedTabs.size() > 0) { clonedTabs.forEach( (closedTab) -> { MyTab myTab = (MyTab) closedTab; myTab.close(); }); } }); MenuItem menuItem2 = new MenuItem("Close Others"); menuItem2.setOnAction( actionEvent -> { ObservableList<Tab> blackList = FXCollections.observableArrayList(); blackList.addAll(controller.getTabPane().getTabs()); blackList.remove(tab); blackList.forEach( t -> { MyTab closeTab = (MyTab) t; closeTab.close(); }); }); // // MenuItem menuItem3 = new MenuItem("Close Unmodified"); // menuItem3.setOnAction(actionEvent -> { // // ObservableList<Tab> clonedTabs = FXCollections.observableArrayList(); // clonedTabs.addAll(controller.getTabPane().getTabs()); // // // for (Tab clonedTab : clonedTabs) { // MyTab myTab = (MyTab) clonedTab; // if (!myTab.getTabText().contains(" *")) // threadService.runActionLater(()->{ // myTab.close(); // }); // } // }); MenuItem menuItem4 = new MenuItem("Select Next Tab"); menuItem4.setOnAction( actionEvent -> { TabPane tabPane = controller.getTabPane(); if (tabPane.getSelectionModel().isSelected(tabPane.getTabs().size() - 1)) tabPane.getSelectionModel().selectFirst(); else tabPane.getSelectionModel().selectNext(); }); MenuItem menuItem5 = new MenuItem("Select Previous Tab"); menuItem5.setOnAction( actionEvent -> { SingleSelectionModel<Tab> selectionModel = controller.getTabPane().getSelectionModel(); if (selectionModel.isSelected(0)) selectionModel.selectLast(); else selectionModel.selectPrevious(); }); MenuItem menuItem6 = new MenuItem("Reopen Closed Tab"); menuItem6.setOnAction( actionEvent -> { if (closedPaths.size() > 0) { int index = closedPaths.size() - 1; closedPaths.get(index).filter(pathResolver::isAsciidoc).ifPresent(this::addTab); closedPaths.get(index).filter(pathResolver::isMarkdown).ifPresent(this::addTab); closedPaths.get(index).filter(pathResolver::isImage).ifPresent(this::addImageTab); closedPaths.remove(index); } }); MenuItem menuItem7 = new MenuItem("Open File Location"); menuItem7.setOnAction( event -> { current .currentPath() .ifPresent( path -> { controller .getHostServices() .showDocument(path.getParent().toUri().toASCIIString()); }); }); MenuItem menuItem8 = new MenuItem("New File"); menuItem8.setOnAction(controller::newDoc); MenuItem gotoWorkdir = new MenuItem("Go to Workdir"); gotoWorkdir.setOnAction( event -> { current.currentPath().map(Path::getParent).ifPresent(directoryService::changeWorkigDir); }); ContextMenu contextMenu = new ContextMenu(); contextMenu .getItems() .addAll( menuItem0, menuItem1, menuItem2, new SeparatorMenuItem(), menuItem4, menuItem5, menuItem6, new SeparatorMenuItem(), gotoWorkdir, new SeparatorMenuItem(), menuItem7, menuItem8); tab.contextMenuProperty().setValue(contextMenu); Label label = tab.getLabel(); label.setOnMouseClicked( mouseEvent -> { if (mouseEvent.getButton().equals(MouseButton.SECONDARY)) { tab.select(); } else if (mouseEvent.getClickCount() > 1) { controller.adjustSplitPane(); } }); return tab; }