Search in sources :

Example 31 with AnchorPane

use of javafx.scene.layout.AnchorPane in project trex-stateless-gui by cisco-system-traffic-generator.

the class EthernetProtocolView method buildCustomProtocolView.

/**
 * Build custom view
 */
@Override
protected void buildCustomProtocolView() {
    AnchorPane container = new AnchorPane();
    type = new CheckBox("Ethernet Type");
    addCheckBox(type, 20, 10);
    typeField = new TextField();
    addInput(typeField, 20, 165, 220);
    typeField.disableProperty().bind(type.selectedProperty().not());
    setContent(container);
}
Also used : CheckBox(javafx.scene.control.CheckBox) TextField(javafx.scene.control.TextField) AnchorPane(javafx.scene.layout.AnchorPane)

Example 32 with AnchorPane

use of javafx.scene.layout.AnchorPane in project trex-stateless-gui by cisco-system-traffic-generator.

the class MultiplierView method buildUI.

/**
 * Build UI
 */
private void buildUI() {
    // add slider area
    addLabel("Bandwidth", 7, 336);
    addLabel("0", 22, 287);
    addLabel("100", 22, 454);
    slider = new Slider(0, 100, 1);
    slider.setDisable(true);
    getChildren().add(slider);
    MultiplierView.setTopAnchor(slider, 22d);
    MultiplierView.setLeftAnchor(slider, 304d);
    slider.valueProperty().addListener(new ChangeListener<Number>() {

        @Override
        public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
            // check min value for slider
            if ((double) newValue < MultiplierType.percentage.getMinRate(rate)) {
                slider.setValue(MultiplierType.percentage.getMinRate(rate));
            }
            updateOptionsValues(slider.getValue(), updateAll);
            if (fireUpdateCommand) {
                optionValueChangeHandler.optionValueChanged();
            }
        }
    });
    // add separator
    Separator separator = new Separator(Orientation.HORIZONTAL);
    separator.setPrefHeight(1);
    getChildren().add(separator);
    MultiplierView.setTopAnchor(separator, 50d);
    MultiplierView.setLeftAnchor(separator, 15d);
    MultiplierView.setRightAnchor(separator, 15d);
    group = new ToggleGroup();
    int index = 0;
    double prevComponentWidth = 0;
    AnchorPane optionContainer = new AnchorPane();
    getChildren().add(optionContainer);
    MultiplierView.setTopAnchor(optionContainer, 51d);
    MultiplierView.setLeftAnchor(optionContainer, 15d);
    MultiplierView.setRightAnchor(optionContainer, 150d);
    for (MultiplierType type : MultiplierType.values()) {
        MultiplierOption option = new MultiplierOption(type.getTitle(), group, type, this);
        option.setMultiplierSelectionEvent(this);
        optionContainer.getChildren().add(option);
        double leftSpace = prevComponentWidth + (index * 15);
        MultiplierView.setLeftAnchor(option, leftSpace);
        MultiplierView.setTopAnchor(option, 0d);
        MultiplierView.setBottomAnchor(option, 0d);
        multiplierOptionMap.put(type, option);
        index++;
        prevComponentWidth += option.getComponentWidth();
    }
    multiplierOptionMap.get(MultiplierType.pps).setSelected();
    // add suration
    Separator vSeparator = new Separator(Orientation.VERTICAL);
    vSeparator.setPrefWidth(1);
    getChildren().add(vSeparator);
    MultiplierView.setTopAnchor(vSeparator, 93d);
    MultiplierView.setLeftAnchor(vSeparator, 560d);
    MultiplierView.setBottomAnchor(vSeparator, 15d);
    addLabel("Duration", 70, 606);
    durationCB = new CheckBox();
    getChildren().add(durationCB);
    MultiplierView.setTopAnchor(durationCB, 94d);
    MultiplierView.setLeftAnchor(durationCB, 581d);
    MultiplierView.setBottomAnchor(durationCB, 20d);
    durationTF = new TextField("0");
    durationTF.setPrefSize(70, 22);
    durationTF.setDisable(true);
    getChildren().add(durationTF);
    MultiplierView.setTopAnchor(durationTF, 93d);
    MultiplierView.setLeftAnchor(durationTF, 606d);
    MultiplierView.setBottomAnchor(durationTF, 15d);
    durationTF.disableProperty().bind(durationCB.selectedProperty().not());
    durationTF.setTextFormatter(Util.getNumberFilter(4));
}
Also used : MultiplierOption(com.exalttech.trex.ui.components.MultiplierOption) MultiplierType(com.exalttech.trex.ui.MultiplierType) AnchorPane(javafx.scene.layout.AnchorPane)

Example 33 with AnchorPane

use of javafx.scene.layout.AnchorPane in project POL-POM-5 by PlayOnLinux.

the class SearchBoxSkin method initialise.

/**
 * {@inheritDoc}
 */
@Override
public void initialise() {
    AnchorPane container = new AnchorPane();
    container.getStyleClass().add("searchBox");
    this.searchField = createTextField(container);
    this.clearButton = createClearButton();
    container.getChildren().addAll(searchField, clearButton);
    getChildren().addAll(container);
}
Also used : AnchorPane(javafx.scene.layout.AnchorPane)

Example 34 with AnchorPane

use of javafx.scene.layout.AnchorPane in project sakuli by ConSol.

the class UiTestApplication method getFxmlScene.

private Scene getFxmlScene(String fxml, Map<UiTestEvent, Map<EventType<? extends Event>, EventHandler<? super Event>>> controllerEvents) throws IOException {
    URL resourceURl = getClass().getResource(fxml);
    FXMLLoader loader = new FXMLLoader(resourceURl);
    // load defined page
    AnchorPane page = (AnchorPane) loader.load();
    // add page to stage
    Scene scene = new Scene(page, 800, 600);
    if (stage != null) {
        stage.setScene(scene);
        stage.sizeToScene();
    }
    // return the corresponding controller
    ((AbstractUiTestPane) loader.getController()).setApp(this, controllerEvents);
    return scene;
}
Also used : Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader) AnchorPane(javafx.scene.layout.AnchorPane) URL(java.net.URL)

Example 35 with AnchorPane

use of javafx.scene.layout.AnchorPane in project bitsquare by bitsquare.

the class MainView method initialize.

@Override
protected void initialize() {
    MainView.rootContainer = this.root;
    ToggleButton marketButton = new NavButton(MarketView.class, "Market");
    ToggleButton buyButton = new NavButton(BuyOfferView.class, "Buy BTC");
    ToggleButton sellButton = new NavButton(SellOfferView.class, "Sell BTC");
    ToggleButton portfolioButton = new NavButton(PortfolioView.class, "Portfolio");
    ToggleButton fundsButton = new NavButton(FundsView.class, "Funds");
    ToggleButton disputesButton = new NavButton(DisputesView.class, "Support");
    ToggleButton settingsButton = new NavButton(SettingsView.class, "Settings");
    ToggleButton accountButton = new NavButton(AccountView.class, "Account");
    Pane portfolioButtonHolder = new Pane(portfolioButton);
    Pane disputesButtonHolder = new Pane(disputesButton);
    HBox leftNavPane = new HBox(marketButton, buyButton, sellButton, portfolioButtonHolder, fundsButton, disputesButtonHolder) {

        {
            setLeftAnchor(this, 10d);
            setTopAnchor(this, 0d);
        }
    };
    Tuple3<ComboBox<PriceFeedComboBoxItem>, Label, VBox> marketPriceBox = getMarketPriceBox("Market price");
    ComboBox<PriceFeedComboBoxItem> priceComboBox = marketPriceBox.first;
    priceComboBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        model.setPriceFeedComboBoxItem(newValue);
    });
    ChangeListener<PriceFeedComboBoxItem> selectedPriceFeedItemListender = (observable, oldValue, newValue) -> {
        if (newValue != null)
            priceComboBox.getSelectionModel().select(newValue);
    };
    model.selectedPriceFeedComboBoxItemProperty.addListener(selectedPriceFeedItemListender);
    priceComboBox.setItems(model.priceFeedComboBoxItems);
    marketPriceBox.second.textProperty().bind(createStringBinding(() -> {
        PriceFeedService.Type type = model.typeProperty.get();
        return type != null ? "Market price (" + type.name + ")" : "";
    }, model.marketPriceCurrencyCode, model.typeProperty));
    HBox.setMargin(marketPriceBox.third, new Insets(0, 0, 0, 0));
    Tuple2<TextField, VBox> availableBalanceBox = getBalanceBox("Available balance");
    availableBalanceBox.first.textProperty().bind(model.availableBalance);
    Tuple2<TextField, VBox> reservedBalanceBox = getBalanceBox("Reserved in offers");
    reservedBalanceBox.first.textProperty().bind(model.reservedBalance);
    Tuple2<TextField, VBox> lockedBalanceBox = getBalanceBox("Locked in trades");
    lockedBalanceBox.first.textProperty().bind(model.lockedBalance);
    HBox rightNavPane = new HBox(marketPriceBox.third, availableBalanceBox.second, reservedBalanceBox.second, lockedBalanceBox.second, settingsButton, accountButton) {

        {
            setRightAnchor(this, 10d);
            setTopAnchor(this, 0d);
        }
    };
    root.widthProperty().addListener((observable, oldValue, newValue) -> {
        double w = (double) newValue;
        if (w > 0) {
            leftNavPane.setSpacing(w >= 1080 ? 10 : 5);
            rightNavPane.setSpacing(w >= 1080 ? 10 : 5);
        }
    });
    AnchorPane contentContainer = new AnchorPane() {

        {
            setId("content-pane");
            setLeftAnchor(this, 0d);
            setRightAnchor(this, 0d);
            setTopAnchor(this, 60d);
            setBottomAnchor(this, 10d);
        }
    };
    AnchorPane applicationContainer = new AnchorPane(leftNavPane, rightNavPane, contentContainer) {

        {
            setId("content-pane");
        }
    };
    BorderPane baseApplicationContainer = new BorderPane(applicationContainer) {

        {
            setId("base-content-container");
        }
    };
    baseApplicationContainer.setBottom(createFooter());
    setupNotificationIcon(portfolioButtonHolder);
    setupDisputesIcon(disputesButtonHolder);
    navigation.addListener(viewPath -> {
        if (viewPath.size() != 2 || viewPath.indexOf(MainView.class) != 0)
            return;
        Class<? extends View> viewClass = viewPath.tip();
        View view = viewLoader.load(viewClass);
        contentContainer.getChildren().setAll(view.getRoot());
        navButtons.getToggles().stream().filter(toggle -> toggle instanceof NavButton).filter(button -> viewClass == ((NavButton) button).viewClass).findFirst().orElseThrow(() -> new BitsquareException("No button matching %s found", viewClass)).setSelected(true);
    });
    VBox splashScreen = createSplashScreen();
    root.getChildren().addAll(baseApplicationContainer, splashScreen);
    model.showAppScreen.addListener((ov, oldValue, newValue) -> {
        if (newValue) {
            navigation.navigateToPreviousVisitedView();
            if (!persistedFilesCorrupted.isEmpty()) {
                if (persistedFilesCorrupted.size() > 1 || !persistedFilesCorrupted.get(0).equals("Navigation")) {
                    // show warning that some files has been corrupted
                    new Popup().warning("We detected incompatible data base files!\n\n" + "Those database file(s) are not compatible with our current code base:" + "\n" + persistedFilesCorrupted.toString() + "\n\nWe made a backup of the corrupted file(s) and applied the default values to a new " + "database version." + "\n\nThe backup is located at:\n[you local app data directory]/db/backup_of_corrupted_data.\n\n" + "Please check if you have the latest version of Bitsquare installed.\n" + "You can download it at:\nhttps://github.com/bitsquare/bitsquare/releases\n\n" + "Please restart the application.").closeButtonText("Shut down").onClose(BitsquareApp.shutDownHandler::run).show();
                } else {
                    log.debug("We detected incompatible data base file for Navigation. That is a minor issue happening with refactoring of UI classes " + "and we don't display a warning popup to the user.");
                }
            }
            transitions.fadeOutAndRemove(splashScreen, 1500, actionEvent -> disposeSplashScreen());
        }
    });
    // Delay a bit to give time for rendering the splash screen
    UserThread.execute(model::start);
}
Also used : Pos(javafx.geometry.Pos) PriceFeedService(io.bitsquare.btc.pricefeed.PriceFeedService) Popup(io.bitsquare.gui.main.overlays.popups.Popup) MarketView(io.bitsquare.gui.main.market.MarketView) javafx.scene.layout(javafx.scene.layout) javafx.scene.control(javafx.scene.control) LoggerFactory(org.slf4j.LoggerFactory) BitsquareApp(io.bitsquare.app.BitsquareApp) Tuple2(io.bitsquare.common.util.Tuple2) Transitions(io.bitsquare.gui.util.Transitions) FundsView(io.bitsquare.gui.main.funds.FundsView) GUIUtil(io.bitsquare.gui.util.GUIUtil) Inject(javax.inject.Inject) DevFlags(io.bitsquare.app.DevFlags) Insets(javafx.geometry.Insets) Navigation(io.bitsquare.gui.Navigation) SettingsView(io.bitsquare.gui.main.settings.SettingsView) TextAlignment(javafx.scene.text.TextAlignment) Named(javax.inject.Named) BSFormatter(io.bitsquare.gui.util.BSFormatter) Color(javafx.scene.paint.Color) Logger(org.slf4j.Logger) UserThread(io.bitsquare.common.UserThread) BuyOfferView(io.bitsquare.gui.main.offer.BuyOfferView) BitsquareException(io.bitsquare.BitsquareException) DropShadow(javafx.scene.effect.DropShadow) DisputesView(io.bitsquare.gui.main.disputes.DisputesView) io.bitsquare.gui.common.view(io.bitsquare.gui.common.view) PortfolioView(io.bitsquare.gui.main.portfolio.PortfolioView) List(java.util.List) Bindings.createStringBinding(javafx.beans.binding.Bindings.createStringBinding) Tuple3(io.bitsquare.common.util.Tuple3) AnchorPane(javafx.scene.layout.AnchorPane) ImageView(javafx.scene.image.ImageView) BusyAnimation(io.bitsquare.gui.components.BusyAnimation) SellOfferView(io.bitsquare.gui.main.offer.SellOfferView) ChangeListener(javafx.beans.value.ChangeListener) AccountView(io.bitsquare.gui.main.account.AccountView) Insets(javafx.geometry.Insets) BitsquareApp(io.bitsquare.app.BitsquareApp) Popup(io.bitsquare.gui.main.overlays.popups.Popup) AnchorPane(javafx.scene.layout.AnchorPane) AnchorPane(javafx.scene.layout.AnchorPane) MarketView(io.bitsquare.gui.main.market.MarketView) FundsView(io.bitsquare.gui.main.funds.FundsView) SettingsView(io.bitsquare.gui.main.settings.SettingsView) BuyOfferView(io.bitsquare.gui.main.offer.BuyOfferView) DisputesView(io.bitsquare.gui.main.disputes.DisputesView) PortfolioView(io.bitsquare.gui.main.portfolio.PortfolioView) ImageView(javafx.scene.image.ImageView) SellOfferView(io.bitsquare.gui.main.offer.SellOfferView) AccountView(io.bitsquare.gui.main.account.AccountView) BitsquareException(io.bitsquare.BitsquareException)

Aggregations

AnchorPane (javafx.scene.layout.AnchorPane)66 IOException (java.io.IOException)26 Scene (javafx.scene.Scene)23 FXMLLoader (javafx.fxml.FXMLLoader)22 ChangeListener (javafx.beans.value.ChangeListener)18 Label (javafx.scene.control.Label)16 ImageView (javafx.scene.image.ImageView)16 FXML (javafx.fxml.FXML)15 Insets (javafx.geometry.Insets)15 Pane (javafx.scene.layout.Pane)14 URL (java.net.URL)13 GridPane (javafx.scene.layout.GridPane)12 Inject (javax.inject.Inject)12 JFXButton (com.jfoenix.controls.JFXButton)11 ResourceBundle (java.util.ResourceBundle)11 KeyFrame (javafx.animation.KeyFrame)11 Timeline (javafx.animation.Timeline)11 Initializable (javafx.fxml.Initializable)11 Duration (javafx.util.Duration)11 Button (javafx.scene.control.Button)10