use of javafx.beans.property.ReadOnlyStringWrapper in project honest-profiler by jvm-profiling-tools.
the class FlatDiffViewController method initializeTable.
/**
* Initializes the {@link TableView} which displays the {@link FlatDiff} {@link Aggregation}.
*/
@Override
protected void initializeTable() {
method.setCellValueFactory(data -> new ReadOnlyStringWrapper(data.getValue().getKey()));
method.setCellFactory(col -> new MethodNameTableCell<DiffEntry>());
// The column configuration methods should (for now) be called in the same order as the columns are declared in
// the FXML.
// The only reason is the column view context menu, which collects its menu items in the order of these
// declarations. If the order is out of sync, the column view context menu will not have its items in the
// correct order.
// This will probably, eventually, be remedied by reordering but for now this comment will have to do.
cfgPctCol(baseSelfCntPct, "baseSelfCntPct", baseCtx(), getText(COLUMN_SELF_CNT_PCT));
cfgPctCol(newSelfCntPct, "newSelfCntPct", newCtx(), getText(COLUMN_SELF_CNT_PCT));
cfgPctDiffCol(selfCntPctDiff, "selfCntPctDiff", getText(COLUMN_SELF_CNT_PCT_DIFF));
cfgPctCol(baseTotalCntPct, "baseTotalCntPct", baseCtx(), getText(COLUMN_TOTAL_CNT_PCT));
cfgPctCol(newTotalCntPct, "newTotalCntPct", newCtx(), getText(COLUMN_TOTAL_CNT_PCT));
cfgPctDiffCol(totalCntPctDiff, "totalCntPctDiff", getText(COLUMN_TOTAL_CNT_PCT_DIFF));
cfgNrCol(baseSelfCnt, "baseSelfCnt", baseCtx(), getText(COLUMN_SELF_CNT));
cfgNrCol(newSelfCnt, "newSelfCnt", newCtx(), getText(COLUMN_SELF_CNT));
cfgNrDiffCol(selfCntDiff, "selfCntDiff", getText(COLUMN_SELF_CNT_DIFF));
cfgNrCol(baseTotalCnt, "baseTotalCnt", baseCtx(), getText(COLUMN_TOTAL_CNT));
cfgNrCol(newTotalCnt, "newTotalCnt", newCtx(), getText(COLUMN_TOTAL_CNT));
cfgNrDiffCol(totalCntDiff, "totalCntDiff", getText(COLUMN_TOTAL_CNT_DIFF));
cfgPctCol(baseSelfTimePct, "baseSelfTimePct", baseCtx(), getText(COLUMN_SELF_TIME_PCT));
cfgPctCol(newSelfTimePct, "newSelfTimePct", newCtx(), getText(COLUMN_SELF_TIME_PCT));
cfgPctDiffCol(selfTimePctDiff, "selfTimePctDiff", getText(COLUMN_SELF_TIME_PCT_DIFF));
cfgPctCol(baseTotalTimePct, "baseTotalTimePct", baseCtx(), getText(COLUMN_TOTAL_TIME_PCT));
cfgPctCol(newTotalTimePct, "newTotalTimePct", newCtx(), getText(COLUMN_TOTAL_TIME_PCT));
cfgPctDiffCol(totalTimePctDiff, "totalTimePctDiff", getText(COLUMN_TOTAL_TIME_PCT_DIFF));
cfgTimeCol(baseSelfTime, "baseSelfTime", baseCtx(), getText(COLUMN_SELF_TIME));
cfgTimeCol(newSelfTime, "newSelfTime", newCtx(), getText(COLUMN_SELF_TIME));
cfgTimeDiffCol(selfTimeDiff, "selfTimeDiff", getText(COLUMN_SELF_TIME_DIFF));
cfgTimeCol(baseTotalTime, "baseTotalTime", baseCtx(), getText(COLUMN_TOTAL_TIME));
cfgTimeCol(newTotalTime, "newTotalTime", newCtx(), getText(COLUMN_TOTAL_TIME));
cfgTimeDiffCol(totalTimeDiff, "totalTimeDiff", getText(COLUMN_TOTAL_TIME_DIFF));
}
use of javafx.beans.property.ReadOnlyStringWrapper in project latexdraw by arnobl.
the class ShortcutsController method initialize.
@SuppressWarnings("unchecked")
@Override
public void initialize(final URL location, final ResourceBundle resources) {
final String ctrl = KeyEvent.getKeyModifiersText(InputEvent.CTRL_MASK);
final String shift = KeyEvent.getKeyModifiersText(InputEvent.SHIFT_MASK);
// $NON-NLS-1$
final String leftClick = LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.8");
// $NON-NLS-1$
final String catEdit = LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.89");
// $NON-NLS-1$
final String catNav = LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.4");
// $NON-NLS-1$
final String catTran = LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.5");
// $NON-NLS-1$
final String catDraw = LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.6");
// $NON-NLS-1$
final String catFile = LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.88");
for (int i = 0, size = table.getColumns().size(); i < size; i++) {
final int colIndex = i;
final TableColumn<ObservableList<String>, String> col = (TableColumn<ObservableList<String>, String>) table.getColumns().get(i);
col.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().get(colIndex)));
}
table.getColumns().forEach(col -> col.prefWidthProperty().bind(table.widthProperty().divide(3)));
// $NON-NLS-1$
table.getItems().addAll(// $NON-NLS-1$
FXCollections.observableArrayList(ctrl + "+C", LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.40"), catEdit), // $NON-NLS-1$
FXCollections.observableArrayList(ctrl + "+V", LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.43"), catEdit), // $NON-NLS-1$
FXCollections.observableArrayList(ctrl + "+X", LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.44"), catEdit), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(ctrl + "+Z", LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.23"), catEdit), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(ctrl + "+Y", LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.22"), catEdit), // $NON-NLS-1$
FXCollections.observableArrayList(ctrl + "+N", LangTool.INSTANCE.getBundle().getString("Res.2"), catFile), // $NON-NLS-1$
FXCollections.observableArrayList(ctrl + "+O", LangTool.INSTANCE.getBundle().getString("FileLoaderSaver.3"), catFile), // $NON-NLS-1$
FXCollections.observableArrayList(ctrl + "+S", LangTool.INSTANCE.getBundle().getString("FileLoaderSaver.1"), catFile), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(ctrl + "+W", LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.18"), catFile), // $NON-NLS-1$
FXCollections.observableArrayList(KeyEvent.getKeyText(KeyEvent.VK_ADD), LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.57"), catNav), // $NON-NLS-1$
FXCollections.observableArrayList(KeyEvent.getKeyText(KeyEvent.VK_SUBTRACT), LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.58"), catNav), // $NON-NLS-1$
FXCollections.observableArrayList(KeyEvent.getKeyText(KeyEvent.VK_DELETE), LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.17"), catDraw), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(KeyEvent.getKeyText(KeyEvent.VK_RIGHT), LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.9"), catNav), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(KeyEvent.getKeyText(KeyEvent.VK_LEFT), LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.10"), catNav), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(KeyEvent.getKeyText(KeyEvent.VK_UP), LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.11"), catNav), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(KeyEvent.getKeyText(KeyEvent.VK_DOWN), LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.12"), catNav), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(ctrl + "+U", LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.23"), catTran), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(ctrl + "+A", LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.25"), catDraw), // $NON-NLS-1$
FXCollections.observableArrayList(ctrl + '+' + leftClick, LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.26"), catDraw), // $NON-NLS-1$
FXCollections.observableArrayList(shift + '+' + leftClick, LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.27"), catDraw), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(ctrl + '+' + LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.29"), LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.30"), catDraw));
}
use of javafx.beans.property.ReadOnlyStringWrapper in project latexdraw by arnobl.
the class BadaboomController method initialize.
@SuppressWarnings("unchecked")
@Override
public void initialize(final URL location, final ResourceBundle resources) {
final ObservableList<TableColumn<Throwable, ?>> cols = table.getColumns();
((TableColumn<Throwable, String>) cols.get(0)).setCellValueFactory(cell -> new ReadOnlyStringWrapper(cell.getValue().toString()));
((TableColumn<Throwable, String>) cols.get(1)).setCellValueFactory(cell -> new ReadOnlyStringWrapper(cell.getValue().getMessage()));
((TableColumn<Throwable, String>) cols.get(2)).setCellValueFactory(cell -> {
final StackTraceElement[] stackTrace = cell.getValue().getStackTrace();
final String msg = stackTrace != null && stackTrace.length > 0 ? stackTrace[0].toString() : "";
return new ReadOnlyStringWrapper(msg);
});
cols.forEach(col -> col.prefWidthProperty().bind(table.widthProperty().divide(3)));
table.setItems(FXCollections.observableArrayList(BadaboomCollector.INSTANCE));
table.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
final Callable<String> converter = () -> {
final Throwable ex = table.getSelectionModel().getSelectedItem();
if (ex == null)
return "";
// NON-NLS
return Arrays.stream(ex.getStackTrace()).map(Object::toString).collect(Collectors.joining("\n\tat ", ex.toString() + "\n\tat ", ""));
};
stack.textProperty().bind(Bindings.createStringBinding(converter, table.getSelectionModel().selectedItemProperty()));
}
use of javafx.beans.property.ReadOnlyStringWrapper in project DeskChan by DeskChan.
the class OptionsDialog method generalOptions.
/**
* Creating 'Balloon' options submenu. *
*/
private static void generalOptions() {
List<Map<String, Object>> list = new LinkedList<>();
list.add(new HashMap<String, Object>() {
{
put("id", "language");
put("type", "ComboBox");
put("msgTag", "gui:set-language");
put("label", Main.getString("language"));
List<Object> values = FXCollections.observableList(new ArrayList<>());
for (Map.Entry<String, String> locale : CoreInfo.locales.entrySet()) {
values.add(locale.getValue());
if (Locale.getDefault().getLanguage().equals(locale.getKey()))
put("value", values.size() - 1);
}
put("values", values);
}
});
list.add(new HashMap<String, Object>() {
{
put("id", "redirect-recognition");
put("type", "CheckBox");
put("label", Main.getString("redirect-recognition"));
put("msgTag", "gui:toggle-redirect-recognition");
put("value", Main.getProperties().getBoolean("redirect-recognition", false));
}
});
list.add(new HashMap<String, Object>() {
{
put("id", "alternatives");
put("type", "Button");
put("label", Main.getString("alternatives"));
put("dstPanel", Main.getPluginProxy().getId() + "-alternatives");
put("value", Main.getString("open"));
}
});
list.add(new HashMap<String, Object>() {
{
put("id", "debug");
put("type", "Button");
put("label", Main.getString("debug-window"));
put("dstPanel", Main.getPluginProxy().getId() + "-debug");
put("value", Main.getString("open"));
}
});
list.add(new HashMap<String, Object>() {
{
put("id", "open_log");
put("type", "Button");
put("msgTag", "gui:open-log-file");
put("label", Main.getString("open_log"));
put("value", Main.getString("open"));
}
});
new ControlsPanel(Main.getPluginProxy().getId(), Main.getString("general_options"), "general", ControlsPanel.PanelType.TAB, list).set();
// / alternatives
BorderPane alternativesTab = new BorderPane();
TreeTableView<AlternativeTreeItem> alternativesTable = instance.alternativesTable;
alternativesTab.setCenter(alternativesTable);
{
TreeTableColumn<AlternativeTreeItem, String> column = new TreeTableColumn<>(Main.getString("tag"));
column.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue().getValue().tag));
alternativesTable.getColumns().add(column);
column = new TreeTableColumn<>(Main.getString("plugin"));
column.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue().getValue().plugin));
alternativesTable.getColumns().add(column);
column = new TreeTableColumn<>(Main.getString("priority"));
column.setCellValueFactory(param -> {
int priority = param.getValue().getValue().priority;
return new ReadOnlyStringWrapper((priority >= 0) ? String.valueOf(priority) : null);
});
alternativesTable.getColumns().add(column);
}
alternativesTable.setShowRoot(false);
new ControlsPanel(Main.getPluginProxy().getId(), Main.getString("alternatives"), "alternatives", ControlsPanel.PanelType.PANEL, alternativesTab).set();
// / debug
BorderPane debugTab = new BorderPane();
TextField debugMsgTag = new TextField("DeskChan:say");
debugTab.setTop(debugMsgTag);
TextArea debugMsgData = new TextArea("{\n\"text\": \"Test\"\n}");
debugTab.setCenter(debugMsgData);
Button button = new Button(Main.getString("send"));
button.setOnAction(event -> {
String tag = debugMsgTag.getText().trim();
String dataStr = debugMsgData.getText();
try {
Main.getPluginProxy().sendMessage(tag, stringToMap(dataStr));
} catch (Throwable e) {
Main.log(e);
}
});
Button reloadButton = new Button(Main.getString("reload-style"));
reloadButton.setOnAction(event -> {
instance.applyStyle();
instance.hide();
instance.show();
});
HBox buttons = new HBox(button, reloadButton);
buttons.setId("controls-bottom-buttons");
debugTab.setBottom(buttons);
new ControlsPanel(Main.getPluginProxy().getId(), Main.getString("debug"), "debug", ControlsPanel.PanelType.PANEL, debugTab).set();
}
use of javafx.beans.property.ReadOnlyStringWrapper in project dwoss by gg-net.
the class TreeTableController method initialize.
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
TreeItem<DataWrapper> root = new TreeItem<>(new DataWrapper() {
@Override
public String getName() {
return "Root";
}
});
view.setRoot(root);
root.setExpanded(true);
view.setShowRoot(false);
root.getChildren().addAll(getTradeNames());
overview.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<DataWrapper, String>, ObservableValue<String>>() {
@Override
public ObservableValue<String> call(TreeTableColumn.CellDataFeatures<DataWrapper, String> param) {
return new ReadOnlyStringWrapper(param.getValue().getValue().getName());
}
});
amount.setCellValueFactory(new Callback<CellDataFeatures<DataWrapper, Integer>, ObservableValue<Integer>>() {
@Override
public ObservableValue<Integer> call(CellDataFeatures<DataWrapper, Integer> param) {
DataWrapper dw = param.getValue().getValue();
SimpleObjectProperty<Integer> result;
if (dw instanceof ProductGroupWrapper) {
result = new SimpleObjectProperty<>(amountOfCategoryProducts(((ProductGroupWrapper) dw).getTradeName(), ((ProductGroupWrapper) dw).getProductGroup()));
return result;
}
if (dw instanceof CategoryProductWrapper) {
result = new SimpleObjectProperty<>(amountOfProducts(((CategoryProductWrapper) dw).getCategoryProductId()));
return result;
}
if (dw instanceof ProductWrapper) {
result = new SimpleObjectProperty<>(amountOfUnitCollections(((ProductWrapper) dw).getProductId()));
return result;
}
if (dw instanceof UnitCollectionWrapper) {
result = new SimpleObjectProperty<>(amountOfUnits(((UnitCollectionWrapper) dw).getUnitCollectionId()));
return result;
}
result = new SimpleObjectProperty<>(0);
return result;
}
});
}
Aggregations