當前位置: 首頁>>代碼示例>>Java>>正文


Java VerticalLayout.addComponent方法代碼示例

本文整理匯總了Java中com.vaadin.ui.VerticalLayout.addComponent方法的典型用法代碼示例。如果您正苦於以下問題:Java VerticalLayout.addComponent方法的具體用法?Java VerticalLayout.addComponent怎麽用?Java VerticalLayout.addComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vaadin.ui.VerticalLayout的用法示例。


在下文中一共展示了VerticalLayout.addComponent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addMentionCnil

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
 * ajoute la mention CNIL
 */
private void addMentionCnil() {
	panelCnil.setWidth(100, Unit.PERCENTAGE);
	panelCnil.setHeight(100, Unit.PIXELS);
	addComponent(panelCnil);
	setComponentAlignment(panelCnil, Alignment.BOTTOM_LEFT);

	VerticalLayout vlContentLabelCnil = new VerticalLayout();
	vlContentLabelCnil.setSizeUndefined();
	vlContentLabelCnil.setWidth(100, Unit.PERCENTAGE);
	vlContentLabelCnil.setMargin(true);

	labelCnil.setContentMode(ContentMode.HTML);
	labelCnil.addStyleName(ValoTheme.LABEL_TINY);
	labelCnil.addStyleName(StyleConstants.LABEL_JUSTIFY);
	labelCnil.addStyleName(StyleConstants.LABEL_SAUT_LIGNE);
	vlContentLabelCnil.addComponent(labelCnil);

	panelCnil.setContent(vlContentLabelCnil);
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:23,代碼來源:AccueilView.java

示例2: makeSslUploadContainer

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
private VerticalLayout makeSslUploadContainer(SslCertificateUploader certificateUploader, String title) {
    VerticalLayout sslUploadContainer = new VerticalLayout();
    try {
        certificateUploader.setSizeFull();
        certificateUploader.setUploadNotifier(uploadStatus -> {
            if (uploadStatus) {
                buildSslConfigurationTable();
            }
        });
        sslUploadContainer.addComponent(ViewUtil.createSubHeader(title, null));
        sslUploadContainer.addComponent(certificateUploader);
    } catch (Exception e) {
        log.error("Cannot add upload component. Trust manager factory failed to initialize", e);
        ViewUtil.iscNotification(getString(MAINTENANCE_SSLCONFIGURATION_UPLOAD_INIT_FAILED, new Date()),
                null, Notification.Type.TRAY_NOTIFICATION);
    }
    return sslUploadContainer;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:19,代碼來源:SslConfigurationLayout.java

示例3: Step4

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
public Step4() {
  VerticalLayout content = new VerticalLayout();
  content.setWidth(100, Sizeable.Unit.PERCENTAGE);
  content.setSpacing(true);
  content.setMargin(true);

  Label errorTitle = new Label("Step Validation");
  errorTitle.addStyleName(ValoTheme.LABEL_H2);
  Label errorLabel = new Label("You can validate the contents of your step and show an " +
                               "error message.<br>Try it out using the text field below " +
                               "(it should not be empty).", ContentMode.HTML);

  TextField textField = new TextField("Please enter a value");

  content.addComponent(errorTitle);
  content.addComponent(errorLabel);
  content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE));
  content.addComponent(textField);

  addStepBackListener(StepperActions::back);
  addStepNextListener(event -> {
    Stepper stepper = event.getSource();
    stepper.hideError();

    String value = textField.getValue();
    if (StringUtils.isBlank(value)) {
      stepper.showError(new RuntimeException("Field should not be empty"));
    } else {
      stepper.next();
    }
  });

  setCaption("Step 4");
  setDescription("Step Validation");
  setContent(content);
}
 
開發者ID:Juchar,項目名稱:md-stepper,代碼行數:37,代碼來源:Step4.java

示例4: Step2

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
public Step2() {
  super(true); // Use default actions

  VerticalLayout content = new VerticalLayout();
  content.setWidth(100, Sizeable.Unit.PERCENTAGE);
  content.setSpacing(true);
  content.setMargin(true);

  Label stepAttributesTitle = new Label("Step Attributes");
  stepAttributesTitle.addStyleName(ValoTheme.LABEL_H2);
  Label stepAttributesLabel = new Label("You can change various attributes on a single step:" +
                                        "<ul>" +
                                        "<li>caption</li>" +
                                        "<li>description</li>" +
                                        "<li>icon</li>" +
                                        "<li>optional (to be able to skip it)</li>" +
                                        "<li>editable (come back if skipped or next, show edit " +
                                        "icon)" +
                                        "</li>" +
                                        "</ul>", ContentMode.HTML);

  content.addComponent(stepAttributesTitle);
  content.addComponent(stepAttributesLabel);
  content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE));

  setCaption("Step 2");
  setDescription("Step Attributes");
  setContent(content);
  setIcon(VaadinIcons.BAR_CHART);
  setOptional(true);
  setEditable(true);
}
 
開發者ID:Juchar,項目名稱:md-stepper,代碼行數:33,代碼來源:Step2.java

示例5: Step3

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
public Step3() {
  VerticalLayout content = new VerticalLayout();
  content.setWidth(100, Sizeable.Unit.PERCENTAGE);
  content.setSpacing(true);
  content.setMargin(true);

  Label feedbackTitle = new Label("Step Feedback");
  feedbackTitle.addStyleName(ValoTheme.LABEL_H2);
  Label stepFeedbackLabel = new Label("The stepper provides the possibility to show a " +
                                      "feedback message for long running operations.<br>Just " +
                                      "click next to see an example.", ContentMode.HTML);

  content.addComponent(feedbackTitle);
  content.addComponent(stepFeedbackLabel);
  content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE));

  addStepBackListener(StepperActions::back);
  addStepNextListener(event -> {
    Stepper stepper = event.getSource();
    stepper.showFeedbackMessage("Long loading operation is being performed");

    UI currentUi = UI.getCurrent();

    new Timer().schedule(new TimerTask() {

      @Override
      public void run() {
        currentUi.access(() -> {
          stepper.hideFeedbackMessage();
          stepper.next();
        });
      }
    }, 2000);
  });

  setCaption("Step 3");
  setDescription("Long running Operations");
  setContent(content);
}
 
開發者ID:Juchar,項目名稱:md-stepper,代碼行數:40,代碼來源:Step3.java

示例6: Step1

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
public Step1() {
  super(true); // Use default actions

  VerticalLayout content = new VerticalLayout();
  content.setWidth(100, Sizeable.Unit.PERCENTAGE);
  content.setSpacing(true);
  content.setMargin(true);

  Label basicInformationTitle = new Label("Basic Information");
  basicInformationTitle.addStyleName(ValoTheme.LABEL_H2);
  Label basicInformationLabel = new Label("The stepper component can be used to iterate " +
                                          "through the single steps of a process. Depending on " +
                                          "whether the stepper is declared linear or not, " +
                                          "the provided steps have to be completed in order - " +
                                          "or not.");

  Label demoUsageTitle = new Label("Demo Usage");
  demoUsageTitle.addStyleName(ValoTheme.LABEL_H3);
  Label demoUsageLabel = new Label("You can use the panel on the left side to change and " +
                                   "try out different attributes of the stepper.<br>" +
                                   "Additionally, the demo will show the various possibilities " +
                                   "to use the stepper and its steps when you progress through " +
                                   "the single steps.", ContentMode.HTML);

  content.addComponent(basicInformationTitle);
  content.addComponent(basicInformationLabel);
  content.addComponent(demoUsageTitle);
  content.addComponent(demoUsageLabel);
  content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE));

  setCaption("Step 1");
  setDescription("Basic Stepper Features");
  setContent(content);
}
 
開發者ID:Juchar,項目名稱:md-stepper,代碼行數:35,代碼來源:Step1.java

示例7: initLayout

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
 * Initialise le layout principal
 */
private void initLayout() {
	layout.setSizeFull();
	setContent(layout);

	menuLayout.setPrimaryStyleName(ValoTheme.MENU_ROOT);

	layoutWithSheet.setPrimaryStyleName(StyleConstants.VALO_CONTENT);
	layoutWithSheet.addStyleName(StyleConstants.SCROLLABLE);		
	layoutWithSheet.setSizeFull();
	
	VerticalLayout vlAll = new VerticalLayout();
	vlAll.addStyleName(StyleConstants.SCROLLABLE);
	vlAll.setSizeFull();
	
	subBarMenu.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
	subBarMenu.setVisible(false);
	vlAll.addComponent(subBarMenu);
	
	contentLayout.addStyleName(StyleConstants.SCROLLABLE);
	contentLayout.setSizeFull();
	vlAll.addComponent(contentLayout);
	vlAll.setExpandRatio(contentLayout, 1);
	
	layoutWithSheet.addComponent(vlAll);
	
	menuButtonLayout.addStyleName(StyleConstants.VALO_MY_MENU_MAX_WIDTH);	
	layout.setExpandRatio(layoutWithSheet, 1);

	Responsive.makeResponsive(this);
	addStyleName(ValoTheme.UI_WITH_MENU);
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:35,代碼來源:MainUI.java

示例8: createComponent

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
private VerticalLayout createComponent(String caption, String title, FormLayout content, String guid) {
    VerticalLayout tabSheet = new VerticalLayout();
    Panel panel = new Panel();
    // creating subHeader inside panel
    panel.setContent(content);
    panel.setSizeFull();
    tabSheet.addComponent(ViewUtil.createSubHeader(title, guid));
    tabSheet.addComponent(panel);
    return tabSheet;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:11,代碼來源:PluginView.java

示例9: createTab

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
private VerticalLayout createTab(String caption, String title, FormLayout content, String guid) {
    VerticalLayout tabSheet = new VerticalLayout();
    tabSheet.setCaption(caption);
    tabSheet.setStyleName(StyleConstants.TAB_SHEET);
    Panel panel = new Panel();
    // creating subHeader inside panel
    panel.setContent(content);
    panel.setSizeFull();
    tabSheet.addComponent(ViewUtil.createSubHeader(title, guid));
    tabSheet.addComponent(panel);
    return tabSheet;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:13,代碼來源:MaintenanceView.java

示例10: buildMainLayout

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
private Component buildMainLayout() {
    // top-level component properties
    setWidth("100.0%");
    setHeight("-1px");
    setStyleName(StyleConstants.PAGE_INFO_COMPONENT_COMMON);

    // infoLabel
    this.titleLabel = new Label();
    initializeLabel(this.titleLabel);

    final Button collapseButton = new Button();
    collapseButton.setStyleName(Reindeer.BUTTON_LINK);
    collapseButton.setIcon(new ThemeResource(StyleConstants.EXPAND_IMAGE));
    collapseButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            PageInformationComponent.this.contentLabel.setVisible(!PageInformationComponent.this.contentLabel
                    .isVisible());
            if (PageInformationComponent.this.contentLabel.isVisible()) {
                collapseButton.setIcon(new ThemeResource(StyleConstants.COLLAPSE_IMAGE));
            } else {
                collapseButton.setIcon(new ThemeResource(StyleConstants.EXPAND_IMAGE));
            }
        }
    });

    HorizontalLayout titleLayout = new HorizontalLayout();
    initializeLayout(titleLayout);
    titleLayout.setStyleName(StyleConstants.PAGE_INFO_TITLE_LAYOUT);

    titleLayout.addComponent(this.titleLabel);
    titleLayout.addComponent(collapseButton);
    titleLayout.setExpandRatio(this.titleLabel, 1.0f);

    this.contentLabel = new Label();
    initializeLabel(this.contentLabel);
    this.contentLabel.setVisible(false);

    this.contentLabel.setStyleName(StyleConstants.PAGE_INFO_CONTENT_LABEL);
    this.contentLabel.setContentMode(ContentMode.HTML);

    VerticalLayout mainLayout = new VerticalLayout();
    initializeLayout(mainLayout);
    mainLayout.addComponent(titleLayout);
    mainLayout.addComponent(this.contentLabel);

    return mainLayout;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:50,代碼來源:PageInformationComponent.java

示例11: ScolTagWindow

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
 * Crée une fenêtre d'édition de tag
 * @param tag la tag à éditer
 */
public ScolTagWindow(Tag tag) {
	/* Style */
	setModal(true);
	setWidth(550,Unit.PIXELS);
	setResizable(true);
	setClosable(true);

	/* Layout */
	VerticalLayout layout = new VerticalLayout();
	layout.setWidth(100, Unit.PERCENTAGE);
	layout.setMargin(true);
	layout.setSpacing(true);
	setContent(layout);

	/* Titre */
	setCaption(applicationContext.getMessage("tag.window", null, UI.getCurrent().getLocale()));

	/* Formulaire */
	fieldGroup = new CustomBeanFieldGroup<>(Tag.class);
	fieldGroup.setItemDataSource(tag);
	FormLayout formLayout = new FormLayout();
	formLayout.setWidth(100, Unit.PERCENTAGE);
	formLayout.setSpacing(true);
	for (String fieldName : FIELDS_ORDER) {
		String caption = applicationContext.getMessage("tag.table." + fieldName, null, UI.getCurrent().getLocale());
		Field<?> field;
		if (fieldName.equals(Tag_.colorTag.getName())){
			field = fieldGroup.buildAndBind(caption, fieldName, RequiredColorPickerField.class);
		}else{
			field = fieldGroup.buildAndBind(caption, fieldName);
		}
		
		field.setWidth(100, Unit.PERCENTAGE);			
		formLayout.addComponent(field);
	}
	
	RequiredColorPickerField fieldColor = (RequiredColorPickerField)fieldGroup.getField(Tag_.colorTag.getName());
	if (tag.getColorTag()!=null){			
		fieldColor.changeFieldColor(tag.getColorTag());
	}

	layout.addComponent(formLayout);

	/* Ajoute les boutons */
	HorizontalLayout buttonsLayout = new HorizontalLayout();
	buttonsLayout.setWidth(100, Unit.PERCENTAGE);
	buttonsLayout.setSpacing(true);
	layout.addComponent(buttonsLayout);

	btnAnnuler = new OneClickButton(applicationContext.getMessage("btnAnnuler", null, UI.getCurrent().getLocale()), FontAwesome.TIMES);
	btnAnnuler.addClickListener(e -> close());
	buttonsLayout.addComponent(btnAnnuler);
	buttonsLayout.setComponentAlignment(btnAnnuler, Alignment.MIDDLE_LEFT);

	btnEnregistrer = new OneClickButton(applicationContext.getMessage("btnSave", null, UI.getCurrent().getLocale()), FontAwesome.SAVE);
	btnEnregistrer.addStyleName(ValoTheme.BUTTON_PRIMARY);		
	btnEnregistrer.addClickListener(e -> {
		try {
			/* Valide la saisie */
			fieldGroup.commit();
			/* Enregistre la tag saisie */
			tagController.saveTag(tag);
			/* Ferme la fenêtre */
			close();
		} catch (CommitException ce) {
		}
	});
	buttonsLayout.addComponent(btnEnregistrer);
	buttonsLayout.setComponentAlignment(btnEnregistrer, Alignment.MIDDLE_RIGHT);

	/* Centre la fenêtre */
	center();
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:78,代碼來源:ScolTagWindow.java

示例12: NetworkLayout

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
public NetworkLayout(GetNetworkSettingsServiceApi getNetworkSettingsService,
        CheckNetworkSettingsServiceApi checkNetworkSettingsService,
        SetNetworkSettingsServiceApi setNetworkSettingsService,
        GetNATSettingsServiceApi getNATSettingsService,
        SetNATSettingsServiceApi setNATSettingsService,
        ValidationApi validator, ServerApi server) {
    super();
    this.getNetworkSettingsService = getNetworkSettingsService;
    this.checkNetworkSettingsService = checkNetworkSettingsService;
    this.setNetworkSettingsService = setNetworkSettingsService;
    this.getNATSettingsService = getNATSettingsService;
    this.setNATSettingsService = setNATSettingsService;
    this.server = server;
    try {

        // creating layout to hold option group and edit button
        HorizontalLayout optionLayout = new HorizontalLayout();
        optionLayout.addComponent(createIPSettingsEditButton());
        optionLayout.addComponent(createOptionGroup());
        optionLayout.addStyleName(StyleConstants.COMPONENT_SPACING_TOP_BOTTOM);

        Panel networkPanel = new Panel("IP Details");
        VerticalLayout networkLayout = new VerticalLayout();
        networkLayout.addComponent(optionLayout);
        this.networkTable = createNetworkTable();
        networkLayout.addComponent(this.networkTable);
        networkPanel.setContent(networkLayout);

        Panel natPanel = new Panel("NAT Details");
        VerticalLayout natLayout = new VerticalLayout();
        HorizontalLayout editNatLayout = new HorizontalLayout();
        editNatLayout.addStyleName(StyleConstants.COMPONENT_SPACING_TOP_BOTTOM);
        editNatLayout.addComponent(createNATEditButton());
        natLayout.addComponent(editNatLayout);

        this.natTable = createNATTable();
        natLayout.addComponent(this.natTable);
        natLayout.addStyleName(StyleConstants.COMPONENT_SPACING_TOP_BOTTOM);
        natPanel.setContent(natLayout);

        // populating Network Information in the Table
        populateNetworkTable();

        // populating NAT information in the Table
        populateNATTable();

        addComponent(networkPanel);
        addComponent(natPanel);

    } catch (Exception ex) {
        log.error("Failed to get network settings", ex);
    }
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:54,代碼來源:NetworkLayout.java

示例13: populateMailTypeDecLayout

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
private void populateMailTypeDecLayout(VerticalLayout layoutMailTypeDec) {
	/* Boutons */
	HorizontalLayout buttonsLayout = new HorizontalLayout();
	buttonsLayout.setWidth(100, Unit.PERCENTAGE);
	buttonsLayout.setSpacing(true);
	layoutMailTypeDec.addComponent(buttonsLayout);
	
	OneClickButton btnNew = new OneClickButton(applicationContext.getMessage("mail.btnNouveau", null, UI.getCurrent().getLocale()), FontAwesome.PLUS);
	btnNew.setEnabled(true);
	btnNew.addClickListener(e -> {
		mailController.editNewMail();
	});
	buttonsLayout.addComponent(btnNew);
	buttonsLayout.setComponentAlignment(btnNew, Alignment.MIDDLE_LEFT);


	OneClickButton btnEditMailTypeDec = new OneClickButton(applicationContext.getMessage("btnEdit", null, UI.getCurrent().getLocale()), FontAwesome.PENCIL);
	btnEditMailTypeDec.setEnabled(false);
	btnEditMailTypeDec.addClickListener(e -> {
		if (mailTypeDecTable.getValue() instanceof Mail) {
			mailController.editMail((Mail) mailTypeDecTable.getValue());
		}
	});
	buttonsLayout.addComponent(btnEditMailTypeDec);
	buttonsLayout.setComponentAlignment(btnEditMailTypeDec, Alignment.MIDDLE_CENTER);
	
	OneClickButton btnDelete = new OneClickButton(applicationContext.getMessage("btnDelete", null, UI.getCurrent().getLocale()), FontAwesome.TRASH_O);
	btnDelete.setEnabled(false);
	btnDelete.addClickListener(e -> {
		if (mailTypeDecTable.getValue() instanceof Mail) {
			mailController.deleteMail((Mail) mailTypeDecTable.getValue());
		}			
	});
	buttonsLayout.addComponent(btnDelete);
	buttonsLayout.setComponentAlignment(btnDelete, Alignment.MIDDLE_RIGHT);


	/* Table des mails avec type de decision */
	BeanItemContainer<Mail> container = new BeanItemContainer<Mail>(Mail.class, mailController.getMailsTypeDecScol());
	container.addNestedContainerProperty(Mail_.typeAvis.getName()+"."+TypeAvis_.libelleTypAvis.getName());
	mailTypeDecTable.setContainerDataSource(container);		
	mailTypeDecTable.addBooleanColumn(Mail_.tesMail.getName());
	mailTypeDecTable.setSizeFull();
	mailTypeDecTable.setVisibleColumns((Object[]) MAIL_FIELDS_ORDER);
	for (String fieldName : MAIL_FIELDS_ORDER) {
		mailTypeDecTable.setColumnHeader(fieldName, applicationContext.getMessage("mail.table." + fieldName, null, UI.getCurrent().getLocale()));
	}
	mailTypeDecTable.setSortContainerPropertyId(Mail_.codMail.getName());
	mailTypeDecTable.setColumnCollapsingAllowed(true);
	mailTypeDecTable.setColumnReorderingAllowed(true);
	mailTypeDecTable.setSelectable(true);
	mailTypeDecTable.setImmediate(true);
	mailTypeDecTable.addItemSetChangeListener(e -> mailTypeDecTable.sanitizeSelection());
	mailTypeDecTable.addValueChangeListener(e -> {
		/* Les boutons d'édition de mail sont actifs seulement si un mail est sélectionnée. */
		boolean mailIsSelected = mailTypeDecTable.getValue() instanceof Mail;
		btnEditMailTypeDec.setEnabled(mailIsSelected);
		btnDelete.setEnabled(mailIsSelected);
	});
	mailTypeDecTable.addItemClickListener(e -> {
		if (e.isDoubleClick()) {
			mailTypeDecTable.select(e.getItemId());
			btnEditMailTypeDec.click();
		}
	});
	layoutMailTypeDec.addComponent(mailTypeDecTable);
	layoutMailTypeDec.setExpandRatio(mailTypeDecTable, 1);
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:69,代碼來源:ScolMailView.java

示例14: init

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
@Override
protected void init(VaadinRequest request) {

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.setSizeFull();
    
    
    Grid<DemoPerson> grid = new Grid("<b>Demo Grid</b>", new ListDataProvider(DemoPerson.getPersonList()));
    grid.setCaptionAsHtml(true);
    grid.setSizeFull();
    grid.setSelectionMode(Grid.SelectionMode.NONE);

    Grid.Column<DemoPerson, String> idColumn = grid.addColumn(DemoPerson::getId).setCaption("Id");
    Grid.Column<DemoPerson, String> firstNameColumn = grid.addColumn(DemoPerson::getFirstName).setCaption("Firstname");
    Grid.Column<DemoPerson, String> surNameColumn = grid.addColumn(DemoPerson::getSurName).setCaption("Surname");
    Grid.Column<DemoPerson, String> companyColumn = grid.addColumn(DemoPerson::getCompany, 
            new ClickableTextRenderer(getCompanyClickListener())).setCaption("Company");
    Grid.Column<DemoPerson, String> companyTypeColumn = grid.addColumn(DemoPerson::getCompanyType).setCaption("Company Type");
    Grid.Column<DemoPerson, String> cityColumn = grid.addColumn(DemoPerson::getCity).setCaption("City");
    
    
    // Use the advanced form of the Clickable Text Renderer on 
    // column "city". This will require a value provider where the PRESENTATION
    // class is of type ClickableText. Because the city is of type String
    // the value provider must convert from String to ClickableText.
    cityColumn.setRenderer((String source) -> {
        ClickableText ct = new ClickableText();
        ct.description = "Will take you to " + source;  // Sets the HTML title attribute, aka tooltip
        
        // I want a space between the underlined text and the icon. To avoid the 
        // space being underlined (because of the link styling) I use a
        // a different style for the space itself.
        ct.value = source + "<span class=\"v-icon\">&nbsp;</span>" + VaadinIcons.EXTERNAL_LINK.getHtml();
        ct.isHTML = true;
        return ct;
    }, new ClickableTextRendererAdv<>(getCityClickListener()));
    
    
    layout.addComponent(grid);
    setContent(layout);
}
 
開發者ID:phansson,項目名稱:vaadin-clickabletextrenderer-v8,代碼行數:44,代碼來源:DemoUI.java

示例15: AdminBatchImmediatWindow

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
 * Crée une fenêtre de confirmation de lancement
 * @param message
 * @param titre
 */
public AdminBatchImmediatWindow(String message, String titre) {
	/* Style */
	setWidth(400, Unit.PIXELS);
	setModal(true);
	setResizable(false);
	setClosable(false);

	/* Layout */
	VerticalLayout layout = new VerticalLayout();
	layout.setMargin(true);
	layout.setSpacing(true);
	setContent(layout);

	/* Titre */
	if (titre == null) {
		titre = applicationContext.getMessage("confirmWindow.defaultTitle", null, UI.getCurrent().getLocale());
	}
	setCaption(titre);

	/* Texte */
	if (message == null) {
		message = applicationContext.getMessage("confirmWindow.defaultQuestion", null, UI.getCurrent().getLocale());
	}
	Label textLabel = new Label(message);
	layout.addComponent(textLabel);

	/* Boutons */
	HorizontalLayout buttonsLayout = new HorizontalLayout();
	buttonsLayout.setWidth(100, Unit.PERCENTAGE);
	buttonsLayout.setSpacing(true);
	layout.addComponent(buttonsLayout);

	btnNon.setCaption(applicationContext.getMessage("confirmWindow.btnNon", null, UI.getCurrent().getLocale()));
	btnNon.setIcon(FontAwesome.TIMES);
	btnNon.addClickListener(e -> close());
	buttonsLayout.addComponent(btnNon);
	buttonsLayout.setComponentAlignment(btnNon, Alignment.MIDDLE_LEFT);

	btnOui.setCaption(applicationContext.getMessage("confirmWindow.btnOui", null, UI.getCurrent().getLocale()));
	btnOui.setIcon(FontAwesome.CHECK);
	btnOui.addStyleName(ValoTheme.BUTTON_PRIMARY);
	buttonsLayout.addComponent(btnOui);
	buttonsLayout.setComponentAlignment(btnOui, Alignment.MIDDLE_RIGHT);

	/* Centre la fenêtre */
	center();
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:53,代碼來源:AdminBatchImmediatWindow.java


注:本文中的com.vaadin.ui.VerticalLayout.addComponent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。