List of usage examples for javafx.scene.layout HBox setHgrow
public static void setHgrow(Node child, Priority value)
From source file:org.pdfsam.ui.dashboard.preference.PreferenceWorkspacePane.java
@Inject public PreferenceWorkspacePane(@Named("workingDirectory") PreferenceBrowsableDirectoryField workingDirectory, @Named("workspace") PreferenceBrowsableFileField workspace, @Named("saveWorkspaceOnExit") PreferenceCheckBox saveWorkspaceOnExit) { I18nContext i18n = DefaultI18nContext.getInstance(); workingDirectory.getTextField()/*from w w w . j a v a2 s. co m*/ .setPromptText(i18n.i18n("Select a directory where documents will be saved and loaded by default")); workingDirectory.setBrowseWindowTitle(i18n.i18n("Select a directory")); HBox workigDirPane = new HBox(workingDirectory, helpIcon(i18n.i18n("Select a directory where documents will be saved and loaded by default"))); HBox.setHgrow(workingDirectory, Priority.ALWAYS); workigDirPane.getStyleClass().add("with-help-hcontainer"); workspace.getTextField().setPromptText( i18n.i18n("Select a previously saved workspace that will be automatically loaded at startup")); workspace.setBrowseWindowTitle(i18n.i18n("Select a workspace")); HBox workspaceDirPane = new HBox(workspace, helpIcon( i18n.i18n("Select a previously saved workspace that will be automatically loaded at startup"))); HBox.setHgrow(workspace, Priority.ALWAYS); workspaceDirPane.getStyleClass().add("with-help-hcontainer"); workspace.getTextField().validProperty().addListener((o, oldVal, newVal) -> { saveWorkspaceOnExit .setDisable(isBlank(workspace.getTextField().getText()) || newVal != ValidationState.VALID); }); workspace.getTextField().validate(); getChildren().addAll(new Label(i18n.i18n("Default working directory:")), workigDirPane, new Label(i18n.i18n("Load default workspace at startup:")), workspaceDirPane, saveWorkspaceOnExit); getStyleClass().addAll(Style.CONTAINER.css()); }
From source file:org.pdfsam.ui.io.BrowsableField.java
public BrowsableField() { HBox.setHgrow(textField, Priority.ALWAYS); this.getStyleClass().add("browsable-field"); validableContainer = new HBox(textField); validableContainer.getStyleClass().add("validable-container"); textField.getStyleClass().add("validable-container-field"); browseButton = new Button(DefaultI18nContext.getInstance().i18n("Browse")); browseButton.getStyleClass().addAll(Style.BROWSE_BUTTON.css()); browseButton.prefHeightProperty().bind(validableContainer.heightProperty()); browseButton.setMaxHeight(USE_PREF_SIZE); browseButton.setMinHeight(USE_PREF_SIZE); HBox.setHgrow(validableContainer, Priority.ALWAYS); textField.validProperty().addListener((o, oldValue, newValue) -> { if (newValue == ValidationState.INVALID) { validableContainer.getStyleClass().addAll(Style.INVALID.css()); } else {/*from w w w . j a va2 s. c o m*/ validableContainer.getStyleClass().removeAll(Style.INVALID.css()); } }); textField.focusedProperty().addListener((o, oldVal, newVal) -> validableContainer .pseudoClassStateChanged(SELECTED_PSEUDOCLASS_STATE, newVal)); getChildren().addAll(validableContainer, browseButton); }
From source file:org.pdfsam.ui.module.Footer.java
public Footer(RunButton runButton, OpenButton openButton, String ownerModule) { this.ownerModule = defaultString(ownerModule); this.openButton = openButton; this.runButton = runButton; this.getStyleClass().addAll("pdfsam-container", "footer-pane"); this.statusLabel.getStyleClass().add("status-label"); this.statusLabel.setVisible(false); this.bar.setMaxWidth(Double.MAX_VALUE); this.bar.getStyleClass().add("pdfsam-footer-bar"); this.statusLabel.setMaxHeight(Double.MAX_VALUE); VBox progressPane = new VBox(statusLabel, bar); progressPane.getStyleClass().add("progress-pane"); VBox.setVgrow(statusLabel, Priority.ALWAYS); HBox.setHgrow(bar, Priority.ALWAYS); HBox.setHgrow(progressPane, Priority.ALWAYS); this.failed.setVisible(false); StackPane buttons = new StackPane(failed, openButton); buttons.setAlignment(Pos.CENTER_LEFT); this.getChildren().addAll(runButton, buttons, progressPane); eventStudio().add(TaskExecutionRequestEvent.class, e -> { if (e.getModuleId().equals(ownerModule)) { failed.setVisible(false);/*from w ww.ja va 2 s . co m*/ openButton.setVisible(false); statusLabel.setVisible(true); statusLabel.setText(DefaultI18nContext.getInstance().i18n("Requested")); bar.setProgress(0); } }); eventStudio().addAnnotatedListeners(this); }
From source file:org.pdfsam.ui.news.News.java
News(NewsData data) { this.getStyleClass().add("news-box"); TextFlow flow = new TextFlow(); if (data.isImportant()) { Text megaphone = GlyphsDude.createIcon(FontAwesomeIcon.BULLHORN, "1.2em"); megaphone.getStyleClass().clear(); megaphone.getStyleClass().add("news-box-title-important"); flow.getChildren().addAll(megaphone, new Text(" ")); }/* w ww . j a v a 2s. c o m*/ Text titleText = new Text(data.getTitle() + System.lineSeparator()); titleText.setOnMouseClicked(e -> eventStudio().broadcast(new OpenUrlRequest(data.getLink()))); titleText.getStyleClass().add("news-box-title"); Text contentText = new Text(data.getContent()); contentText.setTextAlignment(TextAlignment.JUSTIFY); contentText.getStyleClass().add("news-content"); flow.getChildren().addAll(titleText, contentText); flow.setTextAlignment(TextAlignment.JUSTIFY); Label labelDate = new Label(FORMATTER.format(data.getDate()), GlyphsDude.createIcon(MaterialDesignIcon.CLOCK)); labelDate.setPrefWidth(Integer.MAX_VALUE); HBox.setHgrow(labelDate, Priority.ALWAYS); HBox bottom = new HBox(labelDate); bottom.setAlignment(Pos.CENTER_LEFT); bottom.getStyleClass().add("news-box-footer"); if (isNotBlank(data.getLink())) { Button link = UrlButton.urlButton(null, data.getLink(), FontAwesomeIcon.EXTERNAL_LINK_SQUARE, "pdfsam-toolbar-button"); bottom.getChildren().add(link); } getChildren().addAll(flow, bottom); }
From source file:org.pdfsam.ui.selection.single.SingleSelectionPane.java
public SingleSelectionPane(String ownerModule) { super(5);/* w w w .ja v a 2s . co m*/ this.ownerModule = defaultString(ownerModule); field.enforceValidation(true, false); field.getTextField().setPromptText( DefaultI18nContext.getInstance().i18n("Select or drag and drop the PDF you want to split")); encryptionIndicator = new LoadingStatusIndicator(this, this.ownerModule); field.setGraphic(encryptionIndicator); HBox.setMargin(encryptionIndicator, new Insets(0, 0, 0, 2)); HBox topRow = new HBox(5, field); HBox.setHgrow(field, Priority.ALWAYS); topRow.setAlignment(Pos.CENTER_LEFT); getChildren().addAll(topRow, pages); field.getTextField().setEditable(false); field.getTextField().validProperty().addListener((o, oldVal, newVal) -> { if (newVal == ValidationState.VALID) { if (descriptor != null) { descriptor.invalidate(); } PdfLoadRequestEvent loadEvent = new PdfLoadRequestEvent(getOwnerModule()); descriptor = PdfDocumentDescriptor .newDescriptorNoPassword(new File(field.getTextField().getText())); descriptor.loadedProperty().addListener(new WeakChangeListener<>(onDescriptorLoaded)); field.getTextField().getContextMenu().getItems().forEach(i -> i.setDisable(false)); loadEvent.add(descriptor); eventStudio().broadcast(loadEvent); } }); initContextMenu(); }
From source file:org.samcrow.frameviewer.ui.db.DatabaseConnectionDialog.java
public DatabaseConnectionDialog(String connectionTypeName) { this.connectionTypeName = connectionTypeName; setTitle("Database connection"); // Placeholder root.getChildren().add(new Region()); // Buttons/*from w ww . ja va 2 s . c o m*/ { final HBox buttonBox = new HBox(); buttonBox.setPadding(new Insets(10)); cancelButton.setCancelButton(true); buttonBox.getChildren().add(cancelButton); cancelButton.setOnAction((ActionEvent t) -> { hide(); }); final Region spacer = new Region(); buttonBox.getChildren().add(spacer); HBox.setHgrow(spacer, Priority.ALWAYS); nextButton.setDefaultButton(true); buttonBox.getChildren().add(nextButton); root.getChildren().add(buttonBox); } switchToConnection(); final Scene scene = new Scene(root, 220, root.getPrefHeight()); setScene(scene); }
From source file:org.sleuthkit.autopsy.imageanalyzer.gui.GroupPane.java
/** * called automatically during constructor by FXMLConstructor. * * checks that FXML loading went ok and performs additional setup *//*from w w w. j a v a 2 s. com*/ @FXML void initialize() { assert gridView != null : "fx:id=\"tilePane\" was not injected: check your FXML file 'GroupPane.fxml'."; assert grpCatSplitMenu != null : "fx:id=\"grpCatSplitMenu\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert grpTagSplitMenu != null : "fx:id=\"grpTagSplitMenu\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert headerToolBar != null : "fx:id=\"headerToolBar\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert segButton != null : "fx:id=\"previewList\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert slideShowToggle != null : "fx:id=\"segButton\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert tileToggle != null : "fx:id=\"tileToggle\" was not injected: check your FXML file 'GroupHeader.fxml'."; grouping.addListener(new InvalidationListener() { private void updateFiles() { final ObservableList<Long> fileIds = grouping.get().fileIds(); Platform.runLater(() -> { gridView.setItems(FXCollections.observableArrayList(fileIds)); }); resetHeaderString(); } @Override public void invalidated(Observable o) { getScrollBar().ifPresent((scrollBar) -> { scrollBar.setValue(0); }); //set the embeded header resetHeaderString(); //and assign fileIDs to gridView if (grouping.get() == null) { Platform.runLater(gridView.getItems()::clear); } else { grouping.get().fileIds().addListener((Observable observable) -> { updateFiles(); }); updateFiles(); } } }); //configure flashing glow animation on next unseen group button flashAnimation.setCycleCount(Timeline.INDEFINITE); flashAnimation.setAutoReverse(true); //configure gridView cell properties gridView.cellHeightProperty().bind(Toolbar.getDefault().sizeSliderValue().add(75)); gridView.cellWidthProperty().bind(Toolbar.getDefault().sizeSliderValue().add(75)); gridView.setCellFactory((GridView<Long> param) -> new DrawableCell()); //configure toolbar properties HBox.setHgrow(spacer, Priority.ALWAYS); spacer.setMinWidth(Region.USE_PREF_SIZE); ArrayList<MenuItem> grpTagMenues = new ArrayList<>(); for (final TagName tn : TagUtils.getNonCategoryTagNames()) { MenuItem menuItem = createGrpTagMenuItem(tn); grpTagMenues.add(menuItem); } try { grpTagSplitMenu.setText(TagUtils.getFollowUpTagName().getDisplayName()); grpTagSplitMenu.setOnAction(createGrpTagMenuItem(TagUtils.getFollowUpTagName()).getOnAction()); } catch (TskCoreException tskCoreException) { LOGGER.log(Level.WARNING, "failed to load FollowUpTagName", tskCoreException); } grpTagSplitMenu.setGraphic(new ImageView(DrawableAttribute.TAGS.getIcon())); grpTagSplitMenu.getItems().setAll(grpTagMenues); ArrayList<MenuItem> grpCategoryMenues = new ArrayList<>(); for (final Category cat : Category.values()) { MenuItem menuItem = createGrpCatMenuItem(cat); grpCategoryMenues.add(menuItem); } grpCatSplitMenu.setText(Category.FIVE.getDisplayName()); grpCatSplitMenu.setGraphic(new ImageView(DrawableAttribute.CATEGORY.getIcon())); grpCatSplitMenu.getItems().setAll(grpCategoryMenues); grpCatSplitMenu.setOnAction(createGrpCatMenuItem(Category.FIVE).getOnAction()); Runnable syncMode = () -> { switch (groupViewMode.get()) { case SLIDE_SHOW: slideShowToggle.setSelected(true); break; case TILE: tileToggle.setSelected(true); break; } }; syncMode.run(); //make togle states match view state groupViewMode.addListener((o) -> { syncMode.run(); }); slideShowToggle.toggleGroupProperty().addListener((o) -> { slideShowToggle.getToggleGroup().selectedToggleProperty() .addListener((observable, oldToggle, newToggle) -> { if (newToggle == null) { oldToggle.setSelected(true); } }); }); //listen to toggles and update view state slideShowToggle.setOnAction((ActionEvent t) -> { activateSlideShowViewer(globalSelectionModel.lastSelectedProperty().get()); }); tileToggle.setOnAction((ActionEvent t) -> { activateTileViewer(); }); controller.viewState().addListener((ObservableValue<? extends GroupViewState> observable, GroupViewState oldValue, GroupViewState newValue) -> { setViewState(newValue); }); addEventFilter(KeyEvent.KEY_PRESSED, tileKeyboardNavigationHandler); gridView.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() { private ContextMenu buildContextMenu() { ArrayList<MenuItem> menuItems = new ArrayList<>(); menuItems.add(CategorizeAction.getPopupMenu()); menuItems.add(AddDrawableTagAction.getInstance().getPopupMenu()); Collection<? extends ContextMenuActionsProvider> menuProviders = Lookup.getDefault() .lookupAll(ContextMenuActionsProvider.class); for (ContextMenuActionsProvider provider : menuProviders) { for (final Action act : provider.getActions()) { if (act instanceof Presenter.Popup) { Presenter.Popup aact = (Presenter.Popup) act; menuItems.add(SwingMenuItemAdapter.create(aact.getPopupPresenter())); } } } final MenuItem extractMenuItem = new MenuItem("Extract File(s)"); extractMenuItem.setOnAction((ActionEvent t) -> { SwingUtilities.invokeLater(() -> { TopComponent etc = WindowManager.getDefault() .findTopComponent(ImageAnalyzerTopComponent.PREFERRED_ID); ExtractAction.getInstance().actionPerformed(new java.awt.event.ActionEvent(etc, 0, null)); }); }); menuItems.add(extractMenuItem); ContextMenu contextMenu = new ContextMenu(menuItems.toArray(new MenuItem[] {})); contextMenu.setAutoHide(true); return contextMenu; } @Override public void handle(MouseEvent t) { switch (t.getButton()) { case PRIMARY: if (t.getClickCount() == 1) { globalSelectionModel.clearSelection(); if (contextMenu != null) { contextMenu.hide(); } } t.consume(); break; case SECONDARY: if (t.getClickCount() == 1) { selectAllFiles(); } if (contextMenu == null) { contextMenu = buildContextMenu(); } contextMenu.hide(); contextMenu.show(GroupPane.this, t.getScreenX(), t.getScreenY()); t.consume(); break; } } }); // Platform.runLater(() -> { ActionUtils.configureButton(nextGroupAction, nextButton); final EventHandler<ActionEvent> onAction = nextButton.getOnAction(); nextButton.setOnAction((ActionEvent event) -> { flashAnimation.stop(); nextButton.setEffect(null); onAction.handle(event); }); ActionUtils.configureButton(forwardAction, forwardButton); ActionUtils.configureButton(backAction, backButton); // }); nextGroupAction.disabledProperty().addListener( (ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> { nextButton.setEffect(newValue ? null : DROP_SHADOW); if (newValue == false) { flashAnimation.play(); } else { flashAnimation.stop(); } }); //listen to tile selection and make sure it is visible in scroll area //TODO: make sure we are testing complete visability not just bounds intersection globalSelectionModel.lastSelectedProperty().addListener((observable, oldFileID, newFileId) -> { if (groupViewMode.get() == GroupViewMode.SLIDE_SHOW) { slideShowPane.setFile(newFileId); } else { scrollToFileID(newFileId); } }); setViewState(controller.viewState().get()); }
From source file:org.sleuthkit.autopsy.imagegallery.gui.GroupPane.java
/** * called automatically during constructor by FXMLConstructor. * * checks that FXML loading went ok and performs additional setup *///ww w . ja va2 s . c o m @FXML void initialize() { assert gridView != null : "fx:id=\"tilePane\" was not injected: check your FXML file 'GroupPane.fxml'."; assert grpCatSplitMenu != null : "fx:id=\"grpCatSplitMenu\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert grpTagSplitMenu != null : "fx:id=\"grpTagSplitMenu\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert headerToolBar != null : "fx:id=\"headerToolBar\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert segButton != null : "fx:id=\"previewList\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert slideShowToggle != null : "fx:id=\"segButton\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert tileToggle != null : "fx:id=\"tileToggle\" was not injected: check your FXML file 'GroupHeader.fxml'."; //configure flashing glow animation on next unseen group button flashAnimation.setCycleCount(Timeline.INDEFINITE); flashAnimation.setAutoReverse(true); //configure gridView cell properties gridView.cellHeightProperty().bind(Toolbar.getDefault().sizeSliderValue().add(75)); gridView.cellWidthProperty().bind(Toolbar.getDefault().sizeSliderValue().add(75)); gridView.setCellFactory((GridView<Long> param) -> new DrawableCell()); //configure toolbar properties HBox.setHgrow(spacer, Priority.ALWAYS); spacer.setMinWidth(Region.USE_PREF_SIZE); try { grpTagSplitMenu.setText(TagUtils.getFollowUpTagName().getDisplayName()); grpTagSplitMenu.setOnAction(createGrpTagMenuItem(TagUtils.getFollowUpTagName()).getOnAction()); } catch (TskCoreException tskCoreException) { LOGGER.log(Level.WARNING, "failed to load FollowUpTagName", tskCoreException); } grpTagSplitMenu.setGraphic(new ImageView(DrawableAttribute.TAGS.getIcon())); grpTagSplitMenu.showingProperty() .addListener((ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) -> { if (t1) { ArrayList<MenuItem> selTagMenues = new ArrayList<>(); for (final TagName tn : TagUtils.getNonCategoryTagNames()) { MenuItem menuItem = TagUtils.createSelTagMenuItem(tn, grpTagSplitMenu); selTagMenues.add(menuItem); } grpTagSplitMenu.getItems().setAll(selTagMenues); } }); ArrayList<MenuItem> grpCategoryMenues = new ArrayList<>(); for (final Category cat : Category.values()) { MenuItem menuItem = createGrpCatMenuItem(cat); grpCategoryMenues.add(menuItem); } grpCatSplitMenu.setText(Category.FIVE.getDisplayName()); grpCatSplitMenu.setGraphic(new ImageView(DrawableAttribute.CATEGORY.getIcon())); grpCatSplitMenu.getItems().setAll(grpCategoryMenues); grpCatSplitMenu.setOnAction(createGrpCatMenuItem(Category.FIVE).getOnAction()); Runnable syncMode = () -> { switch (groupViewMode.get()) { case SLIDE_SHOW: slideShowToggle.setSelected(true); break; case TILE: tileToggle.setSelected(true); break; } }; syncMode.run(); //make togle states match view state groupViewMode.addListener((o) -> { syncMode.run(); }); slideShowToggle.toggleGroupProperty().addListener((o) -> { slideShowToggle.getToggleGroup().selectedToggleProperty() .addListener((observable, oldToggle, newToggle) -> { if (newToggle == null) { oldToggle.setSelected(true); } }); }); //listen to toggles and update view state slideShowToggle.setOnAction((ActionEvent t) -> { activateSlideShowViewer(globalSelectionModel.lastSelectedProperty().get()); }); tileToggle.setOnAction((ActionEvent t) -> { activateTileViewer(); }); controller.viewState().addListener((ObservableValue<? extends GroupViewState> observable, GroupViewState oldValue, GroupViewState newValue) -> { setViewState(newValue); }); addEventFilter(KeyEvent.KEY_PRESSED, tileKeyboardNavigationHandler); gridView.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() { private ContextMenu buildContextMenu() { ArrayList<MenuItem> menuItems = new ArrayList<>(); menuItems.add(CategorizeAction.getPopupMenu()); menuItems.add(AddDrawableTagAction.getInstance().getPopupMenu()); Collection<? extends ContextMenuActionsProvider> menuProviders = Lookup.getDefault() .lookupAll(ContextMenuActionsProvider.class); for (ContextMenuActionsProvider provider : menuProviders) { for (final Action act : provider.getActions()) { if (act instanceof Presenter.Popup) { Presenter.Popup aact = (Presenter.Popup) act; menuItems.add(SwingMenuItemAdapter.create(aact.getPopupPresenter())); } } } final MenuItem extractMenuItem = new MenuItem("Extract File(s)"); extractMenuItem.setOnAction((ActionEvent t) -> { SwingUtilities.invokeLater(() -> { TopComponent etc = WindowManager.getDefault() .findTopComponent(ImageGalleryTopComponent.PREFERRED_ID); ExtractAction.getInstance().actionPerformed(new java.awt.event.ActionEvent(etc, 0, null)); }); }); menuItems.add(extractMenuItem); ContextMenu contextMenu = new ContextMenu(menuItems.toArray(new MenuItem[] {})); contextMenu.setAutoHide(true); return contextMenu; } @Override public void handle(MouseEvent t) { switch (t.getButton()) { case PRIMARY: if (t.getClickCount() == 1) { globalSelectionModel.clearSelection(); if (contextMenu != null) { contextMenu.hide(); } } t.consume(); break; case SECONDARY: if (t.getClickCount() == 1) { selectAllFiles(); } if (globalSelectionModel.getSelected().isEmpty() == false) { if (contextMenu == null) { contextMenu = buildContextMenu(); } contextMenu.hide(); contextMenu.show(GroupPane.this, t.getScreenX(), t.getScreenY()); } t.consume(); break; } } }); ActionUtils.configureButton(nextGroupAction, nextButton); final EventHandler<ActionEvent> onAction = nextButton.getOnAction(); nextButton.setOnAction((ActionEvent event) -> { flashAnimation.stop(); nextButton.setEffect(null); onAction.handle(event); }); ActionUtils.configureButton(forwardAction, forwardButton); ActionUtils.configureButton(backAction, backButton); nextGroupAction.disabledProperty().addListener( (ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> { nextButton.setEffect(newValue ? null : DROP_SHADOW); if (newValue == false) { flashAnimation.play(); } else { flashAnimation.stop(); } }); //listen to tile selection and make sure it is visible in scroll area //TODO: make sure we are testing complete visability not just bounds intersection globalSelectionModel.lastSelectedProperty().addListener((observable, oldFileID, newFileId) -> { if (groupViewMode.get() == GroupViewMode.SLIDE_SHOW) { slideShowPane.setFile(newFileId); } else { scrollToFileID(newFileId); } }); setViewState(controller.viewState().get()); }
From source file:org.sleuthkit.autopsy.timeline.ui.detailview.AggregateEventNode.java
public AggregateEventNode(final AggregateEvent event, AggregateEventNode parentEventNode, EventDetailChart chart) {/*w ww. j a va 2s .c o m*/ this.event = event; descLOD.set(event.getLOD()); this.parentEventNode = parentEventNode; this.chart = chart; final Region region = new Region(); HBox.setHgrow(region, Priority.ALWAYS); final HBox hBox = new HBox(descrLabel, countLabel, region, minusButton, plusButton); hBox.setPrefWidth(USE_COMPUTED_SIZE); hBox.setMinWidth(USE_PREF_SIZE); hBox.setPadding(new Insets(2, 5, 2, 5)); hBox.setAlignment(Pos.CENTER_LEFT); minusButton.setVisible(false); plusButton.setVisible(false); minusButton.setManaged(false); plusButton.setManaged(false); final BorderPane borderPane = new BorderPane(subNodePane, hBox, null, null, null); BorderPane.setAlignment(subNodePane, Pos.TOP_LEFT); borderPane.setPrefWidth(USE_COMPUTED_SIZE); getChildren().addAll(spanRegion, borderPane); setAlignment(Pos.TOP_LEFT); setMinHeight(24); minWidthProperty().bind(spanRegion.widthProperty()); setPrefHeight(USE_COMPUTED_SIZE); setMaxHeight(USE_PREF_SIZE); //set up subnode pane sizing contraints subNodePane.setPrefHeight(USE_COMPUTED_SIZE); subNodePane.setMinHeight(USE_PREF_SIZE); subNodePane.setMinWidth(USE_PREF_SIZE); subNodePane.setMaxHeight(USE_PREF_SIZE); subNodePane.setMaxWidth(USE_PREF_SIZE); subNodePane.setPickOnBounds(false); //setup description label eventTypeImageView.setImage(event.getType().getFXImage()); descrLabel.setGraphic(eventTypeImageView); descrLabel.setPrefWidth(USE_COMPUTED_SIZE); descrLabel.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS); descrLabel.setMouseTransparent(true); setDescriptionVisibility(chart.getDescrVisibility().get()); //setup backgrounds final Color evtColor = event.getType().getColor(); spanFill = new Background( new BackgroundFill(evtColor.deriveColor(0, 1, 1, .1), CORNER_RADII, Insets.EMPTY)); setBackground( new Background(new BackgroundFill(evtColor.deriveColor(0, 1, 1, .1), CORNER_RADII, Insets.EMPTY))); setCursor(Cursor.HAND); spanRegion.setStyle("-fx-border-width:2 0 2 2; -fx-border-radius: 2; -fx-border-color: " + ColorUtilities.getRGBCode(evtColor) + ";"); // NON-NLS spanRegion.setBackground(spanFill); //set up mouse hover effect and tooltip setOnMouseEntered((MouseEvent e) -> { //defer tooltip creation till needed, this had a surprisingly large impact on speed of loading the chart installTooltip(); spanRegion.setEffect(new DropShadow(10, evtColor)); minusButton.setVisible(true); plusButton.setVisible(true); minusButton.setManaged(true); plusButton.setManaged(true); toFront(); }); setOnMouseExited((MouseEvent e) -> { spanRegion.setEffect(null); minusButton.setVisible(false); plusButton.setVisible(false); minusButton.setManaged(false); plusButton.setManaged(false); }); setOnMouseClicked(new EventMouseHandler()); plusButton.disableProperty().bind(descLOD.isEqualTo(DescriptionLOD.FULL)); minusButton.disableProperty().bind(descLOD.isEqualTo(event.getLOD())); plusButton.setOnMouseClicked(e -> { final DescriptionLOD next = descLOD.get().next(); if (next != null) { loadSubClusters(next); descLOD.set(next); } }); minusButton.setOnMouseClicked(e -> { final DescriptionLOD previous = descLOD.get().previous(); if (previous != null) { loadSubClusters(previous); descLOD.set(previous); } }); }
From source file:poe.trade.assist.Main.java
@Override public void start(Stage stage) { // try { // fh = new FileHandler("D:\\MxDownload\\POE\\poe.trade.assist\\assist.log"); // } catch (IOException e) { // e.printStackTrace(); // }/*from w w w . java 2 s. c o m*/ // logger.addHandler(fh); // SimpleFormatter formatter = new SimpleFormatter(); // fh.setFormatter(formatter); // logger.info("Init application."); BorderPane root = new BorderPane(); config = Config.load(); config.get(Config.SEARCH_FILE).ifPresent(searchFileTextField::setText); searchFileTextField.setPromptText("Search CSV File URL or blank"); searchFileTextField.setTooltip(new Tooltip( "Any url to a valid poe.trade.assist CSV search file. Can be googlespreadsheet URL. If left blank, will load search.csv file instead")); searchFileTextField.setMinWidth(330); HBox.setHgrow(searchFileTextField, Priority.ALWAYS); List<Search> searchList = loadSearchListFromFile(); AutoSearchService autoSearchService = new AutoSearchService( Boolean.parseBoolean(config.get(Config.AUTO_ENABLE).get()), Float.parseFloat(config.get(Config.SEARCH_MINUTES).get())); searchPane = new SearchPane(searchList); resultPane = new ResultPane(searchFileTextField, this); autoSearchService.searchesProperty().bind(searchPane.dataProperty()); EventHandler<ActionEvent> reloadAction = e -> { System.out.println("Loading search file: " + searchFileTextField.getText()); List<Search> newList = loadSearchListFromFile(); searchPane.dataProperty().clear(); searchPane.dataProperty().addAll(newList); autoSearchService.restart(); if (searchPane.dataProperty().size() > 0) searchPane.searchTable.getSelectionModel().select(0); }; searchFileTextField.setOnAction(reloadAction); resultPane.loadButton.setOnAction(reloadAction); resultPane.defaultButton.setOnAction(e -> { searchFileTextField.setText(DEFAULT_SEARCH_CSV_FILE); resultPane.loadButton.fire(); }); resultPane.runNowButton.setOnAction(e -> autoSearchService.restart()); // autoSearchService.minsToSleepProperty().bind(resultPane.noOfMinsTextField.textProperty()); setupResultPaneBinding(searchPane, resultPane, autoSearchService); if (searchList.size() > 0) searchPane.searchTable.getSelectionModel().select(0); stage.setOnCloseRequest(we -> { saveSearchList(searchPane); config.setProperty(Config.SEARCH_FILE, searchFileTextField.getText()); config.setProperty(Config.SOUND_FILE, resultPane.soundButton.getUserData().toString()); config.save(); }); config.get(Config.SOUND_FILE).ifPresent(resultPane.soundButton::setUserData); autoSearchService.restart(); // HBox container = new HBox(5, searchPane, resultPane); SplitPane container = new SplitPane(searchPane, resultPane); container.setDividerPositions(0.1); HBox.setHgrow(searchPane, Priority.ALWAYS); HBox.setHgrow(resultPane, Priority.ALWAYS); container.setMaxWidth(Double.MAX_VALUE); // root.getChildren().addAll(container); root.setCenter(container); Scene scene = new Scene(root); stage.getIcons().add(new Image("/48px-Durian.png")); stage.titleProperty().bind(new SimpleStringProperty("poe.trade.assist v5 (Durian) - ") .concat(autoSearchService.messageProperty())); // stage.setWidth(1200); // stage.setHeight(550); stage.setMaximized(true); stage.setScene(scene); stage.show(); searchPane.searchTable.requestFocus(); }