Java Code Examples for javafx.scene.layout.HBox#setManaged()

The following examples show how to use javafx.scene.layout.HBox#setManaged() . 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: SlideButtonRepresentation.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public HBox createJFXNode ( ) throws Exception {

    button = new ToggleSwitch();

    button.setMinSize(37, 20);
    button.setPrefSize(37, 20);
    button.setGraphicTextGap(0);
    button.setMnemonicParsing(false);

    if (! toolkit.isEditMode() )
        button.addEventFilter(MouseEvent.MOUSE_RELEASED, event ->
        {
            // To avoid setting a new value when context menu is requested,
            // slide only if primary button was pressed.
            if(event.getButton().equals(MouseButton.PRIMARY)) {
                handleSlide();
            }
            event.consume();
        });

    label = new Label(labelContent);

    label.setMaxWidth(Double.MAX_VALUE);
    label.setMnemonicParsing(false);
    HBox.setHgrow(label, Priority.ALWAYS);

    HBox hbox = new HBox(6, button, label);

    hbox.setAlignment(Pos.CENTER_RIGHT);

    // This code manages layout,
    // because otherwise for example border changes would trigger
    // expensive Node.notifyParentOfBoundsChange() recursing up the scene graph
    hbox.setManaged(false);

    return hbox;
}
 
Example 2
Source File: DisputeView.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void initialize() {
    Label label = new AutoTooltipLabel(Res.get("support.filter"));
    HBox.setMargin(label, new Insets(5, 0, 0, 0));
    filterTextField = new InputTextField();
    filterTextField.setText("open");
    filterTextFieldListener = (observable, oldValue, newValue) -> applyFilteredListPredicate(filterTextField.getText());

    filterBox = new HBox();
    filterBox.setSpacing(5);
    filterBox.getChildren().addAll(label, filterTextField);
    VBox.setVgrow(filterBox, Priority.NEVER);
    filterBox.setVisible(false);
    filterBox.setManaged(false);

    tableView = new TableView<>();
    VBox.setVgrow(tableView, Priority.SOMETIMES);
    tableView.setMinHeight(150);

    root.getChildren().addAll(filterBox, tableView);

    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    Label placeholder = new AutoTooltipLabel(Res.get("support.noTickets"));
    placeholder.setWrapText(true);
    tableView.setPlaceholder(placeholder);
    tableView.getSelectionModel().clearSelection();

    tableView.getColumns().add(getSelectColumn());

    TableColumn<Dispute, Dispute> contractColumn = getContractColumn();
    tableView.getColumns().add(contractColumn);

    TableColumn<Dispute, Dispute> dateColumn = getDateColumn();
    tableView.getColumns().add(dateColumn);

    TableColumn<Dispute, Dispute> tradeIdColumn = getTradeIdColumn();
    tableView.getColumns().add(tradeIdColumn);

    TableColumn<Dispute, Dispute> buyerOnionAddressColumn = getBuyerOnionAddressColumn();
    tableView.getColumns().add(buyerOnionAddressColumn);

    TableColumn<Dispute, Dispute> sellerOnionAddressColumn = getSellerOnionAddressColumn();
    tableView.getColumns().add(sellerOnionAddressColumn);


    TableColumn<Dispute, Dispute> marketColumn = getMarketColumn();
    tableView.getColumns().add(marketColumn);

    TableColumn<Dispute, Dispute> roleColumn = getRoleColumn();
    tableView.getColumns().add(roleColumn);

    TableColumn<Dispute, Dispute> stateColumn = getStateColumn();
    tableView.getColumns().add(stateColumn);

    tradeIdColumn.setComparator(Comparator.comparing(Dispute::getTradeId));
    dateColumn.setComparator(Comparator.comparing(Dispute::getOpeningDate));
    buyerOnionAddressColumn.setComparator(Comparator.comparing(this::getBuyerOnionAddressColumnLabel));
    sellerOnionAddressColumn.setComparator(Comparator.comparing(this::getSellerOnionAddressColumnLabel));
    marketColumn.setComparator((o1, o2) -> CurrencyUtil.getCurrencyPair(o1.getContract().getOfferPayload().getCurrencyCode()).compareTo(o2.getContract().getOfferPayload().getCurrencyCode()));

    dateColumn.setSortType(TableColumn.SortType.DESCENDING);
    tableView.getSortOrder().add(dateColumn);

    selectedDisputeClosedPropertyListener = (observable, oldValue, newValue) -> chatView.setInputBoxVisible(!newValue);

    keyEventEventHandler = event -> {
        if (Utilities.isAltOrCtrlPressed(KeyCode.L, event)) {
            showFullReport();
        } else if (Utilities.isAltOrCtrlPressed(KeyCode.K, event)) {
            showCompactReport();
        } else if (Utilities.isAltOrCtrlPressed(KeyCode.U, event)) {
            // Hidden shortcut to re-open a dispute. Allow it also for traders not only arbitrator.
            if (selectedDispute != null) {
                if (selectedDisputeClosedPropertyListener != null)
                    selectedDispute.isClosedProperty().removeListener(selectedDisputeClosedPropertyListener);
                selectedDispute.setIsClosed(false);
            }
        } else if (Utilities.isAltOrCtrlPressed(KeyCode.R, event)) {
            if (selectedDispute != null) {
                PubKeyRing pubKeyRing = selectedDispute.getTraderPubKeyRing();
                NodeAddress nodeAddress;
                if (pubKeyRing.equals(selectedDispute.getContract().getBuyerPubKeyRing()))
                    nodeAddress = selectedDispute.getContract().getBuyerNodeAddress();
                else
                    nodeAddress = selectedDispute.getContract().getSellerNodeAddress();

                new SendPrivateNotificationWindow(
                        privateNotificationManager,
                        pubKeyRing,
                        nodeAddress,
                        useDevPrivilegeKeys
                ).show();
            }
        } else {
            handleKeyPressed(event);
        }
    };

    chatView = new ChatView(disputeManager, formatter);
    chatView.initialize();
}
 
Example 3
Source File: VuMeterSkin.java    From Enzo with Apache License 2.0 4 votes vote down vote up
private void initGraphics() {                
    hBox = new HBox();        
    hBox.getStyleClass().setAll("vu-meter");
    hBox.setSpacing(getSkinnable().getLedSpacing());        
    
    vBox = new VBox();
    vBox.getStyleClass().setAll("vu-meter");
    vBox.setSpacing(getSkinnable().getLedSpacing());        

    leds = FXCollections.observableArrayList();
    for (int i = 0 ; i < getSkinnable().getNoOfLeds() ; i++) {
        Region led = new Region();                    
        led.setOnMouseClicked(new WeakEventHandler<>(event -> active = !active));
        led.setOnMouseEntered(new WeakEventHandler<>(event -> handleMouseEvent(event)));                                    
        if (getSkinnable().getSections().isEmpty()) {
            led.getStyleClass().setAll("led");
        } else {                
            for (Section section : getSkinnable().getSections()) {
                if (section.contains(i * stepSize.doubleValue())) {
                    led.getStyleClass().setAll("led", section.getStyleClass());
                }
            }                
        }            
        leds.add(led);
    }
    
    if (Orientation.HORIZONTAL == getSkinnable().getOrientation()) {
        vBox.setManaged(false);            
        vBox.setVisible(false);
        hBox.getChildren().setAll(leds);
        peakLedIndex = 0;
    } else {
        hBox.setManaged(false);
        hBox.setVisible(false); 
        FXCollections.reverse(leds);
        vBox.getChildren().setAll(leds);
        peakLedIndex = leds.size() - 1;
    }
                                    
    // Add all nodes
    getChildren().setAll(hBox, vBox);        
}