List of usage examples for javafx.scene.control Skin Skin
Skin
From source file:com.panemu.tiwulfx.form.BaseControl.java
private PopupControl getPopup() { if (popup == null) { errorLabel = new Label(); errorLabel.textProperty().bind(getErrorMessage()); popup = new PopupControl(); final HBox pnl = new HBox(); pnl.getChildren().add(errorLabel); pnl.getStyleClass().add("error-popup"); popup.setSkin(new Skin() { @Override//www.j a v a 2 s . com public Skinnable getSkinnable() { return BaseControl.this.getInputComponent(); } @Override public Node getNode() { return pnl; } @Override public void dispose() { } }); popup.setHideOnEscape(true); } return popup; }
From source file:com.panemu.tiwulfx.form.BaseListControl.java
private PopupControl getPopup() { if (popup == null) { errorLabel = new Label(); errorLabel.textProperty().bind(getErrorMessage()); popup = new PopupControl(); final HBox pnl = new HBox(); pnl.getChildren().add(errorLabel); pnl.getStyleClass().add("error-popup"); popup.setSkin(new Skin() { @Override//ww w . ja v a 2 s. c o m public Skinnable getSkinnable() { return null;//BaseTableFormControl.this.getInputComponent(); } @Override public Node getNode() { return pnl; } @Override public void dispose() { } }); popup.setHideOnEscape(true); } return popup; }
From source file:com.panemu.tiwulfx.control.skin.LookupFieldSkin.java
private void createPopup() { popup = new PopupControl() { {/*w w w.ja va 2 s. c om*/ setSkin(new Skin() { @Override public Skinnable getSkinnable() { return LookupFieldSkin.this.lookupField; } @Override public Node getNode() { return listView; } @Override public void dispose() { } }); } }; popup.setAutoHide(true); popup.setAutoFix(true); popup.setHideOnEscape(true); popup.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent t) { popup.hide(); } }); listView.setCellFactory(new Callback() { @Override public Object call(Object p) { return new PropertyListCell(lookupField.getPropertyName()); } }); /** * Taken from * {@link com.sun.javafx.scene.control.skin.ComboBoxListViewSkin} */ listView.addEventFilter(MouseEvent.MOUSE_RELEASED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent t) { // RT-18672: Without checking if the user is clicking in the // scrollbar area of the ListView, the comboBox will hide. Therefore, // we add the check below to prevent this from happening. EventTarget target = t.getTarget(); if (target instanceof Parent) { List<String> s = ((Parent) target).getStyleClass(); if (s.contains("thumb") || s.contains("track") || s.contains("decrement-arrow") || s.contains("increment-arrow")) { return; } } needValidation = false; lookupField.setValue(listView.getSelectionModel().getSelectedItem()); popup.hide(); } }); listView.setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent t) { if (t.getCode() == KeyCode.ENTER) { needValidation = false; lookupField.setValue(listView.getSelectionModel().getSelectedItem()); popup.hide(); } else if (t.getCode() == KeyCode.ESCAPE) { popup.hide(); } } }); }
From source file:com.panemu.tiwulfx.table.BaseColumn.java
PopupControl getPopup(R record) { String msg = mapInvalid.get(record); if (popup == null) { popup = new PopupControl(); final HBox pnl = new HBox(); pnl.getChildren().add(errorLabel); pnl.getStyleClass().add("error-popup"); popup.setSkin(new Skin() { @Override//from w w w .j a v a 2 s . c o m public Skinnable getSkinnable() { return null; } @Override public Node getNode() { return pnl; } @Override public void dispose() { } }); popup.setHideOnEscape(true); } errorLabel.setText(msg); return popup; }