當前位置: 首頁>>代碼示例>>Java>>正文


Java VerticalLayout.setDefaultComponentAlignment方法代碼示例

本文整理匯總了Java中com.vaadin.ui.VerticalLayout.setDefaultComponentAlignment方法的典型用法代碼示例。如果您正苦於以下問題:Java VerticalLayout.setDefaultComponentAlignment方法的具體用法?Java VerticalLayout.setDefaultComponentAlignment怎麽用?Java VerticalLayout.setDefaultComponentAlignment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vaadin.ui.VerticalLayout的用法示例。


在下文中一共展示了VerticalLayout.setDefaultComponentAlignment方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: StepLabel

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
 * Construct a new label with the given caption, description and icon.
 *
 * @param caption
 *     The caption to show
 * @param description
 *     The description to show
 * @param icon
 *     The icon to show
 */
public StepLabel(String caption, String description, FontIcon icon) {
  active = false;
  nexted = false;
  skipped = false;
  editable = false;
  clickable = false;

  iconLabel = new Label();
  iconLabel.setWidthUndefined();
  iconLabel.setContentMode(ContentMode.HTML);
  iconLabel.addStyleName(STYLE_STEP_ICON);

  captionLabel = new Label();
  captionLabel.setWidth(100, Unit.PERCENTAGE);
  captionLabel.addStyleName(STYLE_STEP_CAPTION);

  descriptionLabel = new Label();
  descriptionLabel.setWidth(100, Unit.PERCENTAGE);
  descriptionLabel.addStyleName(ValoTheme.LABEL_LIGHT);
  descriptionLabel.addStyleName(ValoTheme.LABEL_SMALL);
  descriptionLabel.addStyleName(STYLE_STEP_DESCRIPTION);

  captionWrapper = new VerticalLayout();
  captionWrapper.setSpacing(false);
  captionWrapper.setMargin(false);
  captionWrapper.setSizeFull();
  captionWrapper.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
  captionWrapper.addComponent(captionLabel);
  captionWrapper.addComponent(descriptionLabel);

  rootLayout = new HorizontalLayout();
  rootLayout.setSpacing(false);
  rootLayout.setMargin(false);
  rootLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
  rootLayout.setWidth(100, Unit.PERCENTAGE);
  rootLayout.addComponent(iconLabel);
  rootLayout.addComponent(captionWrapper);
  rootLayout.setExpandRatio(captionWrapper, 1);

  setCompositionRoot(rootLayout);
  addStyleName(STYLE_ROOT_LAYOUT);
  setIcon(icon);
  setCaption(caption);
  setDescription(description);

  setIconNexted(DEFAULT_ICON_NEXTED);
  setIconSkipped(DEFAULT_ICON_SKIPPED);
  setIconEditable(DEFAULT_ICON_EDITABLE);
  setIconError(DEFAULT_ICON_ERROR);
}
 
開發者ID:Juchar,項目名稱:md-stepper,代碼行數:61,代碼來源:StepLabel.java

示例2: HorizontalStepper

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
 * Create a new horizontal stepper using the given iterator and label change handler.
 *
 * @param stepIterator
 *     The iterator that handles the iteration over the given steps
 * @param labelProvider
 *     The handler that handles changes to labels
 */
private HorizontalStepper(StepIterator stepIterator, LabelProvider labelProvider) {
  super(stepIterator, labelProvider);

  addStepperCompleteListener(this);
  getStepIterator().addElementAddListener(this);
  getStepIterator().addElementRemoveListener(this);

  this.labelBar = new HorizontalLayout();
  this.labelBar.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
  this.labelBar.setWidth(100, Unit.PERCENTAGE);
  this.labelBar.addStyleName(STYLE_LABEL_BAR);
  this.labelBar.setMargin(false);
  this.labelBar.setSpacing(false);

  this.buttonBar = new HorizontalLayout();
  this.buttonBar.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
  this.buttonBar.addStyleName(STYLE_BUTTON_BAR);
  this.buttonBar.setWidth(100, Unit.PERCENTAGE);
  this.buttonBar.setMargin(false);
  this.buttonBar.setSpacing(true);

  this.stepContent = new Panel();
  this.stepContent.addStyleName(ValoTheme.PANEL_BORDERLESS);
  this.stepContent.addStyleName(STYLE_CONTENT_CONTAINER);
  this.stepContent.setSizeFull();

  this.dividerExpandRatio = DEFAULT_EXPAND_RATIO_DIVIDER;

  VerticalLayout rootLayout = new VerticalLayout();
  rootLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
  rootLayout.setSizeFull();
  rootLayout.setMargin(false);
  rootLayout.setSpacing(true);
  rootLayout.addComponent(labelBar);
  rootLayout.addComponent(stepContent);
  rootLayout.addComponent(buttonBar);
  rootLayout.setExpandRatio(stepContent, 1);

  setCompositionRoot(rootLayout);
  addStyleName(STYLE_ROOT_LAYOUT);
  setSizeFull();
  refreshLabelBar();
}
 
開發者ID:Juchar,項目名稱:md-stepper,代碼行數:52,代碼來源:HorizontalStepper.java


注:本文中的com.vaadin.ui.VerticalLayout.setDefaultComponentAlignment方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。