Search in sources :

Example 51 with ImageView

use of javafx.scene.image.ImageView in project trex-stateless-gui by cisco-system-traffic-generator.

the class CustomTreeItem method buildItem.

/**
     * build custom tree item
     *
     * @param title
     * @param owner
     * @param assignedText
     * @param addIcon
     */
private void buildItem(String title, String owner, String addIcon) {
    GridPane itemContainer = new GridPane();
    // additioanl icon
    if (addIcon != null) {
        Image icon = new Image("/icons/" + addIcon);
        ImageView iconContainer = new ImageView(icon);
        itemContainer.add(iconContainer, 0, 0);
    }
    itemTitle.setText(title);
    itemTitle.getStyleClass().add("treeItemTitle");
    itemContainer.add(itemTitle, 1, 0);
    if (owner != null && !"".equals(owner)) {
        this.owner = new Label("(" + owner + ")");
        this.owner.getStyleClass().add("treeItemChildText");
        itemContainer.add(this.owner, 2, 0);
    }
    Image itemIcon = new Image("/icons/" + treeItemType.getIcon());
    ImageView itemIconContainer = new ImageView(itemIcon);
    setValue(itemContainer);
    setGraphic(itemIconContainer);
}
Also used : GridPane(javafx.scene.layout.GridPane) Label(javafx.scene.control.Label) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image)

Example 52 with ImageView

use of javafx.scene.image.ImageView in project trex-stateless-gui by cisco-system-traffic-generator.

the class CustomTreeItem method buildDefaultItem.

/**
     * build default tree item
     *
     * @param title
     */
private void buildDefaultItem(String title) {
    Image itemIcon = new Image("/icons/" + treeItemType.getIcon());
    ImageView itemIconContainer = new ImageView(itemIcon);
    setValue(title);
    setGraphic(itemIconContainer);
}
Also used : ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image)

Example 53 with ImageView

use of javafx.scene.image.ImageView in project Gargoyle by callakrsos.

the class ScmTreeMaker method getFolderImage.

/**
	 * 파일로부터 이미지를 그리기 위한 뷰를 반환한다.
	 *
	 * @Date 2015. 10. 14.
	 * @param file
	 * @return
	 * @User KYJ
	 */
private static ImageView getFolderImage() {
    ImageView iv = new ImageView();
    try {
        Image fxImage = new Image(ClassLoader.getSystemClassLoader().getResource("META-INF/images/nodeicons/foler.png").openStream(), 15d, 15d, false, false);
        iv.setImage(fxImage);
    } catch (IOException e) {
        e.printStackTrace();
    }
    return iv;
}
Also used : ImageView(javafx.scene.image.ImageView) IOException(java.io.IOException) Image(javafx.scene.image.Image)

Example 54 with ImageView

use of javafx.scene.image.ImageView in project Gargoyle by callakrsos.

the class AbstractTableColumnInformationController method initialize.

@FXML
public void initialize() {
    colNumber.setCellValueFactory(new NumberingCellValueFactory<TableColumnMetaVO>(tbColumns));
    colKeyType.setCellFactory(param -> new TableCell<TableColumnMetaVO, KEY_TYPE>() {

        @Override
        protected void updateItem(KEY_TYPE item, boolean empty) {
            super.updateItem(item, empty);
            if (empty) {
                setGraphic(null);
            } else {
                ImageView image = null;
                switch(item) {
                    case PRI:
                        image = getImage(PRIMAKRY_KEY_IMAGE_NAME);
                        image.setFitWidth(getPrefWidth());
                        setGraphic(image);
                        break;
                    case MULTI:
                        image = getImage(MULTI_KEY_IMAGE_NAME);
                        image.setFitWidth(getPrefWidth());
                        setGraphic(image);
                        break;
                    case FOREIGN:
                        image = getImage(FOREIGN_KEY_IMAGE_NAME);
                        image.setFitWidth(getPrefWidth());
                        setGraphic(image);
                        break;
                    default:
                        image = new ImageView();
                }
                setGraphic(image);
            }
        }
    });
    colReference.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<TableColumnMetaVO, String>, ObservableValue<String>>() {

        @Override
        public ObservableValue<String> call(CellDataFeatures<TableColumnMetaVO, String> param) {
            TableColumnMetaVO value = param.getValue();
            SimpleStringProperty stringProperty = new SimpleStringProperty();
            if (value != null && value.getRefs() != null) {
                Optional<String> reduce = value.getRefs().stream().map(v -> v.getPkColumnName() + " ->  [ " + v.getFkTableName() + "-" + v.getFkColumnName() + " ]").reduce((str1, str2) -> str1.concat("\n").concat(str2));
                reduce.ifPresent(stringProperty::setValue);
            }
            return stringProperty;
        }
    });
    colKeyType.setCellValueFactory(new PropertyValueFactory<>("keyType"));
    colKeyType.setStyle("-fx-alignment:center");
    this.tbColumns.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    FxUtil.installClipboardKeyEvent(this.tbColumns);
}
Also used : KEY_TYPE(com.kyj.fx.voeditor.visual.component.sql.table.IKeyType.KEY_TYPE) NumberingCellValueFactory(com.kyj.fx.voeditor.visual.component.NumberingCellValueFactory) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) LoggerFactory(org.slf4j.LoggerFactory) DatabaseMetaData(java.sql.DatabaseMetaData) Function(java.util.function.Function) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) TableColumn(javafx.scene.control.TableColumn) SQLException(java.sql.SQLException) TableCell(javafx.scene.control.TableCell) ResultSet(java.sql.ResultSet) Map(java.util.Map) TableView(javafx.scene.control.TableView) Callback(javafx.util.Callback) Logger(org.slf4j.Logger) PropertyValueFactory(javafx.scene.control.cell.PropertyValueFactory) Set(java.util.Set) ValueUtil(com.kyj.fx.voeditor.visual.util.ValueUtil) Collectors(java.util.stream.Collectors) CellDataFeatures(javafx.scene.control.TableColumn.CellDataFeatures) FXML(javafx.fxml.FXML) FxUtil(com.kyj.fx.voeditor.visual.util.FxUtil) List(java.util.List) SelectionMode(javafx.scene.control.SelectionMode) TreeMap(java.util.TreeMap) ImageView(javafx.scene.image.ImageView) RowMapper(org.springframework.jdbc.core.RowMapper) Optional(java.util.Optional) ObservableValue(javafx.beans.value.ObservableValue) Collections(java.util.Collections) Image(javafx.scene.image.Image) InputStream(java.io.InputStream) CellDataFeatures(javafx.scene.control.TableColumn.CellDataFeatures) Optional(java.util.Optional) ObservableValue(javafx.beans.value.ObservableValue) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) ImageView(javafx.scene.image.ImageView) KEY_TYPE(com.kyj.fx.voeditor.visual.component.sql.table.IKeyType.KEY_TYPE) FXML(javafx.fxml.FXML)

Example 55 with ImageView

use of javafx.scene.image.ImageView in project Gargoyle by callakrsos.

the class AbstractTableColumnInformationController method getImage.

/**
	 * resources패키지로부터 image를 가져오는 처리
	 *
	 * @param name
	 * @return
	 */
static ImageView getImage(String name) {
    try {
        String name2 = "META-INF/images/keyImages/" + name + ".png";
        InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream(name2);
        return new ImageView(new Image(is));
    } catch (Exception e) {
    // not important...
    }
    return new ImageView();
}
Also used : InputStream(java.io.InputStream) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image) SQLException(java.sql.SQLException)

Aggregations

ImageView (javafx.scene.image.ImageView)73 Image (javafx.scene.image.Image)33 Popup (io.bitsquare.gui.main.overlays.popups.Popup)13 Label (javafx.scene.control.Label)13 Insets (javafx.geometry.Insets)12 Callback (javafx.util.Callback)11 ChangeListener (javafx.beans.value.ChangeListener)10 File (java.io.File)9 IOException (java.io.IOException)9 Button (javafx.scene.control.Button)9 AnchorPane (javafx.scene.layout.AnchorPane)9 FxmlView (io.bitsquare.gui.common.view.FxmlView)8 FXML (javafx.fxml.FXML)8 Inject (javax.inject.Inject)8 ActivatableViewAndModel (io.bitsquare.gui.common.view.ActivatableViewAndModel)7 ObservableValue (javafx.beans.value.ObservableValue)7 javafx.scene.control (javafx.scene.control)7 GridPane (javafx.scene.layout.GridPane)7 VBox (javafx.scene.layout.VBox)7 UserThread (io.bitsquare.common.UserThread)6