org.controlsfx.glyphfont.FontAwesome Java Examples

The following examples show how to use org.controlsfx.glyphfont.FontAwesome. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MissionCheck.java    From logbook-kai with MIT License 6 votes vote down vote up
private void setIcon(TreeItem<String> item, Boolean result) {
    GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");

    StackPane pane = new StackPane();
    pane.setPrefWidth(18);

    if (result != null) {
        if (result) {
            pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.CHECK).color(Color.GREEN));
        } else {
            pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.EXCLAMATION).color(Color.RED));
        }
    } else {
        pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.QUESTION).color(Color.GRAY));
    }
    item.setGraphic(pane);
}
 
Example #2
Source File: QuestProgress.java    From logbook-kai with MIT License 6 votes vote down vote up
private static void setConditionIcon(TreeItem<String> item, Boolean result) {
    GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");

    StackPane pane = new StackPane();
    pane.setPrefWidth(18);

    if (result != null) {
        if (result) {
            pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.CHECK).color(Color.GREEN));
        } else {
            pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.EXCLAMATION).color(Color.RED));
        }
    } else {
        pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.QUESTION).color(Color.GRAY));
    }
    item.setGraphic(pane);
}
 
Example #3
Source File: Archivo.java    From archivo with GNU General Public License v3.0 5 votes vote down vote up
private void loadSymbolFont() {
    URL fontUrl = getClass().getClassLoader().getResource("resources/fontawesome.otf");
    logger.debug("Loading font resource at {}", fontUrl);
    if (fontUrl == null) {
        logger.error("Error loading symbol font");
    } else {
        symbolFont = new FontAwesome(fontUrl.toString());
    }
}
 
Example #4
Source File: ActivityItemCell.java    From PeerWasp with MIT License 5 votes vote down vote up
private Node getIconByType(ActivityType type) {
	Node ico = null;
	switch (type) {
		case INFORMATION:
			ico = fontAwesome.create(FontAwesome.Glyph.INFO_CIRCLE);
			break;
		case WARNING:
			ico = fontAwesome.create(FontAwesome.Glyph.WARNING);
			break;
		default:
			break;
	}
	return ico;
}
 
Example #5
Source File: IconUtils.java    From PeerWasp with MIT License 5 votes vote down vote up
public static void init() {
	InputStream input = FontAwesomeOffline.class.getResourceAsStream(fontLocation);
	if (input != null) {
		font = new FontAwesome(input);
		GlyphFontRegistry.register(font);
		// Note: if we would close the input stream, icons would not be displayed anymore!
	} else {
		logger.warn("Could not initialize font awesome: ''.", fontLocation);
	}
}
 
Example #6
Source File: IconUtils.java    From PeerWasp with MIT License 5 votes vote down vote up
/**
 * Returns an error icon (glyph created using font awesome).
 *
 * @return graphic node
 */
public static Node createErrorIcon() {
	GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");
	Glyph graphic = fontAwesome.create(FontAwesome.Glyph.EXCLAMATION_TRIANGLE);
	graphic.setFontSize(20.0);
	graphic.setColor(Color.RED);
	return graphic;
}
 
Example #7
Source File: MissionCheck.java    From logbook-kai with MIT License 5 votes vote down vote up
private TreeItem<String> buildTree0(Mission mission, List<Ship> fleet) {
    try {
        TreeItem<String> item;
        Optional<MissionCondition> condition = Missions.getMissionCondition(mission.getId());
        if (condition.isPresent()) {
            MissionCondition cond = condition.get();
            cond.test(fleet);
            item = this.buildLeaf(cond);
        } else if (mission.getSampleFleet() != null) {
            item = new TreeItem<>();
            setIcon(item, null);
        } else {
            return null;
        }
        item.setValue(mission.toString());
        if (mission.getSampleFleet() != null) {
            TreeItem<String> sample = new TreeItem<>("サンプル編成");

            GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");

            StackPane pane = new StackPane();
            pane.setPrefWidth(18);
            pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.INFO));
            sample.setGraphic(pane);

            for (Integer type : mission.getSampleFleet()) {
                Optional.ofNullable(StypeCollection.get()
                        .getStypeMap()
                        .get(type))
                        .map(Stype::getName)
                        .ifPresent(name -> sample.getChildren().add(new TreeItem<>(name)));
            }
            item.getChildren().add(sample);
        }
        return item;
    } catch (Exception e) {
        LoggerHolder.get().error("遠征確認画面で例外", e);
    }
    return null;
}
 
Example #8
Source File: QuestProgress.java    From logbook-kai with MIT License 5 votes vote down vote up
private static void setFilterListIcon(TreeItem<String> item) {
    GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");
    StackPane pane = new StackPane();
    pane.setPrefWidth(18);
    pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.ANGLE_RIGHT).color(Color.ROYALBLUE));
    item.setGraphic(pane);
}
 
Example #9
Source File: QuestProgress.java    From logbook-kai with MIT License 5 votes vote down vote up
private static void setFilterIcon(TreeItem<String> item) {
    GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");
    StackPane pane = new StackPane();
    pane.setPrefWidth(18);
    pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.FILTER).color(Color.ROYALBLUE));
    item.setGraphic(pane);
}
 
Example #10
Source File: GlyphFactory.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a glyph for given identifier
 *
 * @param icon one of the font code available in {@link FontAwesome} Glyph enum.
 * @return created glyph
 */
public static synchronized Glyph create(final FontAwesome.Glyph icon) {
    if (GlyphFactory.fontAwesome == null) {
        try (InputStream is = GlyphFactory.class.getResourceAsStream("FONT_AWESOME-webfont")) {
            GlyphFactory.fontAwesome = new FontAwesome(is);
            GlyphFontRegistry.register(GlyphFactory.fontAwesome);
        } catch (final IOException e) {
            e.printStackTrace();
        }
    }
    return GlyphFactory.fontAwesome.create(icon);
}
 
Example #11
Source File: RecordingsExistDialog.java    From archivo with GNU General Public License v3.0 5 votes vote down vote up
private void updateStatusIcon(Recording recording, Label status) {
    switch (recording.getFileExistsAction()) {
        case OK:
            status.setGraphic(mainApp.getGlyph(FontAwesome.Glyph.CHECK));
            break;
        case REPLACE:
            status.setGraphic(mainApp.getGlyph(FontAwesome.Glyph.EXCLAMATION_CIRCLE));
            break;
        case CANCEL:
            status.setGraphic(mainApp.getGlyph(FontAwesome.Glyph.CLOSE));
            break;
    }
}
 
Example #12
Source File: RecordingListController.java    From archivo with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initialize(URL location, ResourceBundle resources) {
    refreshTivoList.setGraphic(mainApp.getGlyph(FontAwesome.Glyph.REFRESH));

    recordingTreeTable.setShowRoot(false);
    recordingTreeTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    recordingTreeTable.setTableMenuButtonVisible(true);
    recordingTreeTable.setPlaceholder(tablePlaceholderMessage);
    recordingTreeTable.setOnSort(event ->
            updateGroupStatus(recordingTreeTable.getRoot(), recordingTreeTable.getRoot().getChildren())
    );
    recordingTreeTable.setOnMouseClicked(this::archiveOnDoubleClick);

    setupColumns();
    setupContextMenu();

    tivoList.setConverter(new Tivo.StringConverter());
    tivoList.setItems(tivos);

    // Disable the TiVo controls when no devices are available
    refreshTivoList.disableProperty().bind(Bindings.or(Bindings.size(tivos).lessThan(1), tivoIsBusy));
    tivoList.disableProperty().bind(Bindings.or(Bindings.size(tivos).lessThan(1), tivoIsBusy));
    storageIndicator.disableProperty().bind(Bindings.or(Bindings.size(tivos).lessThan(1), tivoIsBusy));
    storageLabel.disableProperty().bind(Bindings.or(Bindings.size(tivos).lessThan(1), tivoIsBusy));
    recordingTreeTable.disableProperty().bind(Bindings.or(Bindings.size(tivos).lessThan(1), tivoIsBusy));

    addSelectionChangedListener(recordingSelection::selectionChanged);

    setupStyles();
    setupTransitions();
}
 
Example #13
Source File: NavigationView.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes the TextField and sets the search icon.
 */
private void setupTextField() {
  searchFld = new CustomTextField();
  GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");
  Glyph glyph = fontAwesome.create(FontAwesome.Glyph.SEARCH).color(Color.GRAY);
  glyph.setPadding(new Insets(0, 3, 0, 5));
  searchFld.setLeft(glyph);
}
 
Example #14
Source File: EditDataSet.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
@Override
protected void updateItem(ShiftConstraint shiftConstraint, boolean empty) {
    super.updateItem(shiftConstraint, empty);
    if (shiftConstraint == null || empty) {
        setGraphic(null);
        return;
    }
    Glyph result;
    Tooltip tooltip = new Tooltip();
    switch (shiftConstraint) {
    case SHIFTX:
        result = new Glyph(FONT_AWESOME, FontAwesome.Glyph.ARROWS_H).size(FONT_SIZE_COMBO);
        tooltip.setText("Allow to modify the x value of the points");
        setText("shift x");
        break;
    case SHIFTXY:
        result = new Glyph(FONT_AWESOME, FontAwesome.Glyph.ARROWS).size(FONT_SIZE_COMBO);
        tooltip.setText("Allow to modify the the points freely");
        setText("shift xy");
        break;
    case SHIFTY:
        result = new Glyph(FONT_AWESOME, FontAwesome.Glyph.ARROWS_V).size(FONT_SIZE_COMBO);
        tooltip.setText("Allow to modify the x value of the points");
        setText("shift y");
        break;
    default:
        result = new Glyph(FONT_AWESOME, FontAwesome.Glyph.QUESTION_CIRCLE).size(FONT_SIZE_COMBO);
        setText("-");
    }
    result.setTextFill(Color.DARKBLUE);
    result.setPadding(Insets.EMPTY);
    setGraphic(result);
}
 
Example #15
Source File: RecordingDetailsController.java    From archivo with GNU General Public License v3.0 4 votes vote down vote up
private void setupIcons() {
    archiveButton.setGraphic(mainApp.getGlyph(FontAwesome.Glyph.DOWNLOAD));
    cancelButton.setGraphic(mainApp.getGlyph(FontAwesome.Glyph.CLOSE));
    playButton.setGraphic(mainApp.getGlyph(FontAwesome.Glyph.PLAY));
}
 
Example #16
Source File: RepoManagerView.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private Glyph getGitIcon() {
    return GlyphFontRegistry.font("FontAwesome").create(FontAwesome.Glyph.GIT_SQUARE);
}
 
Example #17
Source File: Screenshot.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
/**
 * @return A node with screenshot buttons which can be inserted into the toolbar
 */
public HBox getScreenshotInteractorBar() {
    final HBox buttonBar = new HBox();
    final Separator separator = new Separator();
    separator.setOrientation(Orientation.VERTICAL);
    SplitMenuButton button = new SplitMenuButton();
    button.setGraphic(new HBox(0.1, new Glyph(FONT_AWESOME, FontAwesome.Glyph.CAMERA).size(FONT_SIZE),
            new Glyph(FONT_AWESOME, FontAwesome.Glyph.CLIPBOARD).size(FONT_SIZE - 8.0)));
    button.setOnAction(evt -> {
        if (toFile) {
            screenshotToFile(true);
        } else {
            screenshotToClipboard();
        }
    });
    MenuItem toClipMenu = new MenuItem("Screenshot to clipboard",
            new Glyph(FONT_AWESOME, FontAwesome.Glyph.CLIPBOARD));
    toClipMenu.setOnAction(evt -> {
        toFile = false;
        button.setGraphic(new HBox(0.1, new Glyph(FONT_AWESOME, FontAwesome.Glyph.CAMERA).size(FONT_SIZE),
                new Glyph(FONT_AWESOME, FontAwesome.Glyph.CLIPBOARD).size(FONT_SIZE - 8.8)));
        button.setTooltip(new Tooltip("Copy screenshot of plot to Clipboard"));
        screenshotToClipboard();
    });
    MenuItem toFileMenu = new MenuItem("Screenshot to file", new Glyph(FONT_AWESOME, FontAwesome.Glyph.FILE));
    toFileMenu.setOnAction(evt -> {
        toFile = true;
        button.setGraphic(new HBox(0.1, new Glyph(FONT_AWESOME, FontAwesome.Glyph.CAMERA).size(FONT_SIZE),
                new Glyph(FONT_AWESOME, FontAwesome.Glyph.FILE).size(FONT_SIZE - 8.0)));
        button.setTooltip(new Tooltip("Save plot as image"));
        screenshotToFile(true);
    });
    MenuItem settingsMenu = new MenuItem("Screenshot settings", new Glyph(FONT_AWESOME, FontAwesome.Glyph.WRENCH));
    settingsMenu.setOnAction(evt -> {
        ScreenshotDialog alert = new ScreenshotDialog();
        alert.showAndWait() //
                .filter(response -> response == ButtonType.OK) //
                .ifPresent(response -> {
                    directory.set(alert.getDirectory());
                    pattern.set(alert.getPattern());
                });
    });
    button.getItems().addAll(toClipMenu, toFileMenu, new SeparatorMenuItem(), settingsMenu);

    buttonBar.getChildren().addAll(separator, button);
    return buttonBar;
}