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

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

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

Layout介绍

[英]Extension to the ComponentContainer interface which adds the layouting control to the elements in the container. This is required by the various layout components to enable them to place other components in specific locations in the UI.
[中]对ComponentContainer接口的扩展,该接口将布局控件添加到容器中的元素。这是各种布局组件所必需的,以使它们能够将其他组件放置在UI中的特定位置。

代码示例

代码示例来源:origin: org.aperteworkflow/gui-commons

@Override
public void attachToLayout(Layout layout) {
  layout.addComponent(new Label("no help loaded"));
}

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

/**
 * Sets the visibility of the History.
 *
 * @param visible
 *            {@code true} to show the history, {@code false} to hide it
 */
public void setHistoryVisible(boolean visible) {
  historyContainer.setVisible(visible);
  resize.setVisible(visible);
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework

protected void clearRootLayout() {
  rootLayout.setVisible(false);
  rootLayout.removeAllComponents();
  removeStyleName("done");
}

代码示例来源:origin: nz.co.senanque/madura-workflow-vaadin

public void refresh() {
  try {
    panel.removeComponent(m_attachmentsTable);
  } catch (NullPointerException e) {
    // ignore NPEs
  }
  m_attachmentsTable = getAttachmentsTable(getFilter(getPermissionManager(),m_currentPid));
  panel.addComponent(m_attachmentsTable);
}

代码示例来源:origin: nz.co.senanque/madura-workflow-vaadin

public void load(Audit audit) {
    panel.removeAllComponents();
    getMaduraSessionManager().getValidationSession().bind(audit);
    BeanItem<Audit> beanItem = new BeanItem<Audit>(audit);
    m_fieldGroup =  m_maduraSessionManager.createMaduraFieldGroup();
    
    Map<String,Field<?>> fields = m_fieldGroup.buildAndBind(new String[]{"created","lockedBy","status","comment"},beanItem);
//        String[] fieldList = new String[]{"created","lockedBy","status","comment"};
//        m_fieldGroup.setFieldList(fieldList);
//        m_auditForm.setItemDataSource(beanItem);
    TextArea comment = (TextArea)fields.get("comment");
    comment.setWidth("700px");
    for (Field<?> f: fields.values()) {
      panel.addComponent(f);
    }
    panel.addComponent(getInitialLayout());
//        panel.requestRepaint();
    if (getParent() == null) {
      UI.getCurrent().addWindow(this);
      this.center();
    }
  }
  @PostConstruct

代码示例来源:origin: nz.co.senanque/madura-workflow-vaadin

@PostConstruct
  public void init() {
    main = new VerticalLayout();
    setContent(main);
    setModal(true);
//        main.setStyleName(Panel.STYLE_LIGHT);
    main.setWidth(getWindowWidth());
    main.setHeight(getWindowHeight());
    
    panel = new VerticalLayout();
//        main.setMargin(true);
    main.addComponent(panel);
    
    setCaption(m_messageSourceAccessor.getMessage("audit", "Audit"));
  }

代码示例来源:origin: org.activiti/activiti-explorer

protected void initCreateButton() {
 HorizontalLayout buttonLayout = new HorizontalLayout();
 buttonLayout.setWidth(100, UNITS_PERCENTAGE);
 form.getFooter().setWidth(100, UNITS_PERCENTAGE);
 form.getFooter().addComponent(buttonLayout);
 
 Button createButton = new Button(i18nManager.getMessage(Messages.USER_CREATE));
 buttonLayout.addComponent(createButton);
 buttonLayout.setComponentAlignment(createButton, Alignment.BOTTOM_RIGHT);
 
 createButton.addListener(new ClickListener() {
  public void buttonClick(ClickEvent event) {
   handleFormSubmit();
  }
 });
}

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

public class MyUi extends UI {
  @Override
  protected void init(VaadinRequest request) {
    // basic stuff
    Layout content = new VerticalLayout();
    content.setSizeFull();
    setContent(content);

    // container & grid
    BeanItemContainer<Address> container = new BeanItemContainer<>(Address.class);
    Grid grid = new Grid(container);

    // 1) either manually add nested properties and hide the actual inner bean
    container.addNestedContainerProperty("city.name");
    grid.getColumn("city.name").setHeaderCaption("City");
    grid.setColumns("street", "city.name"); // hide bean column

    // 2) or make the container create nested properties for your inner beans
    container.addNestedContainerBean("city");
    grid.getColumn("city.name").setHeaderCaption("City");

    // create some dummy data to populate the grid
    City city = new City("There");
    Address address = new Address(city, "Here");
    container.addItem(address);
    content.addComponent(grid);
  }
}

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

linksLayout.setSizeUndefined();
enclosingLayout.addComponent(linksLayout);
    .getShowBreadCrumbs();
enclosingLayout.setVisible(controlsVisible);

代码示例来源:origin: nz.co.senanque/madura-vaadinsupport

public void initialize(List<String> fields) {
  Layout main = new VerticalLayout();
  setLayout(main);
  main.setWidth(getWindowWidth());
  main.setStyleName(Panel.STYLE_LIGHT);
  setFields(fields);
  m_form.setSizeFull();
  
  main.addComponent(m_form);
  
  save = m_form.createButton("save",new SubmitButtonPainter(m_maduraSessionManager),this);
  delete = m_form.createButton("delete",new SimpleButtonPainter(m_maduraSessionManager),this);
  close = m_form.createButton("close",new SimpleButtonPainter(m_maduraSessionManager),this);
  extraFields();
  HorizontalLayout actions = new HorizontalLayout();
  actions.addComponent(save);
  save.addListener(this);
  actions.addComponent(delete);
  delete.addListener(this);
  close.addListener(this);
  actions.addComponent(close);
  main.addComponent(actions);
}
protected void extraFields()

代码示例来源:origin: jpos/jPOS-EE

@Override
protected void addFields(Layout l) {
  super.addFields(l);
  selectedU = getInstance();
  if (getInstance().getId() != null && getInstance().getId().equals(getApp().getUser().getId())) {
    changePassBtn = createChangePasswordButton();
    l.addComponents(changePassBtn, createPasswordPanel());
  }
  if (getInstance().hasPermission("sysadmin") && !isNewView()) {
    resetPassBtn = createResetPasswordButton();
    l.addComponent(resetPassBtn);
  }
}

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

property.toString());
    } else {
      layout.addComponent(f);
  getLayout().setParent(null);
layout.setParent(this);
getState().layout = layout;

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework

private void initialize() {
  optionsField = formFieldFactory.createField(definition.getField(), locale);
  layout.addComponent(optionsField);
  optionsField.addValueChangeListener(e -> {
    if (e.getOldValue() == null || e.getOldValue() == null) {
      return;
    }
    EditorView<T> oldView = subForm(e.getOldValue());
    EditorView<T> newView = subForm(e.getValue());
    layout.replaceComponent(oldView.asVaadinComponent(), newView.asVaadinComponent());
  });
  definition.getForms().forEach(formDefinition -> {
    ItemProviderStrategy<T> subFormProviderStrategy = create(((ComplexPropertyDefinition<T>) formDefinition).getItemProvider(), formDefinition, itemProviderStrategy);
    EditorView<T> subForm = getViewProvider().create(formDefinition);
    subForms.put(formDefinition.getName(), Pair.of(subForm, subFormProviderStrategy));
  });
  binder = ConfiguredBinder.withPropertySet(propertySetFactory.fromFieldDefinitions(Collections.singletonList(definition.getField()), locale));
  binder.forField(optionsField)
      .withConverter(new StringToOptionDefinitionConverter(definition.getField()))
      .bind(resolvePropertyNameByLocale(definition.getField().getName(), locale, definition.getField().isI18n()));
}

代码示例来源:origin: org.activiti/activiti-explorer

protected void addFields() {
 form = new Form();
 form.setCaption(i18nManager.getMessage(Messages.PROCESS_COPY_POPUP_CAPTION));
 form.getLayout().setMargin(true);
 
 nameTextField = new TextField(i18nManager.getMessage(Messages.TASK_NAME));
 nameTextField.setWidth(20, Sizeable.UNITS_EM);
 nameTextField.setRequired(true);
 nameTextField.setValue(modelData.getName());
 form.getLayout().addComponent(nameTextField);
 nameTextField.focus();
 
 descriptionTextArea = new TextArea(i18nManager.getMessage(Messages.TASK_DESCRIPTION));
 descriptionTextArea.setRows(8);
 descriptionTextArea.setWidth(20, Sizeable.UNITS_EM);
 form.getLayout().addComponent(descriptionTextArea);
 
 addComponent(form);
 
 // Some empty space
 Label emptySpace = new Label("&nbsp;", Label.CONTENT_XHTML);
 addComponent(emptySpace);
}

代码示例来源:origin: org.aperteworkflow/editor

@Override
public boolean removePermissionWrapper(PermissionWrapper permissionWrapper) {
  PermissionWrapperBox box = getPermissionWrapperBoxByRoleName(permissionWrapper.getRoleName());
  if (box == null) {
    // Nothing to remove
    return false;
  }
  roleNameLayout.removeComponent(box);
  roleNameLayout.requestRepaint();
  roleNameComboBox.addItem(permissionWrapper.getRoleName());
  Permission permission = new Permission();
  permission.setPrivilegeName(permissionWrapper.getPrivilegeName());
  permission.setRoleName(permissionWrapper.getRoleName());
  provider.removePermission(permission);
  return true;
}

代码示例来源:origin: org.aperteworkflow/editor

@Override
public void loadData() {
  roleNameComboBox.removeAllItems();
  roleNameComboBox.addItem(".*");
  for (String roleName : LiferayBridge.getRegularRoleNames()) {
    roleNameComboBox.addItem(roleName);
  }
  roleNameLayout.removeAllComponents();
  if (provider.getPermissions() != null) {
    for (Permission permission : provider.getPermissions()) {
      addPermissionWrapper(new PermissionWrapper(permission));
    }
  }
}

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

private void resizeButtonClick(ClickEvent event) {
  boolean minimize = (Boolean) resize.getData();
  if (minimize) {
    historyContainer.setHeight("27px");
    history.setHeight("22px");
  } else {
    historyContainer.setHeight("90px");
    history.setHeight("85px");
  }
  resize.setData(!minimize);
}

代码示例来源:origin: org.aperteworkflow/editor

private void initComponent() {
  I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource();
  privilegeDescriptionLabel = new Label(getDescription(permissionDefinition));
  privilegeDescriptionLabel.setContentMode(Label.CONTENT_XHTML); // TODO don't use XHTML switch to style names
  roleNameDescriptionLabel = new Label(messages.getMessage("permission.editor.assigned.roles"));
  roleNameComboBox = new RoleNameComboBox();
  roleNameComboBox.setHandler(this);
  roleNameLayout = new CssLayout() {
    @Override
    protected String getCss(Component c) {
      if (c instanceof PermissionWrapperBox) {
        String basicCss = "float: left; margin: 3px; margin-bottom: 8px; padding: 3px; display: inline; font-weight: bold; border: 2px solid ";
        return basicCss + "#287ece; -moz-border-radius: 5px; border-radius: 5px; padding-left: 6px; padding-right: 6px;";
      }
      return super.getCss(c);
    }
  };
  roleNameLayout.setWidth("100%");
}

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

protected void removeNewTabWindow(Screen screen) {
  WebTabWindow window = (WebTabWindow) screen.getWindow();
  com.vaadin.ui.Component windowComposition = window.unwrapComposition(com.vaadin.ui.Component.class);
  TabWindowContainer windowContainer = (TabWindowContainer) windowComposition.getParent();
  windowContainer.removeComponent(windowComposition);
  WebAppWorkArea workArea = getConfiguredWorkArea();
  boolean allWindowsRemoved;
  if (workArea.getMode() == Mode.TABBED) {
    TabSheetBehaviour tabSheet = workArea.getTabbedWindowContainer().getTabSheetBehaviour();
    tabSheet.silentCloseTabAndSelectPrevious(windowContainer);
    tabSheet.removeComponent(windowContainer);
    allWindowsRemoved = tabSheet.getComponentCount() == 0;
  } else {
    Layout singleLayout = workArea.getSingleWindowContainer();
    singleLayout.removeComponent(windowContainer);
    allWindowsRemoved = true;
  }
  WindowBreadCrumbs windowBreadCrumbs = windowContainer.getBreadCrumbs();
  if (windowBreadCrumbs != null) {
    windowBreadCrumbs.setWindowNavigateHandler(null);
    windowBreadCrumbs.removeWindow();
  }
  if (allWindowsRemoved) {
    workArea.switchTo(AppWorkArea.State.INITIAL_LAYOUT);
  }
}

代码示例来源:origin: nz.co.senanque/madura-workflow-vaadin

public void load(final long pid) {
  panel.removeAllComponents();
  final Upload upload = new Upload(null, receiver);
  upload.setImmediate(true);
  upload.setButtonCaption(m_messageSourceAccessor.getMessage("upload.file", "Upload File"));
  checkbox = new CheckBox(m_messageSourceAccessor.getMessage("upload.protected", "Protected"));
  comment = new TextField(m_messageSourceAccessor.getMessage("upload.comment", "Comment"));
  panel.addComponent(comment);
  panel.addComponent(checkbox);
  panel.addComponent(upload);
  upload.addFinishedListener(new Upload.FinishedListener() {
    private static final long serialVersionUID = 1L;
    public void uploadFinished(FinishedEvent event) {
      Attachment attachment = receiver.getWrapper().getCurrentAttachment();
      attachment.setProcessInstanceId(pid);
      attachment.setComment((String)comment.getValue());
      attachment.setProtectedDocument((boolean)checkbox.getValue());
      m_workflowDAO.addAttachment(attachment);
      close();
    }
  });
  
  if (getParent() == null) {
    UI.getCurrent().addWindow(this);
    this.center();
  }
}
public void close() {

相关文章