List of usage examples for javafx.scene.control CheckBox setId
public final void setId(String value)
From source file:dpfmanager.shell.interfaces.gui.fragment.wizard.Wizard1Fragment.java
private void addCheckBox(String id, String name, String path, boolean selected, boolean delete) { HBox hbox = new HBox(); hbox.setAlignment(Pos.CENTER_LEFT);/*from w w w. jav a 2 s .c o m*/ CheckBox chk = new CheckBox(name); chk.setId(id); chk.getStyleClass().add("checkreport"); chk.setSelected(selected); chk.setEllipsisString(" ... "); chk.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS); chk.setTooltip(new Tooltip(path)); hbox.getChildren().add(chk); // EDIT Button edit = new Button(); edit.getStyleClass().addAll("edit-img", "action-img-16"); edit.setCursor(Cursor.HAND); edit.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { String iso = chk.getId(); String path = null; if (iso.startsWith("external")) { iso = chk.getText(); path = iso; } else if (chk.getId().startsWith("config")) { iso = chk.getId().replace("config", ""); path = DPFManagerProperties.getIsosDir() + "/" + iso; } controller.editIso(iso, path); } }); hbox.getChildren().add(edit); HBox.setMargin(edit, new Insets(0, 0, 0, 10)); // DELETE if (delete) { Button icon = new Button(); icon.getStyleClass().addAll("delete-img", "action-img-16"); icon.setCursor(Cursor.HAND); icon.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (chk.getId().startsWith("external")) { // Only from gui vboxRadios.getChildren().remove(hbox); } else if (chk.getId().startsWith("config")) { // From system String name = chk.getId().replace("config", ""); File file = new File(DPFManagerProperties.getIsosDir() + "/" + name); if (file.exists() && file.isFile() && acceptDelete(file)) { file.delete(); vboxRadios.getChildren().remove(hbox); } } } }); hbox.getChildren().add(icon); HBox.setMargin(icon, new Insets(0, 0, 0, 10)); } vboxRadios.getChildren().add(hbox); }
From source file:condorclient.CreateJobDialogController.java
public void configAvailMachinesPane() { URL collector_url = null;/*from w w w .j av a2 s . c om*/ XMLHandler handler = new XMLHandler(); String collectorStr = handler.getURL("collector"); try { collector_url = new URL(collectorStr); } catch (MalformedURLException e3) { // TODO Auto-generated catch block e3.printStackTrace(); } ClassAd ad = null;//birdbath.ClassAd; ClassAdStructAttr[][] startdAdsArray = null; Collector c = null; try { c = new Collector(collector_url); } catch (ServiceException ex) { Logger.getLogger(CondorClient.class.getName()).log(Level.SEVERE, null, ex); } try { startdAdsArray = c.queryStartdAds("");//owner==\"lianxiang\" } catch (RemoteException ex) { Logger.getLogger(CondorClient.class.getName()).log(Level.SEVERE, null, ex); } String ip = null; String slotName = null; resourcesClassAds.clear(); map.clear(); for (ClassAdStructAttr[] x : startdAdsArray) { ad = new ClassAd(x); ip = ad.get("MyAddress"); String ipStr = ip.substring(ip.indexOf("<") + 1, ip.indexOf(":")); // System.out.println(ad.toString()); ObservableList<String> slotlist; slotlist = FXCollections.<String>observableArrayList(); slotName = ad.get("Name");// if (!map.containsKey(ipStr)) { map.put(ipStr, slotlist); } map.get(ipStr).add(slotName); //PublicClaimId } showBoxNum = map.size(); nodeNum = showBoxNum; selectedMachine = new int[nodeNum]; // vb=new VBox(); // machineBox.setSpacing(3); int i = 0; for (String s : map.keySet()) { CheckBox n = new CheckBox(); String boxId = "box" + i; n.setId(boxId); n.setText(s); slotNum = slotNum + map.get(s).size(); n.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { String s = event.getTarget().toString(); // System.out.println(s); String id = s.substring(s.indexOf("=box") + 4, s.indexOf(",")); System.out.println("boxid" + id); //String ip = s.substring(s.indexOf("]'") + 2, s.indexOf("'")); int intid = Integer.parseInt(id);//Integer.getInteger(id); // System.out.println(intid + "id" + id); // CheckBox sbox = (CheckBox) availMachines.getChildren().get(intid); CheckBox sbox = (CheckBox) machineBox.getChildren().get(intid); if (sbox.isSelected()) { selectedMachine[intid] = 1; // System.out.println(selectedMachine[intid]); apponitmap.putIfAbsent(sbox.getText().trim(), map.get(sbox.getText().trim()));//?ipslots appointslotNum = appointslotNum + map.get(sbox.getText().trim()).size();// System.out.println("machine id " + sbox.getText().trim() + "machine size" + map.get(sbox.getText().trim()).size()); } else { selectedMachine[intid] = 0; System.out.println("weixuanzhoong:" + selectedMachine[intid]); if (apponitmap.containsKey(sbox.getText())) { apponitmap.remove(sbox.getText()); } appointslotNum = appointslotNum - map.get(sbox.getText().trim()).size();// } otherError.setText(""); availCpuNumText.setText(""); availCpuNumText.setText("" + appointslotNum); availCpuNumText.setDisable(true); availNodeNumText.setText(""); availNodeNumText.setText("" + apponitmap.size()); availNodeNumText.setDisable(true); // System.out.println("apponitmap.size():" + apponitmap.size() + "apponitmap.values().size():" + apponitmap.values().size()); } }); //availMachines.getChildren().add(n); machineBox.getChildren().add(n); // boxContainer.getChildren().get(showBoxNum - 1).setVisible(true); i++; } // availMachines.getChildren().add(vb); }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @param lstPano//from w w w .j ava 2 s. c o m * @param numPano * @return */ public Pane affichageHS(String lstPano, int numPano) { Pane panneauHotSpots = new Pane(); panneauHotSpots.setTranslateY(10); panneauHotSpots.setTranslateX(30); VBox vb1 = new VBox(5); panneauHotSpots.getChildren().add(vb1); Label lblPoint; Label sep = new Label(" "); Label sep1 = new Label(" "); int o; for (o = 0; o < panoramiquesProjet[numPano].getNombreHotspots(); o++) { VBox vbPanneauHS = new VBox(); double deplacement = 20; vbPanneauHS.setLayoutX(deplacement); Pane pannneauHS = new Pane(vbPanneauHS); pannneauHS.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3;"); panneauHotSpots.setId("HS" + o); lblPoint = new Label("Point n" + (o + 1)); lblPoint.setPadding(new Insets(5, 10, 5, 5)); lblPoint.setTranslateX(-deplacement); lblPoint.setStyle("-fx-background-color : #333;"); lblPoint.setTextFill(Color.WHITE); Separator sp = new Separator(Orientation.HORIZONTAL); sp.setTranslateX(-deplacement); sp.setPrefWidth(300); pannneauHS.setPrefWidth(300); pannneauHS.setTranslateX(5); vbPanneauHS.getChildren().addAll(lblPoint, sp); if (lstPano != null) { Label lblLien = new Label("Panoramique de destination"); ComboBox cbDestPano = new ComboBox(); String[] liste = lstPano.split(";"); cbDestPano.getItems().addAll(Arrays.asList(liste)); cbDestPano.valueProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue ov, String t, String t1) { valideHS(); } }); cbDestPano.setTranslateX(60); cbDestPano.setId("cbpano" + o); String f1XML = panoramiquesProjet[numPano].getHotspot(o).getFichierXML(); if (f1XML != null) { cbDestPano.setValue(f1XML.split("\\.")[0]); } int num = cbDestPano.getSelectionModel().getSelectedIndex(); vbPanneauHS.getChildren().addAll(lblLien, cbDestPano, sep); } Label lblTexteHS = new Label("Texte du Hotspot"); TextArea txtTexteHS = new TextArea(); if (panoramiquesProjet[numPano].getHotspot(o).getInfo() != null) { txtTexteHS.setText(panoramiquesProjet[numPano].getHotspot(o).getInfo()); } txtTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable, final String oldValue, final String newValue) -> { valideHS(); }); txtTexteHS.setId("txtHS" + o); txtTexteHS.setPrefSize(200, 25); txtTexteHS.setMaxSize(200, 20); txtTexteHS.setTranslateX(60); CheckBox cbAnime = new CheckBox("HostSpot Anim"); cbAnime.setId("anime" + o); cbAnime.selectedProperty().addListener((final ObservableValue<? extends Boolean> observable, final Boolean oldValue, final Boolean newValue) -> { valideHS(); }); if (panoramiquesProjet[numPano].getHotspot(o).isAnime()) { cbAnime.setSelected(true); } cbAnime.setPadding(new Insets(5)); cbAnime.setTranslateX(60); vbPanneauHS.getChildren().addAll(lblTexteHS, txtTexteHS, cbAnime, sep1); vb1.getChildren().addAll(pannneauHS, sep); } int nbHS = o; for (o = 0; o < panoramiquesProjet[numPano].getNombreHotspotImage(); o++) { VBox vbPanneauHS = new VBox(); Pane pannneauHS = new Pane(vbPanneauHS); pannneauHS.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3;"); panneauHotSpots.setId("HSImg" + o); lblPoint = new Label("Image n" + (o + 1)); lblPoint.setPadding(new Insets(5, 10, 5, 5)); lblPoint.setStyle("-fx-background-color : #666;"); lblPoint.setTextFill(Color.WHITE); Separator sp = new Separator(Orientation.HORIZONTAL); sp.setPrefWidth(300); pannneauHS.setPrefWidth(300); pannneauHS.setTranslateX(5); vbPanneauHS.getChildren().addAll(lblPoint, sp); Label lblLien = new Label("Image choisie :"); String f1XML = panoramiquesProjet[numPano].getHotspotImage(o).getLienImg(); ImageView IMChoisie = new ImageView( new Image("file:" + repertTemp + File.separator + "images" + File.separator + f1XML, 100, -1, true, true)); IMChoisie.setTranslateX(100); vbPanneauHS.getChildren().addAll(lblLien, IMChoisie, sep); Label lblTexteHS = new Label("Texte du Hotspot"); TextArea txtTexteHS = new TextArea(); if (panoramiquesProjet[numPano].getHotspotImage(o).getInfo() != null) { txtTexteHS.setText(panoramiquesProjet[numPano].getHotspotImage(o).getInfo()); } txtTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable, final String oldValue, final String newValue) -> { valideHS(); }); txtTexteHS.setId("txtHSImage" + o); txtTexteHS.setPrefSize(200, 25); txtTexteHS.setMaxSize(200, 20); txtTexteHS.setTranslateX(60); CheckBox cbAnime = new CheckBox("HostSpot Anim"); cbAnime.setId("animeImage" + o); cbAnime.selectedProperty().addListener((final ObservableValue<? extends Boolean> observable, final Boolean oldValue, final Boolean newValue) -> { valideHS(); }); if (panoramiquesProjet[numPano].getHotspotImage(o).isAnime()) { cbAnime.setSelected(true); } cbAnime.setPadding(new Insets(5)); cbAnime.setTranslateX(60); vbPanneauHS.getChildren().addAll(lblTexteHS, txtTexteHS, cbAnime, sep1); vb1.getChildren().addAll(pannneauHS, sep); } valideHS(); nbHS += o; // if (nbHS == 0) { // } else { // btnValider.setVisible(true); // } return panneauHotSpots; }