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

The following examples show how to use javafx.scene.layout.HBox#setVisible() . 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: EditStatus.java    From helloiot with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Node constructContent() {
    
    StackPane stackpaneroot = new StackPane();
    
    boxview = new HBox();
    boxview.setSpacing(6.0);
    
    statusview = new TextField();
    statusview.setEditable(false);
    statusview.setFocusTraversable(false);
    statusview.getStyleClass().add("unitinputview");
    HBox.setHgrow(statusview, Priority.SOMETIMES);
    
    editaction = new Button();
    editaction.setFocusTraversable(false);
    editaction.setMnemonicParsing(false);
    editaction.getStyleClass().add("unitbutton");
    editaction.setOnAction(this::onEditEvent);
    
    boxview.getChildren().addAll(statusview, editaction);
    
    boxedit = new HBox();
    boxedit.setSpacing(6.0);
    boxedit.setVisible(false);
    
    statusedit = new TextField();
    statusedit.getStyleClass().add("unitinput");
    HBox.setHgrow(statusedit, Priority.SOMETIMES);
    ((TextField) statusedit).setOnAction(this::onEnterEvent);
    
    okaction = new Button();
    okaction.setFocusTraversable(false);
    okaction.setMnemonicParsing(false);
    okaction.getStyleClass().add("unitbutton");
    okaction.setOnAction(this::onOkEvent);
    
    cancelaction = new Button();
    cancelaction.setFocusTraversable(false);
    cancelaction.setMnemonicParsing(false);
    cancelaction.getStyleClass().add("unitbutton");
    cancelaction.setOnAction(this::onCancelEvent);
    
    boxedit.getChildren().addAll(statusedit, okaction, cancelaction);
    
    stackpaneroot.getChildren().addAll(boxview, boxedit);

    initialize();
    return stackpaneroot;
}
 
Example 2
Source File: EditAreaStatus.java    From helloiot with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Node constructContent() {
    StackPane stackpaneroot = new StackPane();
    
    boxview = new HBox();
    boxview.setSpacing(6.0);
    
    statusview = new TextArea();
    statusview.setEditable(false);
    statusview.setFocusTraversable(false);
    statusview.setMaxSize(Double.MAX_VALUE,Double.MAX_VALUE);
    statusview.setPrefHeight(100.0);
    statusview.getStyleClass().add("unitinputview");
    HBox.setHgrow(statusview, Priority.SOMETIMES);
    
    editaction = new Button();
    editaction.setFocusTraversable(false);
    editaction.setMnemonicParsing(false);
    editaction.getStyleClass().add("unitbutton");
    editaction.setOnAction(this::onEditEvent);
    
    boxview.getChildren().addAll(statusview, editaction);
    
    boxedit = new HBox();
    boxedit.setSpacing(6.0);
    boxedit.setVisible(false);
    
    statusedit = new TextArea();
    statusedit.setMaxSize(Double.MAX_VALUE,Double.MAX_VALUE);
    statusedit.setPrefHeight(100.0);        
    statusedit.getStyleClass().add("unitinputarea");
    HBox.setHgrow(statusedit, Priority.SOMETIMES);
    
    okaction = new Button();
    okaction.setFocusTraversable(false);
    okaction.setMnemonicParsing(false);
    okaction.getStyleClass().add("unitbutton");
    okaction.setOnAction(this::onOkEvent);
    
    cancelaction = new Button();
    cancelaction.setFocusTraversable(false);
    cancelaction.setMnemonicParsing(false);
    cancelaction.getStyleClass().add("unitbutton");
    cancelaction.setOnAction(this::onCancelEvent);
    
    boxedit.getChildren().addAll(statusedit, okaction, cancelaction);
    
    stackpaneroot.getChildren().addAll(boxview, boxedit);

    initialize();
    return stackpaneroot;
}
 
Example 3
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 4
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);        
}