List of usage examples for com.vaadin.ui Label removeStyleName
@Override public void removeStyleName(String style)
From source file:de.fatalix.bookery.view.admin.ServerSettingsLayout.java
License:Open Source License
private void checkSolr() { try {/*from w w w . j a v a2 s . co m*/ long numDocs = presenter.getSolrInfo(); for (Label label : statusFields) { if (label.getCaption().equals("Status")) { label.setValue("Online " + FontAwesome.CHECK_CIRCLE.getHtml()); label.removeStyleName("red-icon"); label.addStyleName("green-icon"); } else if (label.getCaption().equals("Library")) { label.setValue(numDocs + " Books"); } } } catch (SolrServerException | IOException ex) { logger.error(ex, ex); for (Label label : statusFields) { if (label.getCaption().equals("Status")) { label.setValue(ex.getLocalizedMessage() + " " + FontAwesome.CHECK_CIRCLE.getHtml()); label.addStyleName("red-icon"); label.removeStyleName("green-icon"); } else if (label.getCaption().equals("Num Docs")) { label.setValue("NA"); } } } }
From source file:edu.kit.dama.ui.admin.wizard.FirstStartWizard.java
License:Apache License
private void buildMainLayout() { stepLayout = new VerticalLayout(); back.setEnabled(false);//from w w w.j a v a2s .c o m stepLayout.addComponent(stepList[currentStep]); stepLayout.setComponentAlignment(stepList[currentStep], Alignment.TOP_RIGHT); stepLayout.setSpacing(false); stepLayout.setMargin(false); stepLayout.setWidth("100%"); stepLayout.setHeight("500px"); final VerticalLayout stepLabels = new VerticalLayout(); for (WizardStep step : stepList) { Label stepLabel = new Label(step.getStepName()); stepLabel.setWidth("250px"); stepLabels.addComponent(stepLabel); stepLabels.setComponentAlignment(stepLabel, Alignment.TOP_LEFT); } //make introduction label bold stepLabels.getComponent(0).addStyleName("myboldcaption"); Label spacer = new Label(); stepLabels.addComponent(spacer); stepLabels.setExpandRatio(spacer, 1.0f); stepLabels.setWidth("275px"); stepLabels.setHeight("550px"); stepLabels.setSpacing(true); UIUtils7.GridLayoutBuilder builder = new UIUtils7.GridLayoutBuilder(2, 2); HorizontalLayout buttonLayout = new HorizontalLayout(back, next); buttonLayout.setSizeFull(); buttonLayout.setComponentAlignment(back, Alignment.BOTTOM_RIGHT); buttonLayout.setComponentAlignment(next, Alignment.BOTTOM_RIGHT); buttonLayout.setExpandRatio(back, 1.0f); next.addClickListener((event) -> { if ("Go To Login".equals(next.getCaption())) { Page.getCurrent().reload(); } else if ("Finish".equals(next.getCaption())) { //do finish WizardPersistHelper helper = new WizardPersistHelper(); if (helper.persist(properties)) { UIUtils7.showInformation("Success", "All information have been successfully stored into the database. For details, please refer to the log output above.\n" + "You may now dismiss this message and click 'Go To Login' in order to access the login page.\n" + "From there you can to login using your administrator account or create a personalized user account.", 3000); back.setVisible(false); next.setCaption("Go To Login"); } else { UIUtils7.showError("Failed to store collected information in database.\n" + "Please refer to the log output above."); } ((WizardSummary) stepList[currentStep]).setSummary(helper.getMessages()); } else { if (currentStep + 1 <= stepList.length - 1) { if (stepList[currentStep].validate()) { stepList[currentStep].collectProperties(properties); currentStep++; stepLayout.replaceComponent(stepList[currentStep - 1], stepList[currentStep]); Label currentLabel = (Label) stepLabels.getComponent(currentStep); Label prevLabel = (Label) stepLabels.getComponent(currentStep - 1); currentLabel.addStyleName("myboldcaption"); prevLabel.removeStyleName("myboldcaption"); if (stepList[currentStep] instanceof WizardSummary) { StringBuilder summary = new StringBuilder(); for (WizardStep step : stepList) { summary.append(step.getSummary()).append("\n"); } ((WizardSummary) stepList[currentStep]).setSummary(summary.toString()); } } } if (currentStep == stepList.length - 1) { //finish next.setCaption("Finish"); } else { next.setCaption("Next"); } back.setEnabled(true); } }); back.addClickListener((event) -> { if (currentStep - 1 >= 0) { stepList[currentStep].collectProperties(properties); currentStep--; stepLayout.replaceComponent(stepList[currentStep + 1], stepList[currentStep]); Label currentLabel = (Label) stepLabels.getComponent(currentStep); Label prevLabel = (Label) stepLabels.getComponent(currentStep + 1); currentLabel.addStyleName("myboldcaption"); prevLabel.removeStyleName("myboldcaption"); } next.setEnabled(true); back.setEnabled(currentStep > 0); next.setCaption("Next"); }); builder.addComponent(stepLabels, Alignment.TOP_LEFT, 0, 0, 1, 2); builder.addComponent(stepLayout, Alignment.TOP_LEFT, 1, 0, 1, 1); builder.addComponent(buttonLayout, Alignment.BOTTOM_LEFT, 1, 1, 1, 1); mainLayout = builder.getLayout(); mainLayout.setMargin(true); mainLayout.setSizeFull(); // mainLayout.setColumnExpandRatio(0, .3f); mainLayout.setColumnExpandRatio(1, 1f); mainLayout.setRowExpandRatio(0, .95f); mainLayout.setRowExpandRatio(1, .05f); }
From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadConfirmationWindow.java
License:Open Source License
/** * Warning icon is displayed, if an artifact exists with same provided file * name. Error icon is displayed, if file name entered is duplicate. * * @param warningIconLabel/*from w w w . j a v a 2 s. c om*/ * warning/error label * @param fileName * provided file name * @param itemId * item id of the current row */ private void setWarningIcon(final Label warningIconLabel, final String fileName, final Object itemId) { final Item item = uploadDetailsTable.getItem(itemId); if (StringUtils.hasText(fileName)) { final String fileNameTrimmed = StringUtils.trimWhitespace(fileName); final Long baseSwId = (Long) item.getItemProperty(BASE_SOFTWARE_ID).getValue(); final Optional<Artifact> artifact = artifactManagement.getByFilenameAndSoftwareModule(fileNameTrimmed, baseSwId); if (artifact.isPresent()) { warningIconLabel.setVisible(true); if (isErrorIcon(warningIconLabel)) { warningIconLabel.removeStyleName(SPUIStyleDefinitions.ERROR_LABEL); redErrorLabelCount--; } warningIconLabel.setDescription(i18n.getMessage(ALREADY_EXISTS_MSG)); if (checkForDuplicate(fileNameTrimmed, itemId, baseSwId)) { warningIconLabel.setDescription(i18n.getMessage("message.duplicate.filename")); warningIconLabel.addStyleName(SPUIStyleDefinitions.ERROR_LABEL); redErrorLabelCount++; } } else { warningIconLabel.setVisible(false); if (warningIconLabel.getStyleName().contains(SPUIStyleDefinitions.ERROR_LABEL)) { warningIconLabel.removeStyleName(SPUIStyleDefinitions.ERROR_LABEL); warningIconLabel.setDescription(i18n.getMessage(ALREADY_EXISTS_MSG)); redErrorLabelCount--; } } } }
From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadConfirmationWindow.java
License:Open Source License
/** * If warning was displayed prior and not displayed currently ,the update * other warning labels accordingly./*from w w w. j av a 2s .c o m*/ * * @param itemId * id of row which is deleted/whose file name modified. * @param oldSwId * software module id * @param oldFileName * file name before modification */ private void modifyIconOfSameSwId(final Object itemId, final Long oldSwId, final String oldFileName) { for (final Object rowId : tableContainer.getItemIds()) { final Item newItem = tableContainer.getItem(rowId); final Long newBaseSwId = (Long) newItem.getItemProperty(BASE_SOFTWARE_ID).getValue(); final String newFileName = (String) newItem.getItemProperty(FILE_NAME).getValue(); if (!rowId.equals(itemId) && newBaseSwId.equals(oldSwId) && newFileName.equals(oldFileName)) { final HorizontalLayout layout = (HorizontalLayout) newItem.getItemProperty(FILE_NAME_LAYOUT) .getValue(); final Label warningLabel = (Label) layout.getComponent(1); if (warningLabel.isVisible()) { warningLabel.removeStyleName(SPUIStyleDefinitions.ERROR_LABEL); warningLabel.setDescription(i18n.getMessage(ALREADY_EXISTS_MSG)); newItem.getItemProperty(WARNING_ICON).setValue(warningLabel); redErrorLabelCount--; break; } } } }
From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadConfirmationWindow.java
License:Open Source License
private void hideErrorIcon(final Label warningLabel, final int errorLabelCount, final int duplicateCount, final Label errorLabel, final String oldFileName, final Long currentSwId) { if (warningLabel == null && (errorLabelCount > 1 || (duplicateCount == 1 && errorLabelCount == 1))) { final Optional<Artifact> artifactList = artifactManagement.getByFilenameAndSoftwareModule(oldFileName, currentSwId);/*from w w w .j a v a 2s . com*/ if (errorLabel == null) { return; } errorLabel.removeStyleName(SPUIStyleDefinitions.ERROR_LABEL); errorLabel.setDescription(i18n.getMessage(ALREADY_EXISTS_MSG)); if (!artifactList.isPresent()) { errorLabel.setVisible(false); } redErrorLabelCount--; } }
From source file:org.eclipse.hawkbit.ui.common.detailslayout.AbstractTableDetailsLayout.java
License:Open Source License
protected void updateDescriptionLayout(final String description) { descriptionLayout.removeAllComponents(); final Label descLabel = SPUIComponentProvider.createNameValueLabel("", description == null ? "" : description); /**//w ww . j a v a 2s . c om * By default text will be truncated based on layout width. So removing * it as we need full description. */ descLabel.removeStyleName("label-style"); descLabel.setId(UIComponentIdProvider.DETAILS_DESCRIPTION_LABEL_ID); descriptionLayout.addComponent(descLabel); }