com.vaadin.ui.ComponentContainer Java Examples

The following examples show how to use com.vaadin.ui.ComponentContainer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ComponentAddWindow.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
ComponentAddWindow() {
    super(UserUIContext.getMessage(ComponentI18nEnum.NEW));
    AdvancedEditBeanForm<Component> editForm = new AdvancedEditBeanForm<>();
    editForm.addFormHandler(this);
    editForm.setFormLayoutFactory(new DefaultDynaFormLayout(ProjectTypeConstants.COMPONENT,
            ComponentDefaultFormLayoutFactory.getAddForm(), "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();
}
 
Example #2
Source File: FormFactoryImpl.java    From cia with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the display property converters.
 *
 * @param                     <T> the generic type
 * @param displayProperties   the display properties
 * @param formContent         the form content
 * @param binder              the binder
 * @param propertyDescriptors the property descriptors
 */
private static <T extends Serializable> void createDisplayPropertyConverters(final List<String> displayProperties,
		final ComponentContainer formContent, final Binder<T> binder, final PropertyDescriptor[] propertyDescriptors) {
	for (final String property : displayProperties) {
		final Class<?> typeOfProperty = getTypeOfProperty(propertyDescriptors, property);

		if (typeOfProperty != null) {
			final AbstractField<?> field = new TextField();
			field.setReadOnly(true);
			field.setCaption(property);
			field.setWidth(ContentSize.FULL_SIZE);
			formContent.addComponent(field);
			final Converter converter = getConverterForType(typeOfProperty);

			if (converter != null) {
				binder.forField(field).withConverter(converter).bind(property);
			} else {
				binder.forField(field).bind(property);
			} 
		}
	}
}
 
Example #3
Source File: MassUpdateWindow.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
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(VaadinIcons.CLIPBOARD);

    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;
}
 
Example #4
Source File: RoleListViewImpl.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
private ComponentContainer constructTableActionControls() {
    MHorizontalLayout layout = new MHorizontalLayout();
    MCssLayout layoutWrapper = new MCssLayout(layout).withFullWidth().withStyleName(WebThemes.TABLE_ACTION_CONTROLS);

    selectOptionButton = new SelectionOptionButton(tableItem);
    layout.addComponent(selectOptionButton);

    tableActionControls = new DefaultMassItemActionHandlerContainer();
    if (UserUIContext.canAccess(RolePermissionCollections.ACCOUNT_ROLE)) {
        tableActionControls.addDeleteActionItem();
    }
    tableActionControls.addDownloadPdfActionItem();
    tableActionControls.addDownloadExcelActionItem();
    tableActionControls.addDownloadCsvActionItem();

    layout.with(tableActionControls, selectedItemsNumberLabel).withAlign(selectedItemsNumberLabel, Alignment.MIDDLE_LEFT);
    return layoutWrapper;
}
 
Example #5
Source File: DefaultTabSheetDropHandler.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
protected void handleDropFromLayout(DragAndDropEvent event) {
    LayoutBoundTransferable transferable = (LayoutBoundTransferable) event
            .getTransferable();
    TabSheetTargetDetails details = (TabSheetTargetDetails) event
            .getTargetDetails();
    DDTabSheet tabSheet = (DDTabSheet) details.getTarget();
    Component c = transferable.getComponent();
    HorizontalDropLocation location = details.getDropLocation();
    int idx = details.getOverIndex();
    ComponentContainer source = (ComponentContainer) transferable
            .getSourceComponent();

    // Detach from old source
    if (source instanceof ComponentContainer) {
        ((ComponentContainer) source).removeComponent(c);
    } else if (source instanceof SingleComponentContainer) {
        ((SingleComponentContainer) source).setContent(null);
    }

    if (location == HorizontalDropLocation.LEFT) {
        tabSheet.addTab(c, idx);
    } else if (location == HorizontalDropLocation.RIGHT) {
        tabSheet.addTab(c, idx + 1);
    }
}
 
Example #6
Source File: DefaultCssLayoutDropHandler.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
protected void handleComponentReordering(DragAndDropEvent event) {
    // Component re-ordering
    LayoutBoundTransferable transferable = (LayoutBoundTransferable) event
            .getTransferable();
    CssLayoutTargetDetails details = (CssLayoutTargetDetails) event
            .getTargetDetails();
    DDCssLayout layout = (DDCssLayout) details.getTarget();
    Component comp = transferable.getComponent();
    int idx = details.getOverIndex();

    // Detach from old source
    Component source = transferable.getSourceComponent();
    if (source instanceof ComponentContainer) {
        ((ComponentContainer) source).removeComponent(comp);
    } else if (source instanceof SingleComponentContainer) {
        ((SingleComponentContainer) source).setContent(null);
    }

    // Add component
    if (idx >= 0 && idx < layout.getComponentCount()) {
        layout.addComponent(comp, idx);
    } else {
        layout.addComponent(comp);
    }
}
 
Example #7
Source File: ProjectActivityStreamPagedList.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
protected void feedBlocksPut(LocalDate currentDate, LocalDate nextDate, ComponentContainer currentBlock) {
    MHorizontalLayout blockWrapper = new MHorizontalLayout().withSpacing(false).withFullWidth().withStyleName
            ("feed-block-wrap");

    blockWrapper.setDefaultComponentAlignment(Alignment.TOP_LEFT);

    if (currentDate.getYear() != nextDate.getYear()) {
        int currentYear = nextDate.getYear();
        ELabel yearLbl = ELabel.html("<div>" + currentYear + "</div>").withStyleName("year-lbl").withUndefinedWidth();
        this.addComponent(yearLbl);
    } else {
        blockWrapper.setMargin(new MarginInfo(true, false, false, false));
    }
    ELabel dateLbl = new ELabel(UserUIContext.formatShortDate(nextDate)).withStyleName("date-lbl").withUndefinedWidth();
    blockWrapper.with(dateLbl, currentBlock).expand(currentBlock);

    this.addComponent(blockWrapper);
}
 
Example #8
Source File: DefaultPanelDropHandler.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
protected void handleDropFromLayout(DragAndDropEvent event) {
    LayoutBoundTransferable transferable = (LayoutBoundTransferable) event
            .getTransferable();
    PanelTargetDetails details = (PanelTargetDetails) event
            .getTargetDetails();
    Component component = transferable.getComponent();
    DDPanel panel = (DDPanel) details.getTarget();

    // Detach from old source
    Component source = transferable.getSourceComponent();
    if (source instanceof ComponentContainer) {
        ((ComponentContainer) source).removeComponent(component);
    } else if (source instanceof SingleComponentContainer) {
        ((SingleComponentContainer) source).setContent(null);
    }

    // Attach to new source
    panel.setContent(component);
}
 
Example #9
Source File: AbstractEditItemComp.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@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());

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

    return formAddLayout;
}
 
Example #10
Source File: ProjectRoleListViewImpl.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
private ComponentContainer constructTableActionControls() {
    MCssLayout layout = new MCssLayout().withStyleName(WebThemes.TABLE_ACTION_CONTROLS).withFullWidth();

    selectOptionButton = new SelectionOptionButton(tableItem);

    tableActionControls = new DefaultMassItemActionHandlerContainer();
    if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.ROLES)) {
        tableActionControls.addDeleteActionItem();
    }

    tableActionControls.addDownloadPdfActionItem();
    tableActionControls.addDownloadExcelActionItem();
    tableActionControls.addDownloadCsvActionItem();

    layout.add(selectOptionButton, tableActionControls, this.selectedItemsNumberLabel);
    return layout;
}
 
Example #11
Source File: ComponentListViewImpl.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
private ComponentContainer constructTableActionControls() {
    MCssLayout layout = new MCssLayout().withStyleName(WebThemes.TABLE_ACTION_CONTROLS).withFullWidth();

    selectOptionButton = new SelectionOptionButton(tableItem);

    tableActionControls = new DefaultMassItemActionHandlerContainer();
    if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.COMPONENTS)) {
        tableActionControls.addDeleteActionItem();
    }

    tableActionControls.addMailActionItem();
    tableActionControls.addDownloadPdfActionItem();
    tableActionControls.addDownloadExcelActionItem();
    tableActionControls.addDownloadCsvActionItem();

    layout.add(selectOptionButton, tableActionControls, selectedItemsNumberLabel);
    return layout;
}
 
Example #12
Source File: VersionAddWindow.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
VersionAddWindow() {
    super(UserUIContext.getMessage(VersionI18nEnum.NEW));
    AdvancedEditBeanForm<Version> editForm = new AdvancedEditBeanForm<>();
    editForm.addFormHandler(this);
    editForm.setFormLayoutFactory(new DefaultDynaFormLayout(ProjectTypeConstants.VERSION,
            VersionDefaultFormLayoutFactory.getAddForm(), "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,
            CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.VERSIONS),
            false, true);
    withWidth("750px").withModal(true).withResizable(false).withContent(new MVerticalLayout(editForm,
            buttonControls).withAlign(buttonControls, Alignment.TOP_RIGHT)).withCenter();
}
 
Example #13
Source File: VersionListViewImpl.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
private ComponentContainer constructTableActionControls() {
    final MCssLayout layoutWrapper = new MCssLayout().withFullWidth().withStyleName(WebThemes.TABLE_ACTION_CONTROLS);

    selectOptionButton = new SelectionOptionButton(tableItem);

    tableActionControls = new DefaultMassItemActionHandlerContainer();

    if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.VERSIONS)) {
        tableActionControls.addDeleteActionItem();
    }

    tableActionControls.addMailActionItem();
    tableActionControls.addDownloadPdfActionItem();
    tableActionControls.addDownloadExcelActionItem();
    tableActionControls.addDownloadCsvActionItem();

    layoutWrapper.add(selectOptionButton, tableActionControls, selectedItemsNumberLabel);
    return layoutWrapper;
}
 
Example #14
Source File: DefaultTicketGroupComponent.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void refresh() {
    if (wrapBody.getComponentCount() > 0) {
        updateTitle();
    } else {
        ComponentContainer parent = (ComponentContainer) getParent();
        if (parent != null) {
            parent.removeComponent(this);
        }
    }
}
 
Example #15
Source File: CubaMainTabSheet.java    From cuba with Apache License 2.0 5 votes vote down vote up
public void closeOtherTabs(Component currentTab) {
    if (closeOthersHandler == null) {
        throw new IllegalStateException("CubaTabSheet closeOthersHandler is not set");
    }

    closeOthersHandler.accept((ComponentContainer) currentTab);
}
 
Example #16
Source File: CubaRowsCount.java    From cuba with Apache License 2.0 5 votes vote down vote up
public CubaRowsCount() {
    setStyleName("c-paging");
    setMargin(new MarginInfo(false, false, false, true));

    ComponentContainer contentLayout = createContentLayout();
    addComponent(contentLayout);

    setWidth(100, Unit.PERCENTAGE);
}
 
Example #17
Source File: FormControlsGenerator.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public static <T> ComponentContainer generateEditFormControls(final AdvancedEditBeanForm<T> editForm, boolean
        isSaveBtnVisible, boolean isSaveAndNewBtnVisible, boolean isCancelBtnVisible) {
    MHorizontalLayout layout = new MHorizontalLayout();

    if (isCancelBtnVisible) {
        MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> editForm.fireCancelForm())
                .withStyleName(WebThemes.BUTTON_OPTION);
        layout.addComponent(cancelBtn);
    }

    if (isSaveAndNewBtnVisible) {
        MButton saveAndNewBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE_NEW), clickEvent -> {
            if (editForm.validateForm()) {
                editForm.fireSaveAndNewForm();
            }
        }).withIcon(VaadinIcons.CLIPBOARD_CROSS).withStyleName(WebThemes.BUTTON_ACTION);
        if (!isSaveBtnVisible) {
            saveAndNewBtn.withClickShortcut(KeyCode.ENTER);
        }
        layout.addComponent(saveAndNewBtn);
    }

    if (isSaveBtnVisible) {
        MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
            if (editForm.validateForm()) {
                editForm.fireSaveForm();
            }
        }).withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION)
                .withClickShortcut(KeyCode.ENTER);
        layout.addComponent(saveBtn);
    }

    return layout;
}
 
Example #18
Source File: Depot.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public Depot(String title, ComponentContainer content) {
    this.setSpacing(false);
    this.setMargin(false);
    this.addStyleName("depot");
    header = new MHorizontalLayout().withStyleName("depot-header");
    bodyContent = content;
    bodyContent.setWidth("100%");
    headerContent = new MHorizontalLayout().withFullHeight().withUndefinedWidth().withVisible(false);
    this.addComponent(header);

    headerLbl = ELabel.h3("");
    setTitle(title);
    final MHorizontalLayout headerLeft = new MHorizontalLayout(headerLbl).withStyleName("depot-title")
            .withAlign(headerLbl, Alignment.MIDDLE_LEFT).withFullWidth();
    headerLeft.addLayoutClickListener(layoutClickEvent -> {
        isOpened = !isOpened;
        if (isOpened) {
            bodyContent.setVisible(true);
            header.removeStyleName(WebThemes.BORDER_BOTTOM);
        } else {
            bodyContent.setVisible(false);
            header.addStyleName(WebThemes.BORDER_BOTTOM);
        }
        setTitle(this.title);
    });
    header.with(headerLeft, headerContent).withAlign(headerLeft, Alignment.MIDDLE_LEFT).withAlign(headerContent,
            Alignment.MIDDLE_RIGHT).expand(headerLeft);

    bodyContent.addStyleName("depot-content");
    this.addComponent(bodyContent);
}
 
Example #19
Source File: GazpachoViewDisplay.java    From gazpachoquest with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void showView(View view) {
    logger.debug("Displaying View " + view);
    if (view instanceof CustomComponent) {
        setContent((CustomComponent) view);
    } else if (view instanceof ComponentContainer) {
        setContent((ComponentContainer) view);
    } else {
        throw new IllegalStateException("View not supported! ");
    }
}
 
Example #20
Source File: GenericConfigForm.java    From sensorhub with Mozilla Public License 2.0 5 votes vote down vote up
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;
}
 
Example #21
Source File: GenericConfigForm.java    From sensorhub with Mozilla Public License 2.0 5 votes vote down vote up
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);
}
 
Example #22
Source File: VersionReadViewImpl.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected ComponentContainer createExtraControls() {
    if (SiteConfiguration.isCommunityEdition()) {
        return null;
    } else {
        tagViewComponent = new TagViewComponent(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.VERSIONS));
        return tagViewComponent;
    }
}
 
Example #23
Source File: RolePermissionContainer.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
private ComponentContainer constructPermissionSectionView(String depotTitle, PermissionMap permissionMap,
                                                          List<PermissionDefItem> defItems) {
    GridFormLayoutHelper formHelper = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.TWO_COLUMN);
    FormContainer permissionsPanel = new FormContainer();

    for (int i = 0; i < defItems.size(); i++) {
        PermissionDefItem permissionDefItem = defItems.get(i);
        Integer flag = permissionMap.getPermissionFlag(permissionDefItem.getKey());
        SecurityI18nEnum permissionVal = PermissionFlag.toVal(flag);
        formHelper.addComponent(new Label(UserUIContext.getMessage(permissionVal)), UserUIContext.getMessage(permissionDefItem.getCaption()),
                UserUIContext.getMessage(permissionVal.desc()), i % 2, i / 2);
    }
    permissionsPanel.addSection(depotTitle, formHelper.getLayout());
    return permissionsPanel;
}
 
Example #24
Source File: ProjectRoleAddViewImpl.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected ComponentContainer createBottomPanel() {
    final FormContainer permissionsPanel = new FormContainer();

    PermissionMap perMap;
    if (beanItem instanceof SimpleProjectRole) {
        perMap = ((SimpleProjectRole) beanItem).getPermissionMap();
    } else {
        perMap = new PermissionMap();
    }

    final GridFormLayoutHelper permissionFormHelper = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.TWO_COLUMN);

    for (int i = 0; i < ProjectRolePermissionCollections.PROJECT_PERMISSIONS.length; i++) {
        String permissionPath = ProjectRolePermissionCollections.PROJECT_PERMISSIONS[i];
        KeyCaptionComboBox permissionBox;
        Enum captionHelp;
        if (ProjectRolePermissionCollections.FINANCE.equals(permissionPath) ||
                ProjectRolePermissionCollections.APPROVE_TIMESHEET.equals(permissionPath)) {
            permissionBox = new YesNoPermissionComboBox();
            captionHelp = SecurityI18nEnum.BOOLEAN_PERMISSION_HELP;
        } else {
            permissionBox = new AccessPermissionComboBox();
            captionHelp = SecurityI18nEnum.ACCESS_PERMISSION_HELP;
        }

        Integer flag = perMap.getPermissionFlag(permissionPath);
        permissionBox.setValue(KeyCaptionComboBox.Entry.of(flag));
        permissionControlsMap.put(permissionPath, permissionBox);
        permissionFormHelper.addComponent(permissionBox, UserUIContext.getMessage(RolePermissionI18nEnum.valueOf(permissionPath)),
                UserUIContext.getMessage(captionHelp), i % 2, i / 2);
    }
    permissionsPanel.addSection(UserUIContext.getMessage(ProjectRoleI18nEnum.SECTION_PERMISSIONS), permissionFormHelper.getLayout());

    return permissionsPanel;
}
 
Example #25
Source File: MilestoneTicketGroupComponent.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void refresh() {
    if (wrapBody.getComponentCount() > 0) {
        updateTitle();
    } else {
        ComponentContainer parent = (ComponentContainer) getParent();
        if (parent != null) {
            parent.removeComponent(this);
        }
    }
}
 
Example #26
Source File: ProjectListViewImpl.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
private ComponentContainer constructTableActionControls() {
    MHorizontalLayout layout = new MHorizontalLayout().withFullWidth().withStyleName(WebThemes.TABLE_ACTION_CONTROLS);

    selectOptionButton = new SelectionOptionButton(tableItem);
    selectOptionButton.setWidthUndefined();
    layout.addComponent(selectOptionButton);

    tableActionControls = new DefaultMassItemActionHandlerContainer();

    tableActionControls.addDownloadPdfActionItem();
    tableActionControls.addDownloadExcelActionItem();
    tableActionControls.addDownloadCsvActionItem();

    tableActionControls.setVisible(false);
    tableActionControls.setWidthUndefined();

    layout.addComponent(tableActionControls);
    selectedItemsNumberLabel.setWidth("100%");
    layout.with(selectedItemsNumberLabel).withAlign(selectedItemsNumberLabel, Alignment.MIDDLE_CENTER).expand(selectedItemsNumberLabel);

    MButton customizeViewBtn = new MButton("", clickEvent -> UI.getCurrent().addWindow(new ProjectListCustomizeWindow(tableItem)))
            .withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.ADJUST);
    customizeViewBtn.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_LAYOUT_OPTIONS));
    layout.with(customizeViewBtn).withAlign(customizeViewBtn, Alignment.MIDDLE_RIGHT);

    return layout;
}
 
Example #27
Source File: ProjectRoleReadViewImpl.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
protected ComponentContainer createBottomPanel() {
    FormContainer permissionsPanel = new FormContainer();

    projectFormHelper = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.TWO_COLUMN);
    permissionsPanel.addSection(UserUIContext.getMessage(ProjectRoleI18nEnum.SECTION_PERMISSIONS), projectFormHelper.getLayout());

    return permissionsPanel;
}
 
Example #28
Source File: ProjectRoleReadViewImpl.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public ProjectRoleReadViewImpl() {
    withMargin(true);
    headerText = HeaderWithIcon.h2(VaadinIcons.CLIPBOARD_USER, UserUIContext.getMessage(ProjectRoleI18nEnum.DETAIL));
    headerLayout = constructHeader();
    this.addComponent(headerLayout);

    previewForm = initPreviewForm();
    ComponentContainer actionControls = createButtonControls();
    headerLayout.with(actionControls).expand(actionControls);

    previewLayout = new DefaultReadViewLayout("");
    previewLayout.addBody(previewForm);
    this.addComponent(previewLayout);
}
 
Example #29
Source File: TicketRowRender.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public void selfRemoved() {
    IBlockContainer blockContainer = UIUtils.getRoot(this, IBlockContainer.class);
    ComponentContainer container = (ComponentContainer) getParent();
    if (container != null) {
        container.removeComponent(this);
    }
    if (blockContainer != null) {
        blockContainer.refresh();
    }
}
 
Example #30
Source File: WebRelatedEntities.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected void refreshNavigationActions() {
    ComponentContainer actionContainer = (ComponentContainer) vPopupComponent;

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

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

        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 = beanLocator.get(Messages.NAME);
            actionContainer.addComponent(new Label(messages.getMainMessage("actions.Related.Empty")));
        }
    }
}