List of usage examples for com.vaadin.ui Label setVisible
@Override public void setVisible(boolean visible)
From source file:org.eclipse.hawkbit.ui.rollout.rollout.GroupsLegendLayout.java
License:Open Source License
/** * Populates the legend based on a list of anonymous groups. They can't have * unassigned targets./* w w w. j a v a 2s .c o m*/ * * @param listOfTargetCountPerGroup * list of target counts */ public void populateGroupsLegendByTargetCounts(final List<Long> listOfTargetCountPerGroup) { loadingLabel.setVisible(false); for (int i = 0; i < getGroupsWithoutToBeContinuedLabel(listOfTargetCountPerGroup.size()); i++) { final Component component = groupsLegend.getComponent(i); final Label label = (Label) component; if (listOfTargetCountPerGroup.size() > i) { final Long targetCount = listOfTargetCountPerGroup.get(i); label.setValue(getTargetsInGroupMessage(targetCount, i18n.getMessage("textfield.rollout.group.default.name", i + 1))); label.setVisible(true); } else { label.setValue(""); label.setVisible(false); } } showOrHideToBeContinueLabel(listOfTargetCountPerGroup); unassignedTargetsLabel.setValue(""); unassignedTargetsLabel.setVisible(false); }
From source file:org.eclipse.hawkbit.ui.rollout.rollout.GroupsLegendLayout.java
License:Open Source License
/** * Populates the legend based on a groups validation and a list of groups * that is used for resolving their names. Positions of the groups in the * groups list and the validation need to be in correct order. Can have * unassigned targets that are displayed on top of the groups list which * results in one group less to be displayed * //ww w. j a v a 2 s . c o m * @param validation * A rollout validation object that contains a list of target * counts and the total targets * @param groups * List of groups with their name */ public void populateGroupsLegendByValidation(final RolloutGroupsValidation validation, final List<RolloutGroupCreate> groups) { loadingLabel.setVisible(false); if (validation == null) { return; } final List<Long> targetsPerGroup = validation.getTargetsPerGroup(); final long unassigned = validation.getTotalTargets() - validation.getTargetsInGroups(); final int labelsToUpdate = (unassigned > 0) ? (getGroupsWithoutToBeContinuedLabel(groups.size()) - 1) : groupsLegend.getComponentCount(); for (int i = 0; i < getGroupsWithoutToBeContinuedLabel(groups.size()); i++) { final Component component = groupsLegend.getComponent(i); final Label label = (Label) component; if (targetsPerGroup.size() > i && groups.size() > i && labelsToUpdate > i) { final Long targetCount = targetsPerGroup.get(i); final String groupName = groups.get(i).build().getName(); label.setValue(getTargetsInGroupMessage(targetCount, groupName)); label.setVisible(true); } else { label.setValue(""); label.setVisible(false); } } showOrHideToBeContinueLabel(groups); if (unassigned > 0) { unassignedTargetsLabel.setValue(getTargetsInGroupMessage(unassigned, "Unassigned")); unassignedTargetsLabel.setVisible(true); } else { unassignedTargetsLabel.setValue(""); unassignedTargetsLabel.setVisible(false); } }
From source file:org.eclipse.hawkbit.ui.rollout.rollout.GroupsLegendLayout.java
License:Open Source License
/** * Populates the legend based on a list of groups. * * @param groups//from ww w . jav a 2 s. c o m * List of groups with their name */ public void populateGroupsLegendByGroups(final List<RolloutGroup> groups) { loadingLabel.setVisible(false); for (int i = 0; i < getGroupsWithoutToBeContinuedLabel(groups.size()); i++) { final Component component = groupsLegend.getComponent(i); final Label label = (Label) component; if (groups.size() > i) { final int targetCount = groups.get(i).getTotalTargets(); final String groupName = groups.get(i).getName(); label.setValue(getTargetsInGroupMessage((long) targetCount, groupName)); label.setVisible(true); } else { label.setValue(""); label.setVisible(false); } } showOrHideToBeContinueLabel(groups); }
From source file:org.eclipse.skalli.view.internal.window.ProjectEditPanel.java
License:Open Source License
private Label renderMessageArea(VerticalLayout layout) { CssLayout messageArea = new CssLayout(); messageArea.setMargin(true);//from w w w .j a va 2 s . c om messageArea.setWidth(PANEL_WIDTH); Label label = new Label("", Label.CONTENT_XHTML); //$NON-NLS-1$ label.addStyleName(STYLE_ISSUES); label.setVisible(false); messageArea.addComponent(label); layout.addComponent(messageArea); layout.setComponentAlignment(messageArea, Alignment.MIDDLE_CENTER); return label; }
From source file:org.eclipse.skalli.view.internal.window.ProjectEditPanel.java
License:Open Source License
private void setMessage(Label label, String message) { if (StringUtils.isNotEmpty(message)) { label.setValue(message);/* w w w.j a v a2 s .co m*/ label.setVisible(true); } else { label.setVisible(false); } label.requestRepaint(); }
From source file:org.hip.vif.admin.admin.ui.UpgradeView.java
License:Open Source License
/** UpgradeView constructor. * * @param inVersionInstance String the instance's version (i.e. the version of the tables) * @param inVersionSoftware String the version according to the installed version * @param inThread {@link UpgradeTask} the thread managing the upgrade */ public UpgradeView(final String inVersionInstance, final String inVersionSoftware, final UpgradeThread inThread) { final IMessages lMessages = Activator.getMessages(); final VerticalLayout lLayout = initLayout(lMessages, "admin.menu.upgrade"); //$NON-NLS-1$ final Label lFeedbackMsg = new Label( String.format(TMPL_FEEDBACK, lMessages.getMessage("admin.upgrade.feedback.failure")), //$NON-NLS-1$ ContentMode.HTML);// w ww .j a va2 s . c o m lFeedbackMsg.setVisible(false); lLayout.addComponent(lFeedbackMsg); final Label lFailures = new Label("", ContentMode.HTML); //$NON-NLS-1$ lLayout.addComponent(lFailures); lFailures.setVisible(false); final LabelValueTable lTable = new LabelValueTable(); lTable.addRow(lMessages.getMessage("admin.upgrade.version.instance"), inVersionInstance); //$NON-NLS-1$ lTable.addRow(lMessages.getMessage("admin.upgrade.version.app"), inVersionSoftware); //$NON-NLS-1$ lLayout.addComponent(lTable); lLayout.addComponent(RiplaViewHelper.createSpacer()); final Button lUpgrade = new Button(lMessages.getMessage("admin.menu.upgrade")); //$NON-NLS-1$ lLayout.addComponent(lUpgrade); lLayout.addComponent(RiplaViewHelper.createSpacer()); final ProgressBar lProgress = new ProgressBar(new Float(0.0)); lProgress.setWidth(200, Unit.PIXELS); lProgress.setVisible(false); lLayout.addComponent(lProgress); lUpgrade.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { lProgress.setVisible(true); lProgress.setEnabled(true); lUpgrade.setEnabled(false); UI.getCurrent().setPollInterval(POLL_RUN); final Collection<IVIFUpgrade> lFailed = inThread.upgrade(inVersionInstance, inVersionSoftware, lProgress); lProgress.setVisible(false); if (lFailed.isEmpty()) { lFeedbackMsg.setVisible(false); lFailures.setVisible(false); } else { lFeedbackMsg.setVisible(true); lFailures.setPropertyDataSource( new ObjectProperty<String>(renderFailures(lFailed), String.class)); lFailures.setVisible(true); } lUpgrade.setEnabled(true); } }); }
From source file:org.hip.vif.admin.groupedit.ui.GroupListView.java
License:Open Source License
/** Constructor * * @param inGroups {@link GroupContainer} the groups to display * @param inTask {@link GroupShowTask} the controller */ public GroupListView(final GroupContainer inGroups, final GroupShowListTask inTask) { confirmationMode = false;//from w w w .j a v a 2 s. c om final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout); final IMessages lMessages = Activator.getMessages(); lLayout.setStyleName("vif-table"); //$NON-NLS-1$ lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", //$NON-NLS-1$ lMessages.getMessage("ui.group.list.view.title.page")), ContentMode.HTML)); //$NON-NLS-1$ final Label lSubtitle = new Label( String.format(VIFViewHelper.TMPL_WARNING, lMessages.getMessage("ui.group.delete.warning")), //$NON-NLS-1$ ContentMode.HTML); lSubtitle.setVisible(false); lLayout.addComponent(lSubtitle); final Table lTable = new Table(); lTable.setWidth("100%"); //$NON-NLS-1$ lTable.setContainerDataSource(inGroups); lTable.addGeneratedColumn(GroupContainer.GROUP_CHECK, new Table.ColumnGenerator() { @Override public Object generateCell(final Table inSource, final Object inItemId, final Object inColumnId) { return createCheck((GroupWrapper) inItemId); } }); lTable.setPageLength(inGroups.size() > TABLE_SIZE ? TABLE_SIZE : 0); lTable.setColumnCollapsingAllowed(true); lTable.setColumnReorderingAllowed(true); lTable.setSelectable(true); lTable.setImmediate(true); lTable.addValueChangeListener(inTask); lTable.setVisibleColumns(GroupContainer.NATURAL_COL_ORDER); lTable.setColumnHeaders(VIFViewHelper.getColumnHeaders(GroupContainer.COL_HEADERS, lMessages)); lLayout.addComponent(lTable); lLayout.addComponent(RiplaViewHelper.createSpacer()); final Button lDelete = new Button(lMessages.getMessage("ui.group.editor.button.delete")); //$NON-NLS-1$ lDelete.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (confirmationMode) { if (!inTask.deleteGroups()) { Notification.show(lMessages.getMessage("errmsg.process.delete"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } else { if (VIFViewHelper.processAction(inGroups)) { confirmationMode = true; inGroups.addContainerFilter(new SelectedFilter()); lSubtitle.setVisible(true); lTable.setSelectable(false); lTable.setPageLength(0); } } } }); lLayout.addComponent(lDelete); }
From source file:org.hip.vif.admin.groupedit.ui.ParticipantListView.java
License:Open Source License
/** View constructor. * * @param inParticipants {@link ParticipantContainer} * @param inGroupName String/* w ww .j a va 2s. c om*/ * @param inEnableDelete boolean * @param inTask {@link ParticipantListTask} */ public ParticipantListView(final ParticipantContainer inParticipants, final String inGroupName, final boolean inEnableDelete, final ParticipantListTask inTask) { confirmationMode = false; final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout); final IMessages lMessages = Activator.getMessages(); lLayout.setStyleName("vif-table"); //$NON-NLS-1$ lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", //$NON-NLS-1$ lMessages.getFormattedMessage("ui.group.participants.view.title.page", inGroupName)), //$NON-NLS-1$ ContentMode.HTML)); final Label lSubtitle = new Label( String.format(SUBTITLE_WARNING, lMessages.getMessage("ui.participants.delete.warning")), //$NON-NLS-1$ ContentMode.HTML); lSubtitle.setVisible(false); lLayout.addComponent(lSubtitle); final Table lTable = new Table(); lTable.setWidth("100%"); //$NON-NLS-1$ lTable.setContainerDataSource(inParticipants); if (inEnableDelete) { lTable.addGeneratedColumn(ParticipantContainer.ENTRY_CHECK, new Table.ColumnGenerator() { @Override public Object generateCell(final Table inSource, final Object inItemId, final Object inColumnId) { return createCheck((ParticipantBean) inItemId, new VIFViewHelper.IConfirmationModeChecker() { @Override public boolean inConfirmationMode() { return confirmationMode; } }); } }); lTable.setVisibleColumns(VIFViewHelper.getModifiedArray(ParticipantContainer.ENTRY_CHECK, ParticipantContainer.NATURAL_COL_ORDER)); lTable.setColumnHeaders(VIFViewHelper.getColumnHeaders( VIFViewHelper.getModifiedArray("", (Object[]) ParticipantContainer.COL_HEADERS), lMessages)); //$NON-NLS-1$ } else { lTable.setVisibleColumns(ParticipantContainer.NATURAL_COL_ORDER); lTable.setColumnHeaders(VIFViewHelper.getColumnHeaders(ParticipantContainer.COL_HEADERS, lMessages)); } lTable.setPageLength(inParticipants.size() > TABLE_SIZE ? TABLE_SIZE : 0); lTable.setColumnCollapsingAllowed(true); lTable.setColumnReorderingAllowed(true); lTable.setSelectable(true); lTable.setImmediate(true); lTable.setColumnWidth(ParticipantContainer.PARTICIPANT_PLACE, 200); lTable.setColumnWidth(ParticipantContainer.PARTICIPANT_MAIL, 200); lTable.addValueChangeListener(inTask); lLayout.addComponent(lTable); if (inEnableDelete) { lLayout.addComponent(RiplaViewHelper.createSpacer()); final Button lDelete = new Button(lMessages.getMessage("ui.participants.button.delete")); //$NON-NLS-1$ lDelete.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (confirmationMode) { if (!inTask.deleteParticipants()) { Notification.show(lMessages.getMessage("errmsg.process.delete"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } else { if (VIFViewHelper.processAction(inParticipants)) { confirmationMode = true; inParticipants.addContainerFilter(new SelectedFilter()); lSubtitle.setVisible(true); lTable.setSelectable(false); lTable.setPageLength(0); } } } }); lLayout.addComponent(lDelete); } }
From source file:org.hip.vif.admin.member.ui.MemberListView.java
License:Open Source License
/** Constructor * * @param inMembers {@link MemberContainer} * @param inIsDeletable boolean <code>true</code> if the member entries are deletable and, therefore, a delete * button is displayed//from ww w. j a v a 2 s .c om * @param inTask {@link MemberShowListTask} */ public MemberListView(final MemberContainer inMembers, final boolean inIsDeletable, final AbstractMemberSearchTask inTask) { final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout); final IMessages lMessages = Activator.getMessages(); lLayout.setStyleName("vif-view"); //$NON-NLS-1$ lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", //$NON-NLS-1$ lMessages.getMessage("ui.member.list.title.page")), ContentMode.HTML)); //$NON-NLS-1$ final Label lSubtitle = new Label( String.format(SUBTITLE_WARNING, lMessages.getMessage("ui.member.delete.warning")), //$NON-NLS-1$ ContentMode.HTML); lSubtitle.setVisible(false); lLayout.addComponent(lSubtitle); final Table lTable = new Table(); lTable.setWidth("100%"); //$NON-NLS-1$ lTable.setContainerDataSource(inMembers); if (inIsDeletable) { // generate check box lTable.addGeneratedColumn(MemberContainer.MEMBER_CHECK, new VIFViewHelper.CheckBoxColumnGenerator(new VIFViewHelper.IConfirmationModeChecker() { @Override public boolean inConfirmationMode() { return confirmationMode; } })); lTable.setVisibleColumns(VIFViewHelper.getModifiedArray(MemberContainer.MEMBER_CHECK, MemberContainer.NATURAL_COL_ORDER)); lTable.setColumnHeaders(VIFViewHelper.getColumnHeaders( VIFViewHelper.getModifiedArray("", (Object[]) MemberContainer.COL_HEADERS), lMessages)); //$NON-NLS-1$ } else { lTable.setVisibleColumns(MemberContainer.NATURAL_COL_ORDER); lTable.setColumnHeaders(VIFViewHelper.getColumnHeaders(MemberContainer.COL_HEADERS, lMessages)); } lTable.setColumnCollapsingAllowed(true); lTable.setColumnReorderingAllowed(true); lTable.setSelectable(true); lTable.setImmediate(true); lTable.setPageLength(inMembers.size() > PAGE_LENGTH ? PAGE_LENGTH : 0); lTable.setColumnExpandRatio(MemberContainer.MEMBER_NAME, 1); lTable.setColumnWidth(MemberContainer.MEMBER_STREET, 200); lTable.setColumnWidth(MemberContainer.MEMBER_PLACE, 200); lTable.setColumnWidth(MemberContainer.MEMBER_MAIL, 200); lTable.addValueChangeListener(inTask); lLayout.addComponent(lTable); if (inIsDeletable) { lLayout.addComponent(RiplaViewHelper.createSpacer()); final Button lDelete = new Button(lMessages.getMessage("ui.member.button.delete")); //$NON-NLS-1$ lDelete.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (confirmationMode) { if (!inTask.deleteMember()) { Notification.show(lMessages.getMessage("errmsg.process.delete"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } else { if (VIFViewHelper.processAction(inMembers)) { confirmationMode = true; inMembers.addContainerFilter(new SelectedFilter()); lSubtitle.setVisible(true); lTable.setSelectable(false); lTable.setPageLength(0); } } } }); lLayout.addComponent(lDelete); } }
From source file:org.hip.vif.admin.permissions.ui.PermissionEditView.java
License:Open Source License
/** Constructor * * @param inPermissions {@link LoadedPermissionContainer} the permissions * @param inRoles {@link CodeList} the roles * @param inTask {@link PermissionsEditTask} */ public PermissionEditView(final LoadedPermissionContainer inPermissions, final CodeList inRoles, final PermissionsEditTask inTask) { final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout);//from w ww . jav a 2 s . c o m final IMessages lMessages = Activator.getMessages(); lLayout.setStyleName("vif-table"); //$NON-NLS-1$ lLayout.addComponent(new Label( String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", //$NON-NLS-1$ lMessages.getMessage("component.menu.title")), //$NON-NLS-1$ ContentMode.HTML)); final Label lSubtitle = new Label( String.format(SUBTITLE_WARNING, lMessages.getMessage("ui.permission.remark.delete")), //$NON-NLS-1$ ContentMode.HTML); lLayout.addComponent(lSubtitle); lSubtitle.setVisible(false); final Table lTable = new Table(); lTable.setWidth("100%"); //$NON-NLS-1$ lTable.setStyleName("vif-permission-table"); //$NON-NLS-1$ lTable.setContainerDataSource(inPermissions); // generate column checkbox for delete lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_CHECK, new Table.ColumnGenerator() { @Override public Object generateCell(final Table inSource, final Object inItemId, final Object inColumnId) { if (Constants.PERMISSION_EDIT.equals(((LoadedPermissionBean) inItemId).getLabel())) { return new Label(); } return VIFViewHelper.createCheck((ISelectableBean) inItemId, new VIFViewHelper.IConfirmationModeChecker() { @Override public boolean inConfirmationMode() { return confirmationMode; } }); } }); // generate column label lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_LABEL, new Table.ColumnGenerator() { @Override public Object generateCell(final Table inSource, final Object inItemId, final Object inColumnId) { final LoadedPermissionBean lPermission = (LoadedPermissionBean) inItemId; return new Label(String.format(TMPL_LABEL, lPermission.getDescription(), lPermission.getLabel()), ContentMode.HTML); } }); // generate column checkbox for roles lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_SU, new ColumnCheckBoxGenerator(Role.SU)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_ADMIN, new ColumnCheckBoxGenerator(Role.ADMIN)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_GROUPADMIN, new ColumnCheckBoxGenerator(Role.GROUP_ADMIN)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_PARTICIPANT, new ColumnCheckBoxGenerator(Role.PARTICIPANT)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_MEMBER, new ColumnCheckBoxGenerator(Role.MEMBER)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_GUEST, new ColumnCheckBoxGenerator(Role.GUEST)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_EXCLUDED, new ColumnCheckBoxGenerator(Role.EXCLUDED)); lTable.setPageLength(inPermissions.size() > TABLE_SIZE ? TABLE_SIZE : 0); lTable.setColumnCollapsingAllowed(true); lTable.setColumnReorderingAllowed(true); lTable.setSelectable(true); lTable.setImmediate(true); lTable.setVisibleColumns(LoadedPermissionContainer.NATURAL_COL_ORDER); lTable.setColumnHeaders(getHeaders(inRoles, lMessages)); lTable.setColumnExpandRatio(LoadedPermissionContainer.FIELD_LABEL, 1); lLayout.addComponent(lTable); final Button lDelete = new Button(lMessages.getMessage("ui.permission.button.delete")); //$NON-NLS-1$ final Button lSave = new Button(lMessages.getMessage("ui.permission.button.save")); //$NON-NLS-1$ lSave.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (!inTask.saveChanges()) { Notification.show(lMessages.getMessage("errmsg.permissions.save"), //$NON-NLS-1$ Type.WARNING_MESSAGE); } } }); lLayout.addComponent(RiplaViewHelper.createButtons(lDelete, lSave)); lLayout.addComponent(RiplaViewHelper.createSpacer()); final Component lInput = createInput(inTask, lMessages); lLayout.addComponent(lInput); // add button click listeners lDelete.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (confirmationMode) { if (!inTask.deletePermissions()) { Notification.show(lMessages.getMessage("errmsg.permissions.delete"), //$NON-NLS-1$ Type.WARNING_MESSAGE); } } else { if (VIFViewHelper.processAction(inPermissions)) { confirmationMode = true; inPermissions.addContainerFilter(new SelectedFilter()); lSubtitle.setVisible(true); lTable.setSelectable(false); lTable.setPageLength(0); lInput.setVisible(false); lSave.setVisible(false); } } } }); }