当前位置: 首页>>代码示例>>Java>>正文


Java ToggleSwitch类代码示例

本文整理汇总了Java中org.controlsfx.control.ToggleSwitch的典型用法代码示例。如果您正苦于以下问题:Java ToggleSwitch类的具体用法?Java ToggleSwitch怎么用?Java ToggleSwitch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ToggleSwitch类属于org.controlsfx.control包,在下文中一共展示了ToggleSwitch类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCountBox

import org.controlsfx.control.ToggleSwitch; //导入依赖的package包/类
private VBox createCountBox() {
  VBox countBox = new VBox(10);
  countBox.setAlignment(Pos.CENTER);
  Set<Sip> selectedSet = RodaInApplication.getSelectedDescriptionObjects().keySet();
  Set<Sip> allSet = RodaInApplication.getAllDescriptionObjects().keySet();
  selectedSIP = selectedSet.stream().filter(p -> p instanceof SipPreview).count();
  selectedItems = selectedSet.size() - selectedSIP;
  allSIP = allSet.stream().filter(p -> p instanceof SipPreview).count();
  allItems = allSet.size() - allSIP;

  sSelectedSIP = String.format("%s %d/%d SIP", I18n.t(Constants.I18N_SELECTED), this.selectedSIP, this.allSIP);
  sSelectedItems = String.format("%d/%d %s", this.selectedItems, this.allItems, I18n.t(Constants.I18N_ITEMS));
  sZeroItems = String.format("%d/%d %s", 0, this.allItems, I18n.t(Constants.I18N_ITEMS));
  sAllSIP = String.format("%s %d/%d SIP", I18n.t(Constants.I18N_SELECTED), this.allSIP, this.allSIP);
  sAllItems = String.format("%d/%d %s", this.allItems, this.allItems, I18n.t(Constants.I18N_ITEMS));

  String startingLabel = sSelectedSIP;
  if (allItems != 0) {
    startingLabel = String.format("%s %s %s", sSelectedSIP, I18n.t(Constants.I18N_AND), sZeroItems);
  }

  Label countLabel = new Label(startingLabel);
  countLabel.getStyleClass().add(Constants.CSS_PREPARECREATIONSUBTITLE);
  sipExportSwitch = new ToggleSwitch(I18n.t(Constants.I18N_CREATIONMODALPREPARATION_EXPORT_ALL));
  sipExportSwitch.selectedProperty().addListener((o, old, newValue) -> setSelectedLabel(countLabel));

  if (this.selectedSIP == 0 || this.selectedSIP == this.allSIP)
    sipExportSwitch.setSelected(true);

  itemExportSwitch = new ToggleSwitch(I18n.t(Constants.I18N_CREATIONMODALPREPARATION_INCLUDE_HIERARCHY));
  itemExportSwitch.selectedProperty().addListener((o, old, newValue) -> setSelectedLabel(countLabel));

  String savedState = ConfigurationManager.getAppConfig(Constants.CONF_K_EXPORT_LAST_ITEM_EXPORT_SWITCH);
  if (StringUtils.isNotBlank(savedState)) {
    itemExportSwitch.setSelected(Boolean.valueOf(savedState));
  }

  countBox.getChildren().addAll(countLabel, sipExportSwitch, itemExportSwitch);
  return countBox;
}
 
开发者ID:keeps,项目名称:roda-in,代码行数:41,代码来源:CreationModalPreparation.java

示例2: createReportBox

import org.controlsfx.control.ToggleSwitch; //导入依赖的package包/类
private VBox createReportBox() {
  VBox reportBox = new VBox(10);
  reportBox.setAlignment(Pos.CENTER);
  reportCreationSwitch = new ToggleSwitch(I18n.t(Constants.I18N_CREATIONMODALPREPARATION_CREATE_REPORT));
  reportCreationSwitch.setSelected(true);

  String savedState = ConfigurationManager.getAppConfig(Constants.CONF_K_EXPORT_LAST_REPORT_CREATION_SWITCH);
  if (StringUtils.isNotBlank(savedState)) {
    reportCreationSwitch.setSelected(Boolean.valueOf(savedState));
  }

  reportBox.getChildren().addAll(reportCreationSwitch);
  return reportBox;

}
 
开发者ID:keeps,项目名称:roda-in,代码行数:16,代码来源:CreationModalPreparation.java

示例3: ToggleSwitchEditor

import org.controlsfx.control.ToggleSwitch; //导入依赖的package包/类
ToggleSwitchEditor(Item item) {
  super(item, new ToggleSwitch());
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:4,代码来源:ExtendedPropertySheet.java

示例4: addFeature

import org.controlsfx.control.ToggleSwitch; //导入依赖的package包/类
public void addFeature(final Feature feature) {
    features.add(feature);

    ToggleSwitch toggleSwitch = new ToggleSwitch();
    toggleSwitch.setAlignment(Pos.CENTER_LEFT);
    toggleSwitch.textProperty().bindBidirectional(feature.nameProperty());
    toggleSwitch.selectedProperty().bindBidirectional(feature.activeProperty());
    Util.installWindowDragListener(toggleSwitch);
    toggleSwitch.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    HBox.setHgrow(toggleSwitch, Priority.ALWAYS);

    Button showSlidesButton = FontAwesomeIconFactory.get().createIconButton(FontAwesomeIcon.FILM);
    showSlidesButton.getStyleClass().add("show-slides-button");
    showSlidesButton.setVisible(false);
    HBox.setHgrow(showSlidesButton, Priority.NEVER);
    Util.installWindowDragListener(showSlidesButton);

    HBox featureBox = new HBox(10, toggleSwitch, showSlidesButton);
    featureBox.setAlignment(Pos.TOP_CENTER);

    getChildren().add(featureBox);

    Optional<SlidesEntry> slidesEntry = MovieApp.slidesDatabase.getSlideEntry(feature.getId());
    if (slidesEntry.isPresent()) {
        SlidesEntry entry = slidesEntry.get();
        if (!entry.getSlides().isEmpty()) {
            showSlidesButton.setVisible(true);
            showSlidesButton.setOnAction(evt -> SlidesViewer.showSlides(entry, true));

            toggleSwitch.selectedProperty().addListener(it -> {
                if (toggleSwitch.isSelected()) {
                    SlidesViewer.showSlides(entry, false);
                }
            });
        } else {
            toggleSwitch.selectedProperty().addListener(it -> {
                if (toggleSwitch.isSelected()) {
                    SlidesViewer.showSlides(null, false);
                }
            });
        }
    } else {
        toggleSwitch.selectedProperty().addListener(it -> {
            if (toggleSwitch.isSelected()) {
                SlidesViewer.showSlides(null, false);
            }
        });
    }
}
 
开发者ID:hendrikebbers,项目名称:ExtremeGuiMakeover,代码行数:50,代码来源:FeaturesPane.java


注:本文中的org.controlsfx.control.ToggleSwitch类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。