Java Code Examples for javafx.css.PseudoClass#getPseudoClass()
The following examples show how to use
javafx.css.PseudoClass#getPseudoClass() .
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: TabTest.java From WorkbenchFX with Apache License 2.0 | 6 votes |
@Test void testActiveTabListener() { PseudoClass selected = PseudoClass.getPseudoClass("selected"); assertFalse(tab.isActiveTab()); assertFalse(tab.getPseudoClassStates().contains(selected)); // change it to be the active module tab activeModule.set(mockModules[0]); assertTrue(tab.isActiveTab()); assertTrue(tab.getPseudoClassStates().contains(selected)); // change the module displayed by this tab, should not be the active tab now tab.setModule(mockModules[1]); assertFalse(tab.isActiveTab()); assertFalse(tab.getPseudoClassStates().contains(selected)); // changing the active module tab now should make it active again activeModule.set(mockModules[1]); assertTrue(tab.isActiveTab()); assertTrue(tab.getPseudoClassStates().contains(selected)); verify(mockBench, atLeastOnce()).activeModuleProperty(); }
Example 2
Source File: FileTreeTable.java From Lipi with MIT License | 6 votes |
private void prepare() { buildFileBrowserTreeTableView(treeTableView); final PseudoClass firstRowClass = PseudoClass.getPseudoClass("first-row"); treeTableView.setRowFactory(treeTable -> { TreeTableRow<File> row = new TreeTableRow<File>(); row.treeItemProperty().addListener((ov, oldTreeItem, newTreeItem) -> row.pseudoClassStateChanged(firstRowClass, newTreeItem == treeTable.getRoot())); row.setContextMenu(rightClickContextMenu); return row; }); treeTableView.setOnMouseClicked( new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if (mouseEvent.getClickCount() == 2) { openSelectedTreeitemInHmdEditor(); } } }); // this.getChildren().add(treeTableView); }
Example 3
Source File: VolumePopupController.java From MusicPlayer with MIT License | 5 votes |
@FXML private void muteClick() { PseudoClass muted = PseudoClass.getPseudoClass("muted"); boolean isMuted = mutedButton.isVisible(); muteButton.setVisible(isMuted); mutedButton.setVisible(!isMuted); volumeSlider.pseudoClassStateChanged(muted, !isMuted); frontVolumeTrack.pseudoClassStateChanged(muted, !isMuted); volumeLabel.pseudoClassStateChanged(muted, !isMuted); MusicPlayer.mute(isMuted); }
Example 4
Source File: NodeHelper.java From tornadofx-controls with Apache License 2.0 | 4 votes |
public static void addPseudoClass( Node node, String className ){ PseudoClass pseudoClass = PseudoClass.getPseudoClass( className ); node.pseudoClassStateChanged( pseudoClass, true ); }
Example 5
Source File: EditionPresenter.java From gluon-samples with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void initialize() { edition.setShowTransitionFactory(BounceInRightTransition::new); PseudoClass pseudoClassDisable = PseudoClass.getPseudoClass("disabled"); edition.showingProperty().addListener((obs, oldValue, newValue) -> { if (newValue) { submit.disableProperty().unbind(); Comment activeComment = service.activeCommentProperty().get(); if (activeComment != null) { // disable avatar in case comment is not editable // content is enabled if user is its author commentsText.setDisable(!activeComment.getNetworkId().equals(service.getUser().getNetworkId())); avatar.pseudoClassStateChanged(pseudoClassDisable, commentsText.isDisable()); avatar.setImage(Service.getUserImage(activeComment.getImageUrl())); authorText.setText(activeComment.getAuthor()); commentsText.setText(activeComment.getContent()); submit.setText("Apply"); submit.disableProperty().bind(Bindings.createBooleanBinding(()->{ return authorText.textProperty() .isEqualTo(activeComment.getAuthor()) .and(commentsText.textProperty() .isEqualTo(activeComment.getContent())).get(); }, authorText.textProperty(),commentsText.textProperty())); editMode = true; } else { commentsText.setDisable(false); avatar.pseudoClassStateChanged(pseudoClassDisable, false); avatar.setImage(Service.getUserImage(service.getUser().getPicture())); authorText.setText(service.getUser().getName()); submit.setText("Submit"); submit.disableProperty().bind(Bindings.createBooleanBinding(() -> { return authorText.textProperty() .isEmpty() .or(commentsText.textProperty() .isEmpty()).get(); }, authorText.textProperty(), commentsText.textProperty())); editMode = false; } authorText.setDisable(!authorText.getText().isEmpty()); AppBar appBar = getApp().getAppBar(); appBar.setNavIcon(MaterialDesignIcon.MENU.button(e -> getApp().getDrawer().open())); appBar.setTitleText("Edition"); } else { authorText.clear(); commentsText.clear(); } }); Services.get(DisplayService.class) .ifPresent(d -> { if (d.isTablet()) { avatar.getStyleClass().add("tablet"); } }); avatar.setImage(Service.getUserImage(service.getUser().getPicture())); }
Example 6
Source File: DbgTraceView.java From erlyberly with GNU General Public License v3.0 | 4 votes |
@SuppressWarnings({ "unchecked", "rawtypes" }) private void putTableColumns() { TableColumn<TraceLog,Long> seqColumn; seqColumn = new TableColumn<TraceLog,Long>("Seq."); seqColumn.setCellValueFactory(new PropertyValueFactory("instanceNum")); configureColumnWidth("seqColumnWidth", seqColumn); TableColumn<TraceLog,String> pidColumn; pidColumn = new TableColumn<TraceLog,String>("Pid"); pidColumn.setCellValueFactory(new PropertyValueFactory("pidString")); configureColumnWidth("pidColumnWidth", pidColumn); TableColumn<TraceLog,String> regNameColumn; regNameColumn = new TableColumn<TraceLog,String>("Reg. Name"); regNameColumn.setCellValueFactory(new PropertyValueFactory("regName")); configureColumnWidth("regNameColumnWidth", regNameColumn); TableColumn<TraceLog,String> durationNameColumn; durationNameColumn = new TableColumn<TraceLog,String>("Duration (microseconds)"); durationNameColumn.setCellValueFactory(new PropertyValueFactory("duration")); configureColumnWidth("durationNameColumnWidth", durationNameColumn); TableColumn<TraceLog,String> functionNameColumn; functionNameColumn = new TableColumn<TraceLog,String>("Function"); functionNameColumn.setCellValueFactory(new PropertyValueFactory("function")); configureColumnWidth("functionNameColumnWidth", functionNameColumn); TableColumn<TraceLog,String> argsColumn; argsColumn = new TableColumn<TraceLog,String>("Args"); argsColumn.setCellValueFactory(new PropertyValueFactory("args")); configureColumnWidth("argsColumnWidth", argsColumn); TableColumn<TraceLog,String> resultColumn; resultColumn = new TableColumn<TraceLog,String>("Result"); resultColumn.setCellValueFactory(new PropertyValueFactory("result")); configureColumnWidth("resultColumnWidth", resultColumn); tracesBox.getColumns().setAll( seqColumn, pidColumn, regNameColumn, durationNameColumn, functionNameColumn, argsColumn, resultColumn ); // based on http://stackoverflow.com/questions/27015961/tableview-row-style PseudoClass exceptionClass = PseudoClass.getPseudoClass("exception"); PseudoClass notCompletedClass = PseudoClass.getPseudoClass("not-completed"); PseudoClass breakerRowClass = PseudoClass.getPseudoClass("breaker-row"); tracesBox.setRowFactory(tv -> { TableRow<TraceLog> row = new TableRow<>(); ChangeListener<Boolean> completeListener = (obs, oldComplete, newComplete) -> { row.pseudoClassStateChanged(exceptionClass, row.getItem().isExceptionThrower()); row.pseudoClassStateChanged(notCompletedClass, !row.getItem().isComplete()); }; row.itemProperty().addListener((obs, oldTl, tl) -> { if (oldTl != null) { oldTl.isCompleteProperty().removeListener(completeListener); } if (tl != null) { row.pseudoClassStateChanged(notCompletedClass, !row.getItem().isComplete()); if("breaker-row".equals(tl.getCssClass())) { row.pseudoClassStateChanged(breakerRowClass, true); row.pseudoClassStateChanged(exceptionClass, false); row.pseudoClassStateChanged(notCompletedClass, false); } else { tl.isCompleteProperty().addListener(completeListener); row.pseudoClassStateChanged(breakerRowClass, false); row.pseudoClassStateChanged(exceptionClass, tl.isExceptionThrower()); } } else { row.pseudoClassStateChanged(exceptionClass, false); row.pseudoClassStateChanged(notCompletedClass, false); row.pseudoClassStateChanged(breakerRowClass, false); } }); return row ; }); }