Java 类com.vaadin.ui.ComponentContainer 实例源码

项目:holon-vaadin7    文件:DefaultComponentContainerComposer.java   
@Override
public void compose(ComponentContainer content, PropertyValueComponentSource source) {
    // remove all components
    content.removeAllComponents();
    // add components
    source.getValueComponents().forEach(valueComponent -> {
        final Component component = valueComponent.getComponent();
        if (component == null) {
            throw new RuntimeException(
                    "The value component [" + valueComponent + "] returned a null component from getComponent()");
        }
        if (isFullWidthComponents()) {
            component.setWidth("100%");
        }
        content.addComponent(component);
    });
}
项目:SecureBPMN    文件:AttachmentDetailPopupWindow.java   
public AttachmentDetailPopupWindow(Attachment attachment) {
  super(attachment.getName());

  addStyleName(Reindeer.PANEL_LIGHT);
  center();
  setModal(true);
  setResizable(false);

  AttachmentRenderer renderer = ExplorerApp.get().getAttachmentRendererManager().getRenderer(attachment.getType());
  Component detail = renderer.getDetailComponent(attachment);

  if(detail instanceof ComponentContainer) {
    setContent((ComponentContainer) detail);
  } else {
    addComponent(detail);
  }
  getContent().setSizeUndefined();
}
项目:minimal-j    文件:VaadinDialog.java   
public VaadinDialog(ComponentContainer content, String title, Action saveAction, Action closeAction) {
    super(title, content);
    this.saveAction = saveAction;
    this.closeAction = closeAction;

    setModal(true);
    addCloseListener(new VaadinDialogListener());

    VaadinComponentWithWidth componentWithWidth = findComponentWithWidth(content);
    if (componentWithWidth != null) {
        setWidth(componentWithWidth.getDialogWidth() + "ex");
    }

    UI.getCurrent().addWindow(this);
    VaadinFrontend.focusFirstComponent(getContent());
}
项目:minimal-j    文件:VaadinDialog.java   
private static VaadinComponentWithWidth findComponentWithWidth(Component c) {
    if (c instanceof VaadinComponentWithWidth) {
        return (VaadinComponentWithWidth) c;
    } else if (c instanceof Panel) {
        Panel panel = (Panel) c;
        return findComponentWithWidth(panel.getContent());
    } else if (c instanceof ComponentContainer) {
        ComponentContainer container = (ComponentContainer) c;
        Iterator<Component> componentIterator = container.getComponentIterator();
        while (componentIterator.hasNext()) {
            VaadinComponentWithWidth componentWithWidth = findComponentWithWidth(componentIterator.next());
            if (componentWithWidth != null) {
                return componentWithWidth;
            }
        }
    }
    return null;
}
项目:openeos    文件:TasksWindow.java   
private ComponentContainer createSummaryButtons(final UserTask task) {

        Button completeButton = new Button("Task completed");
        completeButton.setWidth("100%");
        completeButton.addListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                completeTask(task);
            }
        });

        VerticalLayout buttonsLayout = new VerticalLayout();
        buttonsLayout.addComponent(completeButton);
        buttonsLayout.setWidth(16, VerticalLayout.UNITS_EM);
        return buttonsLayout;

    }
项目:FiWare-Template-Handler    文件:AttachmentDetailPopupWindow.java   
public AttachmentDetailPopupWindow(Attachment attachment) {
  super(attachment.getName());

  addStyleName(Reindeer.PANEL_LIGHT);
  center();
  setModal(true);
  setResizable(false);

  AttachmentRenderer renderer = ExplorerApp.get().getAttachmentRendererManager().getRenderer(attachment.getType());
  Component detail = renderer.getDetailComponent(attachment);

  if(detail instanceof ComponentContainer) {
    setContent((ComponentContainer) detail);
  } else {
    addComponent(detail);
  }
  getContent().setSizeUndefined();
}
项目:abstractform    文件:VaadinFormToolkit.java   
@Override
public VaadinFormInstance buildForm(Form form, Map<String, Object> extraObjects) {
    VerticalLayout layout = new VerticalLayout();
    Map<String, AbstractComponent> mapComponents = new HashMap<String, AbstractComponent>();
    List<String> fieldIdList = new ArrayList<String>();
    layout.setSpacing(true);
    layout.setSizeFull();
    for (Component part : form.getChildList()) {
        ComponentContainer container = buildComponent(part, mapComponents, fieldIdList, extraObjects);
        if (container != null) {
            layout.addComponent(container);
        }
    }
    addComponent(mapComponents, form, layout);
    VaadinFormInstance formInstance = new VaadinFormInstanceImpl(layout, Collections.unmodifiableMap(mapComponents),
            Collections.unmodifiableList(fieldIdList));

    //build SelectorProviders
    buildSelectorProviders(mapComponents, formInstance);
    return formInstance;
}
项目:mycollab    文件:AbstractListItemComp.java   
private ComponentContainer buildControlsLayout() {
    MHorizontalLayout viewControlsLayout = new MHorizontalLayout().withStyleName(WebThemes.TABLE_ACTION_CONTROLS).withFullWidth();

    selectOptionButton = new SelectionOptionButton(tableItem);
    selectOptionButton.setSizeUndefined();
    tableActionControls = createActionControls();

    MHorizontalLayout leftContainer = new MHorizontalLayout(selectOptionButton, tableActionControls, selectedItemsNumberLabel);
    leftContainer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    extraControlsLayout = new ButtonGroup();
    buildExtraControls();

    viewControlsLayout.with(leftContainer, extraControlsLayout).withAlign(leftContainer, Alignment.MIDDLE_LEFT)
            .withAlign(extraControlsLayout, Alignment.MIDDLE_RIGHT);
    return viewControlsLayout;
}
项目:xaadin    文件:Parser.java   
private VisualTreeNode parseVisualTree(ComponentContainer parent, Reader inputStream, Object eventHandlerTarget) throws ParserException {

        SAXBuilder builder = new SAXBuilder(XMLReaders.NONVALIDATING);

        try {
            Document doc = builder.build(inputStream);
            //FIXME: I think this is not needed with XSD schema. Please use schema validation instead!
            if (!doc.hasRootElement() && (doc.getRootElement().getName().equalsIgnoreCase(Constants.XAADIN_ROOT_ELEMENT_NAME))) {
                throw new ParserException("could not find root rootElement with name xaadin");
            }

            Element rootElement = doc.getRootElement();
            xaadinNamespace = getDefaultXaadinNamespace(rootElement);
            List<Element> childrenList = rootElement.getChildren();
            if (childrenList.isEmpty()) {
                throw new ParserException("xaadin root element is empty");
            }
            return parseVisualTreeInt(childrenList.get(0), null, eventHandlerTarget, parent);
        } catch (Exception e) {
            throw new ParserException(e);
        }
    }
项目:mycollab    文件:OpportunityReadViewImpl.java   
@Override
protected ComponentContainer createBottomPanel() {
    MVerticalLayout toolbarLayout = new MVerticalLayout().withFullWidth().withSpacing(false).withMargin(false);

    Component contactSection = FormSectionBuilder.build(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT),
            associateContacts);
    toolbarLayout.addComponent(contactSection);

    Component leadSection = FormSectionBuilder.build(CrmAssetsManager.getAsset(CrmTypeConstants.LEAD),
            associateLeads);
    toolbarLayout.addComponent(leadSection);

    Component activitySection = FormSectionBuilder.build(CrmAssetsManager.getAsset(CrmTypeConstants.ACTIVITY),
            associateActivities);
    toolbarLayout.addComponent(activitySection);

    return toolbarLayout;
}
项目:mycollab    文件:AccountReadViewImpl.java   
@Override
protected ComponentContainer createBottomPanel() {
    MVerticalLayout toolbarLayout = new MVerticalLayout().withFullWidth().withSpacing(false).withMargin(false);
    Component contactSection = FormSectionBuilder.build(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT),
            associateContacts);
    toolbarLayout.addComponent(contactSection);

    Component leadSection = FormSectionBuilder.build(CrmAssetsManager.getAsset(CrmTypeConstants.LEAD),
            associateLeads);
    toolbarLayout.addComponent(leadSection);

    Component opportunitySection = FormSectionBuilder.build(CrmAssetsManager.getAsset(CrmTypeConstants.OPPORTUNITY),
            associateOpportunities);
    toolbarLayout.addComponent(opportunitySection);

    Component caseSection = FormSectionBuilder.build(CrmAssetsManager.getAsset(CrmTypeConstants.CASE),
            associateCases);
    toolbarLayout.addComponent(caseSection);

    Component activitySection = FormSectionBuilder.build(CrmAssetsManager.getAsset(CrmTypeConstants.ACTIVITY),
            associateActivities);
    toolbarLayout.addComponent(activitySection);
    return toolbarLayout;
}
项目:mycollab    文件:CampaignReadViewImpl.java   
@Override
protected ComponentContainer createBottomPanel() {
    MVerticalLayout toolbarLayout = new MVerticalLayout().withFullWidth().withSpacing(false).withMargin(false);

    Component accountSection = FormSectionBuilder.build(CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT),
            associateAccounts);
    toolbarLayout.addComponent(accountSection);

    Component contactSection = FormSectionBuilder.build(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT),
            associateContacts);
    toolbarLayout.addComponent(contactSection);

    Component leadSection = FormSectionBuilder.build(CrmAssetsManager.getAsset(CrmTypeConstants.LEAD),
            associateLeads);
    toolbarLayout.addComponent(leadSection);

    Component activitySection = FormSectionBuilder.build(CrmAssetsManager.getAsset(CrmTypeConstants.ACTIVITY),
            associateActivities);
    toolbarLayout.addComponent(activitySection);

    return toolbarLayout;
}
项目:mycollab    文件:TicketCloseTrendChartWidget.java   
@Override
protected final ComponentContainer createLegendBox() {
    final CssLayout mainLayout = new CssLayout();
    mainLayout.setWidth("100%");
    mainLayout.addStyleName("legendBoxContent");
    final List series = dataSet.getSeries();

    for (int i = 0; i < series.size(); i++) {
        final MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true));
        layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

        final TimeSeries key = (TimeSeries) series.get(i);
        int colorIndex = i % CHART_COLOR_STR.size();
        final String color = "<div style = \" width:13px;height:13px;background: #" + CHART_COLOR_STR.get(colorIndex) + "\" />";
        final ELabel lblCircle = ELabel.html(color);

        String captionBtn = UserUIContext.getMessage(StatusI18nEnum.class, (String) key.getKey());
        final MButton btnLink = new MButton(StringUtils.trim(captionBtn, 30, true)).withDescription
                (captionBtn).withStyleName(WebThemes.BUTTON_LINK);
        layout.with(lblCircle, btnLink);
        mainLayout.addComponent(layout);
    }

    return mainLayout;
}
项目:mycollab    文件:ComponentAddWindow.java   
ComponentAddWindow() {
    super(UserUIContext.getMessage(ComponentI18nEnum.NEW));
    AdvancedEditBeanForm<Component> editForm = new AdvancedEditBeanForm<>();
    editForm.addFormHandler(this);
    editForm.setFormLayoutFactory(new DefaultDynaFormLayout(ProjectTypeConstants.BUG_COMPONENT,
            ComponentDefaultFormLayoutFactory.getForm(), "id"));
    editForm.setBeanFormFieldFactory(new ComponentEditFormFieldFactory(editForm));
    Component component = new Component();
    component.setProjectid(CurrentProjectVariables.getProjectId());
    component.setSaccountid(AppUI.getAccountId());
    component.setStatus(OptionI18nEnum.StatusI18nEnum.Open.name());
    editForm.setBean(component);
    ComponentContainer buttonControls = generateEditFormControls(editForm, true, false, true);
    this.setContent(new MVerticalLayout(editForm, buttonControls).withAlign(buttonControls, Alignment.TOP_RIGHT));
    this.withWidth("750px").withModal(true).withResizable(false).withCenter();
}
项目:mycollab    文件:VersionAddWindow.java   
VersionAddWindow() {
    super(UserUIContext.getMessage(VersionI18nEnum.NEW));
    AdvancedEditBeanForm<Version> editForm = new AdvancedEditBeanForm<>();
    editForm.addFormHandler(this);
    editForm.setFormLayoutFactory(new DefaultDynaFormLayout(ProjectTypeConstants.BUG_VERSION,
            VersionDefaultFormLayoutFactory.getForm(), "id"));
    editForm.setBeanFormFieldFactory(new VersionEditFormFieldFactory(editForm));
    Version version = new Version();
    version.setProjectid(CurrentProjectVariables.getProjectId());
    version.setSaccountid(AppUI.getAccountId());
    version.setStatus(StatusI18nEnum.Open.name());
    editForm.setBean(version);
    ComponentContainer buttonControls = generateEditFormControls(editForm, true, false, true);
    withWidth("750px").withModal(true).withResizable(false).withContent(new MVerticalLayout(editForm,
            buttonControls).withAlign(buttonControls, Alignment.TOP_RIGHT)).withCenter();
}
项目:mycollab    文件:AbstractEditItemComp.java   
@Override
public AbstractComponent getLayout() {
    final AddViewLayout formAddLayout = new AddViewLayout(initFormHeader(), initFormIconResource());

    final ComponentContainer buttonControls = createButtonControls();
    if (buttonControls != null) {
        formAddLayout.addHeaderRight(buttonControls);
    }

    formAddLayout.setTitle(initFormTitle());
    wrappedLayoutFactory = initFormLayoutFactory();
    formAddLayout.addBody(wrappedLayoutFactory.getLayout());

    final ComponentContainer bottomPanel = createBottomPanel();
    if (bottomPanel != null) {
        formAddLayout.addBottom(bottomPanel);
    }

    return formAddLayout;
}
项目:mycollab    文件:MassUpdateWindow.java   
protected ComponentContainer buildButtonControls() {
    MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(true).withFullWidth();

    updateBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_UPDATE_LABEL), clickEvent -> {
        updateForm.commit();
        massUpdateCommand.massUpdate(beanItem);
        close();
    }).withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.SAVE);

    closeBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLOSE), clickEvent -> close())
            .withStyleName(WebThemes.BUTTON_OPTION);

    Label spacing = new Label();
    controlsLayout.with(spacing, closeBtn, updateBtn).alignAll(Alignment.MIDDLE_RIGHT).expand(spacing);
    return controlsLayout;
}
项目:holon-vaadin    文件:DefaultPropertyInputForm.java   
/**
 * Constructor
 * @param content Form composition content
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
public DefaultBuilder(C content) {
    super(new DefaultPropertyInputForm<>(content));
    this.inputGroupBuilder = new DefaultPropertyInputGroup.InternalBuilder();

    // setup default composer
    if (getInstance().getComposer() == null) {
        if (content instanceof ComponentContainer) {
            getInstance().setComposer((Composer) ComposableComponent.componentContainerComposer());
        }
    }
}
项目:holon-vaadin    文件:DefaultPropertyViewForm.java   
/**
 * Constructor
 * @param content Form composition content
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
public DefaultBuilder(C content) {
    super(new DefaultPropertyViewForm<>(content));
    this.viewGroupBuilder = new DefaultPropertyViewGroup.InternalBuilder();

    // setup default composer
    if (getInstance().getComposer() == null) {
        if (content instanceof ComponentContainer) {
            getInstance().setComposer((Composer) ComposableComponent.componentContainerComposer());
        }
    }
}
项目:imotSpot    文件:DashboardNavigator.java   
public DashboardNavigator(final ComponentContainer container) {
    super(UI.getCurrent(), container);

    String host = getUI().getPage().getLocation().getHost();
    if (TRACKER_ID != null && host.endsWith("demo.vaadin.com")) {
        initGATracker(TRACKER_ID);
    }
    initViewChangeListener();
    initViewProviders();

}
项目:imotSpot    文件:MainView.java   
public MainView() {
    setSizeFull();
    addStyleName("mainview");

    addComponent(new DashboardMenu());

    ComponentContainer content = new CssLayout();
    content.addStyleName("view-content");
    content.setSizeFull();
    addComponent(content);
    setExpandRatio(content, 1.0f);

    new DashboardNavigator(content);
}
项目:vaadin-vertx-samples    文件:DashboardNavigator.java   
public DashboardNavigator(final ComponentContainer container) {
    super(UI.getCurrent(), container);

    String host = getUI().getPage().getLocation().getHost();
    if (TRACKER_ID != null && host.endsWith("demo.vaadin.com")) {
        initGATracker(TRACKER_ID);
    }
    initViewChangeListener();
    initViewProviders();

}
项目:vaadin-vertx-samples    文件:MainView.java   
public MainView() {
    setSizeFull();
    addStyleName("mainview");

    addComponent(new DashboardMenu());

    ComponentContainer content = new CssLayout();
    content.addStyleName("view-content");
    content.setSizeFull();
    addComponent(content);
    setExpandRatio(content, 1.0f);

    new DashboardNavigator(content);
}
项目:vaadin-with-rxjava    文件:SafeUiObserver.java   
public SafeUiObserver(final ComponentContainer targetContainer, final UI ui) {
    this.targetContainer = targetContainer;
    this.ui = Preconditions.checkNotNull(ui);

    targetContainer.addDetachListener(event -> updater.stop());
    if (!targetContainer.isAttached()) {
        //start if UI element is attached 
        targetContainer.addAttachListener(event -> this.startUpdater());
    } else {
        //start immediately
        this.startUpdater();
    }
}
项目:cuba    文件:WebRelatedEntities.java   
protected void refreshNavigationActions() {
    ComponentContainer actionContainer = (ComponentContainer) vPopupComponent;

    actionContainer.removeAllComponents();
    actionOrder.clear();

    if (listComponent != null) {
        MetaClass metaClass = listComponent.getDatasource().getMetaClass();

        Pattern excludePattern = null;
        if (excludeRegex != null) {
            excludePattern = Pattern.compile(excludeRegex);
        }

        for (MetaProperty metaProperty : metaClass.getProperties()) {
            if (RelatedEntitiesSecurity.isSuitableProperty(metaProperty, metaClass)
                    && (excludePattern == null || !excludePattern.matcher(metaProperty.getName()).matches())) {
                addNavigationAction(metaClass, metaProperty);
            }
        }

        if (actionContainer.getComponentCount() == 0) {
            Messages messages = AppBeans.get(Messages.NAME);
            actionContainer.addComponent(new Label(messages.getMainMessage("actions.Related.Empty")));
        }
    }
}
项目:minimal-j    文件:Vaadin.java   
@Override
public <T> IDialog showSearchDialog(Search<T> search, Object[] keys, TableActionListener<T> listener) {
    Component component = new VaadinSearchPanel<>(search, keys, listener);
    VaadinDialog dialog = new VaadinDialog((ComponentContainer) component, "Search", null, null);
    dialog.setHeight("25em");
    return dialog;
}
项目:minimal-j    文件:VaadinFrontend.java   
private static AbstractField<?> findAbstractField(Component c) {
    if (c instanceof AbstractField) {
        return ((AbstractField<?>) c);
    } else if (c instanceof ComponentContainer) {
        ComponentContainer container = (ComponentContainer) c;
        Iterator<Component> components = container.iterator();
        while (components.hasNext()) {
            AbstractField<?> field = findAbstractField(components.next());
            if (field != null) {
                return field;
            }
        }
    }
    return null;
}
项目:jain-I18n    文件:JLoginHandler.java   
/**
 * Once user log in into the application we need to call this API by passing a root.<br/>
 * This calls out all the {@link JNILoginListner} components onLogin method.  
 * @param container
 */
public static void onLogin (HasComponents container) {
    for (Component component : container) {
        if (component instanceof JNILoginListner)
            ((JNILoginListner) component).onLogin();

        if (component instanceof ComponentContainer)
            onLogin((ComponentContainer)component);
    }
}
项目:sensorhub    文件:GenericConfigForm.java   
protected ComponentContainer buildSubForm(final String propId, final ComplexProperty prop)
{
    Class<?> beanType = prop.getBeanType();
    MyBeanItem<Object> childBeanItem = prop.getValue();

    // generate custom form for this bean type
    IModuleConfigForm subform;
    if (childBeanItem != null)
        subform = AdminUI.getInstance().generateForm(childBeanItem.getBean().getClass());
    else
        subform = AdminUI.getInstance().generateForm(beanType);
    subform.build(propId, prop);

    // add change button if property is changeable module config
    Class<?> changeableBeanType = subform.getPolymorphicBeanParentType();
    if (changeableBeanType != null)
        addChangeModuleButton(subform, propId, prop, changeableBeanType);
    else if (ModuleConfig.class.isAssignableFrom(beanType))
        addChangeModuleButton(subform, propId, prop, beanType);

    // add change button if property can have multiple types
    Map<String, Class<?>> possibleTypes = getPossibleTypes(propId);
    if (!(possibleTypes == null || possibleTypes.isEmpty()))
        addChangeObjectButton(subform, propId, prop, possibleTypes);

    if (childBeanItem != null)
        allForms.add(subform);

    return subform;
}
项目:sensorhub    文件:GenericConfigForm.java   
protected void addChangeModuleButton(final ComponentContainer parentForm, final String propId, final ComplexProperty prop, final Class<?> objectType)
{
    final Button chgButton = new Button("Modify");
    //chgButton.addStyleName(STYLE_QUIET);
    chgButton.addStyleName(STYLE_SMALL);
    chgButton.addStyleName(STYLE_SECTION_BUTTONS);
    chgButton.setIcon(REFRESH_ICON);

    chgButton.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;
        public void buttonClick(ClickEvent event)
        {
            // show popup to select among available module types
            ModuleTypeSelectionPopup popup = new ModuleTypeSelectionPopup(objectType, new ModuleTypeSelectionCallback() {
                public void configSelected(Class<?> moduleType, ModuleConfig config)
                {
                    // regenerate form
                    config.id = null;
                    config.name = null;
                    MyBeanItem<Object> newItem = new MyBeanItem<Object>(config, propId + ".");
                    prop.setValue(newItem);
                    IModuleConfigForm newForm = AdminUI.getInstance().generateForm(config.getClass());
                    newForm.build(propId, prop);
                    ((VerticalLayout)newForm).addComponent(chgButton, 0);

                    // replace old form in UI
                    allForms.add(newForm);
                    allForms.remove((IModuleConfigForm)chgButton.getData());
                    replaceComponent((Component)chgButton.getData(), newForm);
                    chgButton.setData(newForm);
                }
            });
            popup.setModal(true);
            AdminUI.getInstance().addWindow(popup);
        }
    });

    chgButton.setData(parentForm);
    ((VerticalLayout)parentForm).addComponent(chgButton, 0);
}
项目:metl    文件:ViewManager.java   
public void init(AppUI ui, ComponentContainer container) {
    navigator = new Navigator(ui, container);
    navigator.setErrorView(new PageNotFoundView(this));
    if (views != null) {
        for (View view : views) {
            TopBarLink menu = (TopBarLink) view.getClass().getAnnotation(TopBarLink.class);
            if (menu != null && menu.uiClass().equals(AppUI.class)) {
                navigator.addView(menu.id(), view);
            }
        }
    }
}
项目:field-binder    文件:FieldBinderSearchFieldManager.java   
private void replace(Field<?> original, Field<?> replacement) {
    HasComponents parent = original.getParent();
    if (parent instanceof ComponentContainer) {
        ((ComponentContainer) parent).replaceComponent(original, replacement);
    } else {
        throw new UnsupportedOperationException(
                "Cannot replace Field "+original +
                        "; the parent does not support component replacement");
    }
}
项目:openeos    文件:OpenWindowCommand.java   
@Override
public void menuSelected(MenuItem selectedItem) {
    if (windowComponent == null)
        windowComponent = windowFactory.createWindowComponent(window, application);
    final TabSheet tabSheet = application.getConcreteApplication().getMainTabSheet();
    tabSheet.addListener(new ComponentContainer.ComponentDetachListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void componentDetachedFromContainer(ComponentDetachEvent event) {
            if (event.getDetachedComponent() == windowComponent) {
                windowComponent = null;
                tabSheet.removeListener(this);
            }
        }
    });
    Tab tab = tabSheet.addTab(windowComponent, window.getName());
    tab.setClosable(true);
    tab.setDescription(window.getDescription());
    tabSheet.setSelectedTab(tab);
}
项目:openeos    文件:AbstractFormVaadinWindow.java   
@Override
protected ComponentContainer createMainContainer() {
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    layout.setMargin(false);
    return layout;
}
项目:openeos    文件:UIApplicationImpl.java   
@Override
public <U> UIDialog showGenericFormDialog(BForm<U> form, U bean) {
    Map<String, Object> extraObjects = new HashMap<String, Object>();
    extraObjects.put(UIVaadinFormToolkit.EXTRA_OBJECT_APPLICATION, this);
    VaadinBindingFormInstance formInstance = vaadinToolkit.buildForm(form, commonBindingToolkit, extraObjects, false);

    Window window = new Window(form.getName());
    window.setModal(true);
    window.addComponent((ComponentContainer) formInstance.getImplementation());
    formInstance.setValue(bean);

    HorizontalLayout footer = new HorizontalLayout();
    footer.setWidth(100, HorizontalLayout.UNITS_PERCENTAGE);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    Button buttonOk = new Button("Ok");
    buttons.addComponent(buttonOk);
    Button buttonCancel = new Button("Cancel");
    buttons.addComponent(buttonCancel);

    footer.addComponent(buttons);
    footer.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT);
    window.addComponent(footer);
    ((VerticalLayout) window.getContent()).setComponentAlignment(footer, Alignment.BOTTOM_CENTER);
    window.getContent().setSizeFull();
    vaadinApplication.getMainWindow().addWindow(window);

    return new UIDialogImpl(window, buttonOk, buttonCancel, formInstance);

}
项目:openeos    文件:UIApplicationImpl.java   
private <T> UIDialog showFormDialog(Class<T> modelClass, UIBean model, BindingFormCapability capability) {
    AbstractFormBindingForm<T> form = formRegistryService.getDefaultForm(modelClass, AbstractFormBindingForm.class, capability);
    Map<String, Object> extraObjects = new HashMap<String, Object>();
    extraObjects.put(UIVaadinFormToolkit.EXTRA_OBJECT_APPLICATION, this);
    VaadinBindingFormInstance formInstance = vaadinToolkit.buildForm(form.getAbstractBForm(), uiBeanBindingToolkit,
            extraObjects, false);

    Window window = new Window(form.getAbstractBForm().getName());
    window.setModal(true);
    window.addComponent((ComponentContainer) formInstance.getImplementation());
    formInstance.setValue(model);

    HorizontalLayout footer = new HorizontalLayout();
    footer.setWidth(100, HorizontalLayout.UNITS_PERCENTAGE);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    Button buttonOk = new Button("Ok");
    buttons.addComponent(buttonOk);
    Button buttonCancel = new Button("Cancel");
    buttons.addComponent(buttonCancel);

    footer.addComponent(buttons);
    footer.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT);
    window.addComponent(footer);
    ((VerticalLayout) window.getContent()).setComponentAlignment(footer, Alignment.BOTTOM_CENTER);
    window.getContent().setSizeFull();
    vaadinApplication.getMainWindow().addWindow(window);

    return new UIDialogImpl(window, buttonOk, buttonCancel, formInstance);
}
项目:abstractform    文件:VaadinBindingFormToolkit.java   
@Override
public VaadinBindingFormInstance buildForm(Form form, Map<String, Object> extraObjects) {
    VaadinFormInstance delegate = (VaadinFormInstance) delegateToolKit.buildForm(form, extraObjects);
    ComponentContainer c = addValidationSummaryField(delegate.getImplementation(), false);
    VaadinBindingFormInstance<?> formInstance = new VaadinBindingFormInstanceImpl<Object>(c, (ComponentContainer) c
            .getComponentIterator().next(), delegate);
    replaceFormInstanceReferences(delegate, formInstance);
    return formInstance;
}
项目:abstractform    文件:VaadinBindingFormToolkit.java   
private ComponentContainer addValidationSummaryField(Component oldMain, boolean validationSummaryVisible) {
    // add error sumary layout
    VerticalLayout main = new VerticalLayout();
    VerticalLayout summary = new VerticalLayout();
    summary.setVisible(validationSummaryVisible);
    main.addComponent(summary);
    main.addComponent(oldMain);
    return main;
}
项目:abstractform    文件:VaadinBindingFormToolkit.java   
@Override
public <S> VaadinBindingFormInstance<S> buildForm(BForm<S> form, BindingToolkit bindingToolkit,
        Map<String, Object> extraObjects, boolean immediate) {
    VaadinFormInstance delegate = (VaadinFormInstance) delegateToolKit.buildForm(form, extraObjects);
    ComponentContainer c = addValidationSummaryField(delegate.getImplementation(), form.isValidationSummaryVisible());
    VaadinBindingFormInstanceImpl<S> instance = new VaadinBindingFormInstanceImpl<S>(c, (ComponentContainer) c
            .getComponentIterator().next(), delegate);
    bindingToolkit.bindFields(instance, form);
    replaceFormInstanceReferences(delegate, instance);
    return instance;
}
项目:abstractform    文件:VaadinFormToolkit.java   
private AbstractComponentContainer buildDrawer(final Drawer drawer, Map<String, AbstractComponent> mapComponents,
        List<String> fieldIdList, Map<String, Object> extraObjects) {
    VerticalLayout layout = new VerticalLayout();
    final Button button = new Button();
    // button.setStyleName(BaseTheme.BUTTON_LINK);
    button.setCaption("\u25B6" + drawer.getName());
    final VerticalLayout innerLayout = new VerticalLayout();
    for (Component component : drawer.getChildList()) {
        ComponentContainer container = buildComponent(component, mapComponents, fieldIdList, extraObjects);
        innerLayout.addComponent(container);
    }
    button.addListener(new Button.ClickListener() {

        private static final long serialVersionUID = 4970466538378502562L;

        @Override
        public void buttonClick(ClickEvent event) {
            innerLayout.setVisible(!innerLayout.isVisible());
            if (innerLayout.isVisible()) {
                button.setCaption("\u25BC" + drawer.getName());
            } else {
                button.setCaption("\u25B6" + drawer.getName());

            }
        }
    });
    layout.addComponent(button);
    layout.addComponent(innerLayout);
    innerLayout.setVisible(false);
    return layout;
}