com.vaadin.ui.Accordion类的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(109)

本文整理了Java中com.vaadin.ui.Accordion类的一些代码示例,展示了Accordion类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Accordion类的具体详情如下:
包路径:com.vaadin.ui.Accordion
类名称:Accordion

Accordion介绍

[英]An accordion is a component similar to a TabSheet, but with a vertical orientation and the selected component presented between tabs. Closable tabs are not supported by the accordion. The Accordion can be styled with the .v-accordion, .v-accordion-item, .v-accordion-item-first and .v-accordion-item-caption styles.
[中]手风琴是一种类似于标签页的组件,但具有垂直方向,并且所选组件显示在标签之间。手风琴不支持可关闭的选项卡。手风琴的样式可以用字母来表示。手风琴。v-手风琴-项目。v-手风琴-第一项和第二项。v-手风琴-项目-标题样式。

代码示例

代码示例来源:origin: peholmst/vaadin4spring

@Override
protected Accordion createCompositionRoot() {
  Accordion accordion = new Accordion();
  accordion.setSizeFull();
  return accordion;
}

代码示例来源:origin: de.mhus.lib/mhu-lib-vaadin6

public void addComponent(LayoutElement element, Component component, int col1, int row1, int col2, int row2) {
  accordion.addTab(component,element.getTitle());
}

代码示例来源:origin: org.vaadin.addons/dragdroplayouts

@Override
public DDAccordionState getState() {
  return (DDAccordionState) super.getState();
}

代码示例来源:origin: stackoverflow.com

Accordion accordion = new Accordion();
 accordion.getPanes().addAll(
     new TitledPane("Library", new Text("Hello")),
     new TitledPane("Music", new Text("Music")));
 stage.setScene(new Scene(accordion,300,300));
 stage.show();

代码示例来源:origin: stackoverflow.com

@Override
public void start(Stage stage) throws Exception {       

  Label label1 = new Label("label 1");
  label1.setRotate(90);

  TitledPane pane1 = new TitledPane("titled pane 1", label1);
  pane1.setAlignment(Pos.CENTER);

  Label label2 = new Label("label 2");
  label2.setRotate(90);

  TitledPane pane2 = new TitledPane("titled pane 2", label2);
  pane2.setAlignment(Pos.CENTER);

  Accordion accordion = new Accordion();
  accordion.setRotate(270);
  accordion.getPanes().add(pane1);
  accordion.getPanes().add(pane2);

  HBox mainPane = new HBox(accordion);
  accordion.prefWidthProperty().bind(mainPane.heightProperty());
  accordion.prefHeightProperty().bind(mainPane.widthProperty());

  stage.setTitle("Horizontal Accordion");
  stage.setScene(new Scene(mainPane, 800, 600));
  stage.show();
}

代码示例来源:origin: OpenNMS/opennms

@Override
public void refresh() {
  m_timeslot = 3600;
  try {
    m_timeslot = Math.max(1, Integer.parseInt(getDashletSpec().getParameters().get("timeslot")));
  } catch (NumberFormatException numberFormatException) {
    /**
     * Just ignore
     */
  }
  m_horizontalLayout.removeAllComponents();
  Accordion accordion = new Accordion();
  accordion.setSizeFull();
  injectDashboardStyles();
  Component severity = getComponentSeverity(16);
  Component uei = getComponentUei(16);
  VerticalLayout v1 = new VerticalLayout(severity);
  v1.setSizeFull();
  v1.setComponentAlignment(severity, Alignment.MIDDLE_CENTER);
  v1.setMargin(true);
  accordion.addTab(v1, "by Severity");
  VerticalLayout v2 = new VerticalLayout(uei);
  v2.setSizeFull();
  v2.setComponentAlignment(uei, Alignment.MIDDLE_CENTER);
  v2.setMargin(true);
  accordion.addTab(v2, "by Uei");
  m_horizontalLayout.addComponent(accordion);
}

代码示例来源:origin: stackoverflow.com

Accordion accordion = new Accordion();
  accordion.getPanes().add(pane);
  pane.setCollapsible(false);
accordion.setExpandedPane(accordion.getPanes().get(0));
previousButton.disableProperty().bind(accordion.expandedPaneProperty().isEqualTo(accordion.getPanes().get(0)));
previousButton.setOnAction(e -> {
  TitledPane current = accordion.getExpandedPane();
  int index = accordion.getPanes().indexOf(current);
  TitledPane previous = accordion.getPanes().get(index - 1);
  current.setCollapsible(true);
  previous.setCollapsible(true);
  accordion.setExpandedPane(previous);
  previous.setCollapsible(false);
  current.setCollapsible(false);
nextButton.disableProperty().bind(accordion.expandedPaneProperty().isEqualTo(accordion.getPanes().get(accordion.getPanes().size()-1)));
nextButton.setOnAction(e -> {
  TitledPane current = accordion.getExpandedPane();
  int index = accordion.getPanes().indexOf(current);
  TitledPane next = accordion.getPanes().get(index + 1);
  current.setCollapsible(true);
  next.setCollapsible(true);
  accordion.setExpandedPane(next);
  next.setCollapsible(false);
  current.setCollapsible(false);

代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin

public AccordionBuilder() {
  super(new Accordion());
}

代码示例来源:origin: stackoverflow.com

public Parent createContent() {
   String titleText = "Node 1";
   TitledPane t1 = new TitledPane(null, new Button("Button"));
   t1.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
   t1.setGraphic(loadMinitool(titleText));
   double titleTextWidth = computeTextWidth(t1.getFont(), titleText, 0);
   double arrowButtonWidth = 14;  // I have given a static value here otherwise
     // it must be calculated by
     // t1.lookup(".arrow-button").getLayoutBounds().getWidth()
     // after the primary stage has been shown. Namely after primaryStage.show(); line.
   double paddings = 20; // right (10) and left (10) paddings defined in 
     // caspian.css for title of the pane. These values can also be obtained 
     // by lookup.
   double total = titleTextWidth + arrowButtonWidth + paddings;
   HBox toolButtons = (HBox) ((BorderPane) t1.getGraphic()).getRight();
   toolButtons.prefWidthProperty().bind(t1.widthProperty().subtract(total));
   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);
   accordion.setMinSize(100, 100);
   accordion.setPrefSize(200, 400);
   return accordion;
 }

代码示例来源:origin: stackoverflow.com

@Override
public void start(Stage primaryStage) {
  StackPane root = new StackPane();
  Accordion accord=new Accordion();
  ScrollPane scroll=new ScrollPane();
  scroll.setPrefHeight(accord.getHeight());
  scroll.prefWidth(accord.getWidth());

  TitledPane title=new TitledPane();
  title.setText("Accordian");
  title.setContent(scroll);
  accord.getPanes().add(title);
  root.getChildren().add(accord);

  Scene scene = new Scene(root, 300, 250);

  primaryStage.setTitle("Scroll Pane");
  primaryStage.setScene(scene);
  primaryStage.show();
}

代码示例来源:origin: stackoverflow.com

scene.setFill(Color.GHOSTWHITE);
final Accordion accordion = new Accordion();
  tps[i].setMinHeight(i * 100);
accordion.getPanes().addAll(tps);
accordion.setExpandedPane(tps[0]);

代码示例来源:origin: com.haulmont.cuba/cuba-web-widgets

@Override
public void beforeClientResponse(boolean initial) {
  super.beforeClientResponse(initial);
  DDUtil.onBeforeClientResponse(this, getState());
}

代码示例来源:origin: org.opennms.features.vaadin-dashlets/dashlet-summary

@Override
public void refresh() {
  m_timeslot = 3600;
  try {
    m_timeslot = Math.max(1, Integer.parseInt(getDashletSpec().getParameters().get("timeslot")));
  } catch (NumberFormatException numberFormatException) {
    /**
     * Just ignore
     */
  }
  m_horizontalLayout.removeAllComponents();
  Accordion accordion = new Accordion();
  accordion.setSizeFull();
  injectDashboardStyles();
  Component severity = getComponentSeverity(16);
  Component uei = getComponentUei(16);
  VerticalLayout v1 = new VerticalLayout(severity);
  v1.setSizeFull();
  v1.setComponentAlignment(severity, Alignment.MIDDLE_CENTER);
  v1.setMargin(true);
  accordion.addTab(v1, "by Severity");
  VerticalLayout v2 = new VerticalLayout(uei);
  v2.setSizeFull();
  v2.setComponentAlignment(uei, Alignment.MIDDLE_CENTER);
  v2.setMargin(true);
  accordion.addTab(v2, "by Uei");
  m_horizontalLayout.addComponent(accordion);
}

代码示例来源:origin: stackoverflow.com

Accordion accordion = new Accordion();
accordion.getPanes().addAll(adminPane, viewPane);
accordion.expandedPaneProperty().addListener(new ChangeListener<TitledPane>() {
 @Override public void changed(ObservableValue<? extends TitledPane> property, final TitledPane oldPane, final TitledPane newPane) {
  if (oldPane != null) oldPane.setCollapsible(true);
for (TitledPane pane: accordion.getPanes()) pane.setAnimated(false);
accordion.setExpandedPane(accordion.getPanes().get(0));

代码示例来源:origin: stackoverflow.com

// an object definition
var Accordion = function () {
  this.clickCounter = 0;
};
Accordion.prototype.click = function () {
  this.clickCounter += 1;
  alert( this.clickCounter );
};

// create object
var myAccordion = new Accordion();

// function to bind DOM element events to javascript object methods
function methodBind ( element, eventType, myObject, myMethod ) {
  $( element ).bind( eventType, function(e) {
   e.preventDefault();
   myObject[myMethod ].call(myObject);
  } );
}

// bind buttons on an element to activate a correlating object method
$( '.Accordion' ).find( '.button' ).each( function() {
  methodBind( this, 'click', myAccordion, 'click' );
} );

代码示例来源:origin: stackoverflow.com

Accordion accordion = new Accordion();
TitledPane titledPane = new TitledPane();
titledPane.setText("Title");
GridPane gridPane = new GridPane();
gridPane.setStyle("-fx-background-color:red");

gridPane.add(new TextArea("Hello"), 0, 0);
gridPane.add(new TextArea("World"), 0, 1);

titledPane.setContent(gridPane);
accordion.getPanes().add(titledPane);

代码示例来源:origin: org.vaadin.addons/dragdroplayouts

@Override
public void beforeClientResponse(boolean initial) {
  super.beforeClientResponse(initial);
  DDUtil.onBeforeClientResponse(this, getState());
}

代码示例来源:origin: OpenNMS/opennms

ui.getPage().getStyles().add(".margin { margin:5px; }");
Accordion accordion = new Accordion();
accordion.setSizeFull();
      accordion.addTab(getGraphComponent(i, width, height, timeFrameType, timeFrameValue), getDashletSpec().getParameters().get("nodeLabel" + i) + "/" + getDashletSpec().getParameters().get("resourceTypeLabel" + i) + ": " + getDashletSpec().getParameters().get("resourceLabel" + i));

代码示例来源:origin: de.mhus.lib/mhu-lib-vaadin6

public void createUi(VaadinFormBuilder builder) {
  accordion = new Accordion();
  builder.addComposite((LayoutComposite)getElement(), accordion);
}

代码示例来源:origin: stackoverflow.com

Accordion acc = new Accordion();
acc.getPanes().addAll(this.createPanes());
yesaccordion.getChildren().add(acc);

相关文章