use of javafx.scene.layout.GridPane in project org.csstudio.display.builder by kasemir.
the class ImageConfigDialog method createContent.
private Node createContent() {
final GridPane layout = new GridPane();
layout.setHgap(5);
layout.setVgap(5);
// Debug layout
// layout.setGridLinesVisible(true);
// Row to use for the next elements
int row = 0;
Label label = new Label("Value Range");
final Font font = label.getFont();
final Font section_font = Font.font(font.getFamily(), FontWeight.BOLD, font.getSize());
label.setFont(section_font);
layout.add(label, 0, ++row);
// Only show the color mapping selector when it's currently a named mapping.
// Suppress when widget has a custom color map.
final ColorMappingFunction selected_mapping = plot.internalGetImagePlot().getColorMapping();
if (selected_mapping instanceof NamedColorMapping) {
label = new Label("Mapping");
layout.add(label, 1, row);
final ComboBox<String> mappings = new ComboBox<>();
mappings.setEditable(false);
mappings.setMaxWidth(Double.MAX_VALUE);
for (NamedColorMapping mapping : NamedColorMappings.getMappings()) mappings.getItems().add(mapping.getName());
mappings.setValue(((NamedColorMapping) selected_mapping).getName());
mappings.setOnAction(event -> {
final NamedColorMapping mapping = NamedColorMappings.getMapping(mappings.getValue());
plot.setColorMapping(mapping);
});
layout.add(mappings, 2, row++);
}
label = new Label("Minimum");
layout.add(label, 1, row);
final TextField min = new TextField(Double.toString(plot.getValueRange().getLow()));
layout.add(min, 2, row);
label = new Label("Maximum");
layout.add(label, 1, ++row);
final TextField max = new TextField(Double.toString(plot.getValueRange().getHigh()));
layout.add(max, 2, row);
final EventHandler<ActionEvent> update_range = event -> {
try {
plot.setValueRange(Double.parseDouble(min.getText().trim()), Double.parseDouble(max.getText().trim()));
plot.internalGetImagePlot().fireChangedValueRange();
} catch (NumberFormatException ex) {
final ValueRange range = plot.getValueRange();
min.setText(Double.toString(range.getLow()));
max.setText(Double.toString(range.getHigh()));
}
};
min.setOnAction(update_range);
max.setOnAction(update_range);
final CheckBox autoscale = new CheckBox("auto-scale");
autoscale.setSelected(plot.isAutoscale());
min.setDisable(autoscale.isSelected());
max.setDisable(autoscale.isSelected());
autoscale.setOnAction(event -> {
plot.setAutoscale(autoscale.isSelected());
min.setDisable(autoscale.isSelected());
max.setDisable(autoscale.isSelected());
plot.internalGetImagePlot().fireChangedAutoScale();
});
layout.add(autoscale, 2, ++row);
final CheckBox show_color_bar = new CheckBox("show color bar");
show_color_bar.setSelected(plot.isShowingColorMap());
show_color_bar.setOnAction(event -> plot.showColorMap(show_color_bar.isSelected()));
layout.add(show_color_bar, 2, ++row);
final CheckBox logscale = new CheckBox("log scale");
logscale.setSelected(plot.isLogscale());
logscale.setOnAction(event -> {
plot.setLogscale(logscale.isSelected());
plot.internalGetImagePlot().fireChangedLogarithmic();
});
layout.add(logscale, 2, ++row);
label = new Label("Horizontal Axis");
label.setFont(section_font);
layout.add(label, 0, ++row);
row = addAxisContent(layout, row, plot.getXAxis());
label = new Label("Vertical Axis");
label.setFont(section_font);
layout.add(label, 0, ++row);
row = addAxisContent(layout, row, plot.getYAxis());
return layout;
}
use of javafx.scene.layout.GridPane in project org.csstudio.display.builder by kasemir.
the class PlotConfigDialog method createContent.
private Node createContent() {
final GridPane layout = new GridPane();
layout.setHgap(5);
layout.setVgap(5);
// Debug layout
// layout.setGridLinesVisible(true);
// Row to use for the next elements
int row = 0;
Label label = new Label("Value Axes");
final Font font = label.getFont();
final Font section_font = Font.font(font.getFamily(), FontWeight.BOLD, font.getSize());
label.setFont(section_font);
layout.add(label, 0, row++);
for (Axis<?> axis : plot.getYAxes()) row = addAxisContent(layout, row, axis);
label = new Label("Horizontal Axis");
label.setFont(section_font);
layout.add(label, 0, row++);
row = addAxisContent(layout, row, plot.getXAxis());
return layout;
}
use of javafx.scene.layout.GridPane in project kanonizo by kanonizo.
the class GuiUtils method setStandardSpacing.
public static void setStandardSpacing(Pane node) {
node.setPadding(new Insets(INSETS_TOP, INSETS_RIGHT, INSETS_BOTTOM, INSETS_LEFT));
if (node instanceof HBox) {
((HBox) node).setSpacing(10);
} else if (node instanceof VBox) {
((VBox) node).setSpacing(10);
} else if (node instanceof GridPane) {
GridPane pane = (GridPane) node;
pane.setHgap(GRID_PANE_H_GAP);
pane.setVgap(GRID_PANE_V_GAP);
}
}
use of javafx.scene.layout.GridPane in project org.csstudio.display.builder by kasemir.
the class ActionsDialog method createExecuteScriptDetails.
/**
* @return Sub-pane for ExecuteScript action
*/
private GridPane createExecuteScriptDetails() {
final InvalidationListener update = whatever -> {
if (updating || selected_action_index < 0)
return;
actions.set(selected_action_index, getExecuteScriptAction());
};
final GridPane execute_script_details = new GridPane();
execute_script_details.setHgap(10);
execute_script_details.setVgap(10);
execute_script_details.add(new Label(Messages.ActionsDialog_Description), 0, 0);
execute_script_description = new TextField();
execute_script_description.textProperty().addListener(update);
execute_script_details.add(execute_script_description, 1, 0);
GridPane.setHgrow(execute_script_description, Priority.ALWAYS);
execute_script_details.add(new Label(Messages.ActionsDialog_ScriptPath), 0, 1);
execute_script_file = new TextField();
execute_script_file.textProperty().addListener(update);
final Button select = new Button("...");
select.setOnAction(event -> {
try {
final String path = FilenameSupport.promptForRelativePath(widget, execute_script_file.getText());
if (path != null)
execute_script_file.setText(path);
FilenameSupport.performMostAwfulTerribleNoGoodHack(action_list);
} catch (Exception ex) {
logger.log(Level.WARNING, "Cannot prompt for filename", ex);
}
});
final HBox path_box = new HBox(execute_script_file, select);
HBox.setHgrow(execute_script_file, Priority.ALWAYS);
execute_script_details.add(path_box, 1, 1);
final Button btn_embed_py = new Button(Messages.ScriptsDialog_BtnEmbedPy, JFXUtil.getIcon("embedded_script.png"));
btn_embed_py.setOnAction(event -> {
execute_script_file.setText(ScriptInfo.EMBEDDED_PYTHON);
final String text = execute_script_text.getText();
if (text == null || text.trim().isEmpty() || text.trim().equals(ScriptInfo.EXAMPLE_JAVASCRIPT))
execute_script_text.setText(ScriptInfo.EXAMPLE_PYTHON);
});
final Button btn_embed_js = new Button(Messages.ScriptsDialog_BtnEmbedJS, JFXUtil.getIcon("embedded_script.png"));
btn_embed_js.setOnAction(event -> {
execute_script_file.setText(ScriptInfo.EMBEDDED_JAVASCRIPT);
final String text = execute_script_text.getText();
if (text == null || text.trim().isEmpty() || text.trim().equals(ScriptInfo.EXAMPLE_PYTHON))
execute_script_text.setText(ScriptInfo.EXAMPLE_JAVASCRIPT);
});
execute_script_details.add(new HBox(10, btn_embed_py, btn_embed_js), 1, 2);
execute_script_details.add(new Label(Messages.ActionsDialog_ScriptText), 0, 3);
execute_script_text = new TextArea();
execute_script_text.setText(null);
execute_script_text.textProperty().addListener(update);
execute_script_details.add(execute_script_text, 0, 4, 2, 1);
GridPane.setVgrow(execute_script_text, Priority.ALWAYS);
return execute_script_details;
}
use of javafx.scene.layout.GridPane in project org.csstudio.display.builder by kasemir.
the class ScaledSliderRepresentation method createJFXNode.
@Override
protected GridPane createJFXNode() throws Exception {
slider.setFocusTraversable(true);
slider.setOnKeyPressed((final KeyEvent event) -> {
switch(event.getCode()) {
case PAGE_UP:
slider.adjustValue(value + slider.getBlockIncrement());
event.consume();
break;
case PAGE_DOWN:
slider.adjustValue(value - slider.getBlockIncrement());
event.consume();
break;
default:
break;
}
});
slider.setValue(value);
final GridPane pane = new GridPane();
// pane.setGridLinesVisible(true);
pane.add(markers, 0, 0);
pane.getChildren().add(slider);
return pane;
}
Aggregations