use of javafx.scene.control.TitledPane in project aic-praise by aic-sri-international.
the class QueryController method displayQueryAnswer.
private void displayQueryAnswer(String query, Expression result, ParsedHOGModel parsedModel, long millisecondsToCompute) {
String answer = "P(" + query + " | ... ) = " + result;
String title = "Query" + duration(" took ", millisecondsToCompute) + " to compute '" + answer + "'";
HOGMCodeArea resultCodeArea = new HOGMCodeArea(false);
resultCodeArea.setText(answer);
resultCodeArea.setEditable(false);
Node resultContent = null;
if (SGSolverDemoController.isInDebugMode()) {
HOGMCodeArea parsedModelArea = createParsedModelView(parsedModel);
TabPane resultTabs = new TabPane();
resultTabs.getTabs().add(new Tab("Answer", resultCodeArea));
resultTabs.getTabs().add(new Tab("Parsed As", parsedModelArea));
resultContent = resultTabs;
} else {
resultContent = resultCodeArea;
}
TitledPane resultPane = new TitledPane(title, resultContent);
FXUtil.setTitledPaneIcon(resultPane, FontAwesomeIcons.CHECK);
showResultPane(resultPane);
}
use of javafx.scene.control.TitledPane in project aic-praise by aic-sri-international.
the class QueryController method displayQueryErrors.
private void displayQueryErrors(String query, List<HOGMQueryError> queryErrors, ParsedHOGModel parsedModel, long millisecondsToCompute) {
String title = "Query '" + query + "' encountered " + queryErrors.size() + " error(s) when attempting to compute answer (" + duration("took ", millisecondsToCompute) + ")";
ListView<HOGMQueryError> errors = new ListView<>(FXCollections.observableList(queryErrors));
//errors.setFixedCellSize(24);
errors.setPrefHeight(24 * 5);
errors.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
errors.getSelectionModel().selectedIndexProperty().addListener((obs, oldValue, newValue) -> {
if (newValue.intValue() >= 0) {
HOGMQueryError qError = errors.getItems().get(newValue.intValue());
if (qError.getContext() == HOGMQueryError.Context.MODEL) {
modelPageEditor.highlight(qError.getStartContextIndex(), qError.getEndContextIndex());
} else if (qError.getContext() == HOGMQueryError.Context.QUERY) {
queryComboBox.getEditor().selectAll();
}
}
});
Node resultContent = null;
if (SGSolverDemoController.isInDebugMode()) {
HOGMCodeArea parsedModelArea = createParsedModelView(parsedModel);
TabPane resultTabs = new TabPane();
resultTabs.getTabs().add(new Tab("Errors", errors));
resultTabs.getTabs().add(new Tab("Parsed As", parsedModelArea));
resultContent = resultTabs;
} else {
resultContent = errors;
}
TitledPane resultPane = new TitledPane(title, resultContent);
FXUtil.setTitledPaneIcon(resultPane, FontAwesomeIcons.TIMES);
showResultPane(resultPane);
errors.getSelectionModel().selectFirst();
}
use of javafx.scene.control.TitledPane in project Gargoyle by callakrsos.
the class SystemLayoutViewController method initialize.
@FXML
public void initialize() {
// 쿼리 리스너를 등록
DbUtil.registQuertyListener(this);
try {
FXMLLoader loader = FxUtil.createNewFxmlLoader();
loader.setLocation(SystemLayoutViewController.class.getResource("DAOLoaderView.fxml"));
TitledPane titledPane = loader.load();
VBox.setVgrow(titledPane, Priority.ALWAYS);
accordionItems.getChildren().add(titledPane);
DAOLoaderController controller = loader.getController();
controller.setSystemLayoutViewController(this);
} catch (IOException e1) {
e1.printStackTrace();
}
SharedMemory.setSystemLayoutView(this);
SharedMemory.setWorkspaceTab(tabPanWorkspace);
// tab key에 대한 이벤트 처리 등록....
SharedMemory.getPrimaryStage().addEventHandler(KeyEvent.ANY, event -> {
boolean isCloseALLtabKeyCode = event.isControlDown() && event.isShiftDown() && KeyCode.W == event.getCode();
boolean isTabMoveCode = event.isControlDown() && isNumberCode(event.getCode());
ObservableList<DockTab> tabs = tabPanWorkspace.getTabs();
if (isCloseALLtabKeyCode) {
LOGGER.debug("CLOSE ALL TABS...");
for (int i = tabs.size() - 1; i > 0; i--) {
tabs.remove(i);
}
} else if (isTabMoveCode) {
int tabIndex = Integer.parseInt(event.getCode().getName());
if (tabIndex > 0 && tabs.size() < tabIndex)
return;
LOGGER.debug("MOVE TAB" + event.getCode().getName());
tabPanWorkspace.getSelectionModel().select(tabIndex - 1);
}
});
String baseDir = ResourceLoader.getInstance().get(ResourceLoader.BASE_DIR);
selectDirFile = new File(baseDir);
createNewTreeViewMenuItems();
webvWelcome.getEngine().setJavaScriptEnabled(true);
webvWelcome.getEngine().load(HOME_URL);
txtUrl.addEventHandler(KeyEvent.KEY_PRESSED, event -> {
if (KeyCode.ENTER == event.getCode()) {
webvWelcome.getEngine().load(txtUrl.getText());
}
});
btnUrlSearch.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> {
if (event.getClickCount() >= 1) {
webvWelcome.getEngine().load(txtUrl.getText());
}
});
webvWelcome.setOnKeyPressed(key -> {
if (key.getCode() == KeyCode.F12) {
FxUtil.createStageAndShow("Simple Web Console", new WebViewConsole(webvWelcome));
}
});
treeProjectFile.setRoot(createNewTree(selectDirFile));
treeProjectFile.setShowRoot(false);
// 트리 컨테스트 요청 이벤트
treeProjectFile.setOnContextMenuRequested(this::treeProjectFileOnContextMenuRequested);
// 트리 마우스 이벤트
treeProjectFile.setOnMouseClicked(this::treeProjectFileOnMouseClick);
// 트리 키 이벤트
treeProjectFile.addEventHandler(KeyEvent.KEY_PRESSED, this::treeProjectFileOnKeyPressed);
/** 플러그인들을 로드함. **/
Platform.runLater(new Runnable() {
@Override
public void run() {
List<JarWrapper> load = PluginLoader.getInstance().load();
load.stream().forEach(jarWrapper -> {
try {
String displayMenuName = jarWrapper.getDisplayMenuName();
MenuItem pluginMenu = new MenuItem(displayMenuName);
pluginMenu.setUserData(jarWrapper);
pluginMenu.setOnAction(event -> {
JarWrapper jar = (JarWrapper) pluginMenu.getUserData();
try {
Class<?> nodeClass = jar.getNodeClass();
Object newInstance = jar.loader.loadClass(nodeClass.getName()).newInstance();
if (newInstance instanceof CloseableParent<?>) {
loadNewSystemTab(jar.getDisplayMenuName(), (CloseableParent<?>) newInstance);
} else {
loadNewSystemTab(jar.getDisplayMenuName(), (Parent) newInstance, SkinManager.getInstance().getJavafxDefaultSkin());
}
} catch (Exception e) {
LOGGER.error("regist fail plugin.");
LOGGER.error(ValueUtil.toString(e));
}
});
try {
Class<GagoyleParentBeforeLoad> setBeforeParentLoadListenerClass = jarWrapper.getSetOnParentBeforeLoadedListenerClass();
if (setBeforeParentLoadListenerClass != null)
setOnbeforeParentLoad(setBeforeParentLoadListenerClass.newInstance());
} catch (Exception e) {
LOGGER.error("regist fail 'GagoyleParentBeforeLoad' listener.");
}
try {
Class<GagoyleParentOnLoaded> addOnParentLoadedListenerClass = jarWrapper.getAddOnParentLoadedListenerClass();
if (addOnParentLoadedListenerClass != null)
addOnParentLoadedListener(addOnParentLoadedListenerClass.newInstance());
} catch (Exception e) {
LOGGER.error("regist fail 'GagoyleParentOnLoaded' listener.");
}
menuPlugins.getItems().add(pluginMenu);
} catch (Exception e) {
LOGGER.debug(ValueUtil.toString(e));
}
});
}
});
//tab image 아이콘 처리
try (InputStream is = getClass().getResourceAsStream("/META-INF/images/eclipse/eview16/packages.gif")) {
tabPackageExplorer.setGraphic(new ImageView(new Image(is)));
} catch (IOException e) {
e.printStackTrace();
}
tabPanWorkspace.getTabs().addListener(dockTabCloseListener);
}
use of javafx.scene.control.TitledPane in project org.csstudio.display.builder by kasemir.
the class Palette method createWidgetCategoryPanes.
/**
* Create a TilePane for each WidgetCategory
* @param parent Parent Pane
* @return Map of panes for each category
*/
private Map<WidgetCategory, Pane> createWidgetCategoryPanes(final Pane parent) {
final Map<WidgetCategory, Pane> palette_groups = new HashMap<>();
for (final WidgetCategory category : WidgetCategory.values()) {
final TilePane palette_group = new TilePane();
palette_group.getStyleClass().add("palette_group");
palette_group.setPrefColumns(1);
palette_group.setMaxWidth(Double.MAX_VALUE);
palette_groups.put(category, palette_group);
palette_group.setHgap(2);
palette_group.setVgap(2);
final TitledPane pane = new TitledPane(category.getDescription(), palette_group);
pane.getStyleClass().add("palette_category");
parent.getChildren().add(pane);
}
return palette_groups;
}
use of javafx.scene.control.TitledPane in project latexdraw by arnobl.
the class TestLatexdrawGUI method start.
@Override
public void start(final Stage aStage) {
Canvas.setMargins(20);
Canvas.setDefaultPage(Page.HORIZONTAL);
stage = aStage;
try {
injector = createInjector();
injectorFactory = injector::getInstance;
final Parent root = FXMLLoader.load(LaTeXDraw.class.getResource(getFXMLPathFromLatexdraw()), LangTool.INSTANCE.getBundle(), new LatexdrawBuilderFactory(injector), injectorFactory);
Parent parent = root;
// So, need to add a fictive pane to contain the widgets.
if (root instanceof Pane) {
parent = root;
} else {
// TitledPane leads to flaky tests with TestFX. So, replacing the TitlePane with a classical pane.
if (parent instanceof TitledPane) {
titledPane = (TitledPane) parent;
final Node content = ((TitledPane) parent).getContent();
if (content instanceof Parent) {
parent = (Parent) content;
} else {
final BorderPane pane = new BorderPane();
pane.setCenter(content);
parent = pane;
}
}
}
final Scene scene = new Scene(parent);
aStage.setScene(scene);
aStage.show();
aStage.toFront();
if (root instanceof Region) {
aStage.minHeightProperty().bind(((Region) root).heightProperty());
aStage.minWidthProperty().bind(((Region) root).widthProperty());
}
aStage.sizeToScene();
} catch (final IOException ex) {
ex.printStackTrace();
}
}
Aggregations