javafx.scene.control.Accordion Java Examples

The following examples show how to use javafx.scene.control.Accordion. 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: SessionManager.java    From mokka7 with Eclipse Public License 1.0 6 votes vote down vote up
public void bind(final Accordion accordion, final String propertyName) {
    Object selectedPane = props.getProperty(propertyName);
    for (TitledPane tp : accordion.getPanes()) {
        if (tp.getText() != null && tp.getText().equals(selectedPane)) {
            accordion.setExpandedPane(tp);
            break;
        }
    }
    accordion.expandedPaneProperty().addListener(new ChangeListener<TitledPane>() {

        @Override
        public void changed(ObservableValue<? extends TitledPane> ov, TitledPane t, TitledPane expandedPane) {
            if (expandedPane != null) {
                props.setProperty(propertyName, expandedPane.getText());
            }
        }
    });
}
 
Example #2
Source File: SVRealNodeAdapter.java    From scenic-view with GNU General Public License v3.0 5 votes vote down vote up
public SVRealNodeAdapter(final Node node, final boolean collapseControls, final boolean collapseContentControls) {
    super(ConnectorUtils.nodeClass(node), node.getClass().getName());
    this.node = node;
    this.collapseControls = collapseControls;
    this.collapseContentControls = collapseContentControls;
    boolean mustBeExpanded = !(node instanceof Control) || !collapseControls;
    if (!mustBeExpanded && !collapseContentControls) {
        mustBeExpanded = node instanceof TabPane || node instanceof SplitPane || node instanceof ScrollPane || node instanceof Accordion || node instanceof TitledPane;
    }
    setExpanded(mustBeExpanded);
}
 
Example #3
Source File: SVRemoteNodeAdapter.java    From scenic-view with GNU General Public License v3.0 5 votes vote down vote up
public SVRemoteNodeAdapter(final Node node, final boolean collapseControls, final boolean collapseContentControls, final boolean fillChildren, final SVRemoteNodeAdapter parent) {
    super(ConnectorUtils.nodeClass(node), node.getClass().getName());
    boolean mustBeExpanded = !(node instanceof Control) || !collapseControls;
    if (!mustBeExpanded && !collapseContentControls) {
        mustBeExpanded = node instanceof TabPane || node instanceof SplitPane || node instanceof ScrollPane || node instanceof Accordion || node instanceof TitledPane;
    }
    setExpanded(mustBeExpanded);
    this.id = node.getId();
    this.nodeId = ConnectorUtils.getNodeUniqueID(node);
    this.focused = node.isFocused();
    if (node.getParent() != null && parent == null) {
        this.parent = new SVRemoteNodeAdapter(node.getParent(), collapseControls, collapseContentControls, false, null);
    } else if (parent != null) {
        this.parent = parent;
    }
    /**
     * Check visibility and mouse transparency after calculating the parent
     */
    this.mouseTransparent = node.isMouseTransparent() || (this.parent != null && this.parent.isMouseTransparent());
    this.visible = node.isVisible() && (this.parent == null || this.parent.isVisible());

    /**
     * TODO This should be improved
     */
    if (fillChildren) {
        nodes = ChildrenGetter.getChildren(node)
                  .stream()
                  .map(childNode -> new SVRemoteNodeAdapter(childNode, collapseControls, collapseContentControls, true, this))
                  .collect(Collectors.toList());
    }
}
 
Example #4
Source File: AccordionSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public AccordionSample() {
    super(150,150);
    TitledPane t1 = new TitledPane("Node 1", new Button("Button"));
    TitledPane t2 = new TitledPane("Node 2", new Text("String"));
    TitledPane t3 = new TitledPane("Node 3", new Rectangle(120,50, Color.RED));
    Accordion accordion = new Accordion();
    accordion.getPanes().add(t1);
    accordion.getPanes().add(t2);
    accordion.getPanes().add(t3);
    getChildren().add(accordion);
}
 
Example #5
Source File: BrowserTab.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public Node getRoot() {
    basicPane = new FormPane("browser-config-basic", 3);
    advancedPane = new FormPane("browser-config-advanced", 3);
    addBrowserName();
    addWebDriverExeBrowse();
    addBrowserExeBrowse();
    addArguments();
    addWdArguments();
    addUseCleanSession();
    addUseTechnologyPreview();

    addVerbose();
    addIELogLevel();
    addSilent();
    addLogFileBrowse();
    addEnvironment();
    addExtensions();
    addPageLoadStrategy();
    addUnexpectedAlertBehavior();
    addAssumeUntrustedCertificateIssuer();
    addAcceptUntrustedCertificates();
    addAlwaysLoadNoFocusLib();
    addBrowserPreferences();

    ScrollPane sp1 = new ScrollPane(basicPane);
    sp1.setFitToWidth(true);
    TitledPane basicTitledPane = new TitledPane("Basic Settings", sp1);
    ScrollPane sp2 = new ScrollPane(advancedPane);
    sp2.setFitToWidth(true);
    TitledPane advancedTitledPane = new TitledPane("Advanced Settings", sp2);
    Accordion accordion = new Accordion(basicTitledPane, advancedTitledPane);
    accordion.setExpandedPane(basicTitledPane);
    return accordion;
}
 
Example #6
Source File: AccordionSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public AccordionSample() {
    super(150,150);
    TitledPane t1 = new TitledPane("Node 1", new Button("Button"));
    TitledPane t2 = new TitledPane("Node 2", new Text("String"));
    TitledPane t3 = new TitledPane("Node 3", new Rectangle(120,50, Color.RED));
    Accordion accordion = new Accordion();
    accordion.getPanes().add(t1);
    accordion.getPanes().add(t2);
    accordion.getPanes().add(t3);
    getChildren().add(accordion);
}
 
Example #7
Source File: SessionContext.java    From jfxvnc with Apache License 2.0 5 votes vote down vote up
public void bind(final Accordion accordion, final String propertyName) {
  Object selectedPane = props.getProperty(propertyName);
  for (TitledPane tp : accordion.getPanes()) {
    if (tp.getText() != null && tp.getText().equals(selectedPane)) {
      accordion.setExpandedPane(tp);
      break;
    }
  }
  accordion.expandedPaneProperty().addListener((ov, t, expandedPane) -> {
    if (expandedPane != null) {
      props.setProperty(propertyName, expandedPane.getText());
    }
  });
}
 
Example #8
Source File: ConsolidatedDialog.java    From constellation with Apache License 2.0 4 votes vote down vote up
/**
 * A generic multiple matches dialog which can be used to display a
 * collection of ObservableList items
 *
 * @param title The title of the dialog
 * @param observableMap The map of {@code ObservableList} objects
 * @param message The (help) message that will be displayed at the top of
 * the dialog window
 * @param listItemHeight The height of each list item. If you have a single
 * row of text then set this to 24.
 */
public ConsolidatedDialog(String title, Map<String, ObservableList<Container<K, V>>> observableMap, String message, int listItemHeight) {
    final BorderPane root = new BorderPane();
    root.setStyle("-fx-background-color: #DDDDDD;-fx-border-color: #3a3e43;-fx-border-width: 4px;");

    // add a title
    final Label titleLabel = new Label();
    titleLabel.setText(title);
    titleLabel.setStyle("-fx-font-size: 11pt;-fx-font-weight: bold;");
    titleLabel.setAlignment(Pos.CENTER);
    titleLabel.setPadding(new Insets(5));
    root.setTop(titleLabel);

    final Accordion accordion = new Accordion();
    for (String identifier : observableMap.keySet()) {
        final ObservableList<Container<K, V>> objects = observableMap.get(identifier);
        ListView<Container<K, V>> listView = new ListView<>(objects);
        listView.setEditable(false);
        listView.setPrefHeight((listItemHeight * objects.size()));
        listView.getSelectionModel().selectedItemProperty().addListener(event -> {
            listView.getItems().get(0).getKey();
            final Container<K, V> container = listView.getSelectionModel().getSelectedItem();
            if (container != null) {
                selectedObjects.add(new Pair<>(container.getKey(), container.getValue()));
            } else {
                // the object was unselected so go through the selected objects and remove them all because we don't know which one was unselected
                for (Container<K, V> object : listView.getItems()) {
                    selectedObjects.remove(new Pair<>(object.getKey(), object.getValue()));
                }
            }
        });

        final TitledPane titledPane = new TitledPane(identifier, listView);
        accordion.getPanes().add(titledPane);
    }

    final HBox help = new HBox();
    help.getChildren().add(helpMessage);
    help.getChildren().add(new ImageView(UserInterfaceIconProvider.HELP.buildImage(16, ConstellationColor.AZURE.getJavaColor())));
    help.setPadding(new Insets(10, 0, 10, 0));
    helpMessage.setText(message + "\n\nNote: To deselect hold Ctrl when you click.");
    helpMessage.setStyle("-fx-font-size: 11pt;");
    helpMessage.setWrapText(true);
    helpMessage.setPadding(new Insets(5));

    final VBox box = new VBox();
    box.getChildren().add(help);

    // add the multiple matching accordion
    box.getChildren().add(accordion);

    final ScrollPane scroll = new ScrollPane();
    scroll.setContent(box);
    scroll.setFitToWidth(true);
    scroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
    root.setCenter(scroll);

    final FlowPane buttonPane = new FlowPane();
    buttonPane.setAlignment(Pos.BOTTOM_RIGHT);
    buttonPane.setPadding(new Insets(5));
    buttonPane.setHgap(5);
    root.setBottom(buttonPane);

    useButton = new Button("Continue");
    buttonPane.getChildren().add(useButton);
    accordion.expandedPaneProperty().set(null);

    final Scene scene = new Scene(root);
    fxPanel.setScene(scene);
    fxPanel.setPreferredSize(new Dimension(500, 500));
}
 
Example #9
Source File: TitledPaneSample.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
@Override
public void start(Stage stage) {
    stage.setTitle("TitledPane");
    Scene scene = new Scene(new Group(), 450, 250);

    TitledPane gridTitlePane = new TitledPane();
    GridPane grid = new GridPane();
    grid.setVgap(4);
    grid.setPadding(new Insets(5, 5, 5, 5));
    grid.add(new Label("First Name: "), 0, 0);
    grid.add(new TextField(), 1, 0);
    grid.add(new Label("Last Name: "), 0, 1);
    grid.add(new TextField(), 1, 1);
    grid.add(new Label("Email: "), 0, 2);
    grid.add(new TextField(), 1, 2);
    grid.add(new Label("Attachment: "), 0, 3);
    grid.add(label, 1, 3);
    gridTitlePane.setText("Grid");
    gridTitlePane.setContent(grid);

    final Accordion accordion = new Accordion();

    for (int i = 0; i < imageNames.length; i++) {
        images[i] = new Image(getClass().getResourceAsStream(imageNames[i] + ".jpg"));
        pics[i] = new ImageView(images[i]);
        tps[i] = new TitledPane(imageNames[i], pics[i]);
    }
    accordion.getPanes().addAll(tps);

    accordion.expandedPaneProperty()
            .addListener((ObservableValue<? extends TitledPane> ov, TitledPane old_val, TitledPane new_val) -> {
                if (new_val != null) {
                    label.setText(accordion.getExpandedPane().getText() + ".jpg");
                }
            });

    HBox hbox = new HBox(10);
    hbox.setPadding(new Insets(20, 0, 0, 20));
    hbox.getChildren().setAll(gridTitlePane, accordion);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}
 
Example #10
Source File: DHLinkWidget.java    From BowlerStudio with GNU General Public License v3.0 4 votes vote down vote up
public DHLinkWidget(int linkIndex, DHLink dhlink, AbstractKinematicsNR device2, Button del,IOnEngineeringUnitsChange externalListener, MobileBaseCadManager manager ) {

		this.linkIndex = linkIndex;
		this.device = device2;
		if(DHParameterKinematics.class.isInstance(device2)){
			dhdevice=(DHParameterKinematics)device2;
		}
		this.del = del;
		AbstractLink abstractLink  = device2.getAbstractLink(linkIndex);
		
		
		TextField name = new TextField(abstractLink.getLinkConfiguration().getName());
		name.setMaxWidth(100.0);
		name.setOnAction(event -> {
			abstractLink.getLinkConfiguration().setName(name.getText());
		});
		
		setpoint = new EngineeringUnitsSliderWidget(new IOnEngineeringUnitsChange() {
			
			@Override
			public void onSliderMoving(EngineeringUnitsSliderWidget source, double newAngleDegrees) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void onSliderDoneMoving(EngineeringUnitsSliderWidget source,
					double newAngleDegrees) {
	    		try {
					device2.setDesiredJointAxisValue(linkIndex, setpoint.getValue(), 2);
					
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				};
			}
		}, 
		abstractLink.getMinEngineeringUnits(), 
		abstractLink.getMaxEngineeringUnits(), 
		device2.getCurrentJointSpaceVector()[linkIndex], 
		180,dhlink.getLinkType()==DhLinkType.ROTORY?"degrees":"mm");
		
		
		
		final Accordion accordion = new Accordion();

		if(dhdevice!=null)
			accordion.getPanes().add(new TitledPane("Configure D-H", new DhSettingsWidget(dhdevice.getChain().getLinks().get(linkIndex),dhdevice,externalListener)));
		accordion.getPanes().add(new TitledPane("Configure Link", new LinkConfigurationWidget(abstractLink.getLinkConfiguration(), device2.getFactory(),setpoint,manager)));
		
		GridPane panel = new GridPane();
		
		panel.getColumnConstraints().add(new ColumnConstraints(80)); // column 1 is 75 wide
		panel.getColumnConstraints().add(new ColumnConstraints(30)); // column 1 is 75 wide
		panel.getColumnConstraints().add(new ColumnConstraints(120)); // column 2 is 300 wide
		
		
		panel.add(	del, 
				0, 
				0);
		panel.add(	new Text("#"+linkIndex), 
				1, 
				0);
		panel.add(	name, 
				2, 
				0);
		panel.add(	setpoint, 
				3, 
				0);
		panel.add(	accordion, 
				2, 
				1);

		getChildren().add(panel);
	}
 
Example #11
Source File: DeckShipPane.java    From logbook-kai with MIT License 4 votes vote down vote up
/**
 * 艦娘選択
 *
 * @param event
 */
@FXML
void shipChange(ActionEvent event) {
    PopupSelectbox<ShipItem> box = new PopupSelectbox<>();

    ObservableList<ShipItem> ships = FXCollections.observableArrayList();
    ships.add(new ShipItem());
    ships.addAll(ShipCollection.get()
            .getShipMap()
            .values()
            .stream()
            .sorted(Comparator.comparing(Ship::getShipId))
            .sorted(Comparator.comparing(Ship::getLv).reversed())
            .map(ShipItem::toShipItem)
            .collect(Collectors.toList()));

    FilteredList<ShipItem> filtered = new FilteredList<>(ships);
    TextFlow textFlow = new TextFlow();
    textFlow.setPrefWidth(260);
    for (ShipTypeGroup group : ShipTypeGroup.values()) {
        CheckBox checkBox = new CheckBox(group.name());
        checkBox.selectedProperty().addListener((ov, o, n) -> {
            Set<String> types = new HashSet<>();
            textFlow.getChildrenUnmodifiable()
                    .stream()
                    .filter(node -> node instanceof CheckBox)
                    .map(node -> (CheckBox) node)
                    .filter(CheckBox::isSelected)
                    .map(CheckBox::getText)
                    .map(ShipTypeGroup::valueOf)
                    .map(ShipTypeGroup::shipTypes)
                    .forEach(types::addAll);

            filtered.setPredicate(ShipFilter.TypeFilter.builder()
                    .types(types)
                    .build());
        });
        textFlow.getChildren().add(checkBox);
    }
    TitledPane titledPane = new TitledPane("フィルター", new VBox(textFlow));
    titledPane.setAnimated(false);
    Accordion accordion = new Accordion(titledPane);

    box.getHeaderContents().add(accordion);
    box.setItems(filtered);
    box.setCellFactory(new ShipCell());
    box.selectedItemProperty().addListener((ov, o, n) -> {
        this.selectedShip.setValue(n != null && n.idProperty() != null ? n.getId() : 0);
    });
    box.getStylesheets().add("logbook/gui/deck.css");
    box.show(this.shipButton);
}