Search in sources :

Example 6 with AnchorPane

use of javafx.scene.layout.AnchorPane in project Gargoyle by callakrsos.

the class AbsoltePointFocusExam method start.

@Override
public void start(Stage stage) throws Exception {
    // 포커스
    ScrollPane scrPane = new ScrollPane();
    scrPane.setPrefWidth(ScrollPane.USE_COMPUTED_SIZE);
    BorderPane borderPane = new BorderPane(scrPane);
    Scene scene = new Scene(borderPane, Color.LINEN);
    VBox vbox = new VBox();
    VBox.setVgrow(vbox, Priority.ALWAYS);
    vbox.setPrefWidth(VBox.USE_PREF_SIZE);
    vbox.setPrefHeight(VBox.USE_COMPUTED_SIZE);
    for (int i = 0; i < 20; i++) {
        AnchorPane ancPane = new AnchorPane();
        AnchorPane ancPane2 = new AnchorPane();
        ancPane2.setLayoutY(500);
        TextField text1 = new TextField();
        TextField text2 = new TextField();
        text2.setLayoutY(800);
        Button btn = new Button("Focus" + i);
        btn.setOnMouseClicked(event -> {
            text2.requestFocus();
            double absolteY = FxUtil.getAbsolteY(vbox, text2) + text2.getHeight();
            scrPane.setVvalue((absolteY / vbox.getHeight()));
        });
        btn.setLayoutX(150);
        ancPane2.getChildren().add(text2);
        ancPane.getChildren().addAll(text1, btn, ancPane2);
        vbox.getChildren().add(ancPane);
    }
    scrPane.setContent(vbox);
    stage.setWidth(700);
    stage.setHeight(400);
    Label status = new Label();
    borderPane.setBottom(status);
    vbox.addEventFilter(MouseEvent.ANY, event -> {
        status.textProperty().set(String.format(" x: %s y : %s scene x : %s scene y : %s screen x :%s screen y : %s", event.getX(), event.getY(), event.getSceneX(), event.getSceneY(), event.getScreenX(), event.getScreenY()));
    });
    stage.setScene(scene);
    stage.show();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) Button(javafx.scene.control.Button) ScrollPane(javafx.scene.control.ScrollPane) Label(javafx.scene.control.Label) TextField(javafx.scene.control.TextField) Scene(javafx.scene.Scene) VBox(javafx.scene.layout.VBox) AnchorPane(javafx.scene.layout.AnchorPane)

Example 7 with AnchorPane

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

the class UIBaseTest method start.

@Override
public void start(Stage stage) throws Exception {
    TrexApp.setPrimaryStage(stage);
    AnchorPane page = (AnchorPane) FXMLLoader.load(getClass().getResource("/fxml/MainView.fxml"));
    Scene scene = new Scene(page);
    scene.getStylesheets().add(TrexApp.class.getResource("/styles/mainStyle.css").toExternalForm());
    stage.setScene(scene);
    stage.setTitle("TRex");
    stage.setResizable(true);
    stage.setMinWidth(1100);
    stage.setMinHeight(670);
    stage.show();
}
Also used : Scene(javafx.scene.Scene) AnchorPane(javafx.scene.layout.AnchorPane)

Example 8 with AnchorPane

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

the class AbstractProtocolView method buildUI.

private void buildUI() {
    container = new AnchorPane();
    buildCustomProtocolView();
    setContent(container);
    if (dataBinding != null) {
        bindProperties();
    }
    addInputValidation();
}
Also used : AnchorPane(javafx.scene.layout.AnchorPane)

Example 9 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 10 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 : Slider(javafx.scene.control.Slider) MultiplierOption(com.exalttech.trex.ui.components.MultiplierOption) MultiplierType(com.exalttech.trex.ui.MultiplierType) CheckBox(javafx.scene.control.CheckBox) ToggleGroup(javafx.scene.control.ToggleGroup) TextField(javafx.scene.control.TextField) AnchorPane(javafx.scene.layout.AnchorPane) Separator(javafx.scene.control.Separator)

Aggregations

AnchorPane (javafx.scene.layout.AnchorPane)18 Scene (javafx.scene.Scene)7 ImageView (javafx.scene.image.ImageView)7 Popup (io.bitsquare.gui.main.overlays.popups.Popup)6 UserThread (io.bitsquare.common.UserThread)5 Tuple2 (io.bitsquare.common.util.Tuple2)5 ChangeListener (javafx.beans.value.ChangeListener)5 Inject (javax.inject.Inject)5 ActivatableViewAndModel (io.bitsquare.gui.common.view.ActivatableViewAndModel)4 FxmlView (io.bitsquare.gui.common.view.FxmlView)4 BSFormatter (io.bitsquare.gui.util.BSFormatter)4 Insets (javafx.geometry.Insets)4 javafx.scene.control (javafx.scene.control)4 Label (javafx.scene.control.Label)4 Tuple3 (io.bitsquare.common.util.Tuple3)3 TitledGroupBg (io.bitsquare.gui.components.TitledGroupBg)3 FormBuilder (io.bitsquare.gui.util.FormBuilder)3 ImageUtil (io.bitsquare.gui.util.ImageUtil)3 Layout (io.bitsquare.gui.util.Layout)3 VPos (javafx.geometry.VPos)3