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


Java VerticalLayout.setMargin方法代碼示例

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


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

示例1: init

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

	VerticalLayout layout = new VerticalLayout();
	layout.setSizeFull();
	layout.setMargin(true);

	testGrid.setSizeFull();
	testGrid.getEditor().setEnabled(true);

	testGrid.setItems(getCustomers());

	layout.addComponent(testGrid);

	setContent(layout);
}
 
開發者ID:peterl1084,項目名稱:bean-grid,代碼行數:18,代碼來源:TestUI.java

示例2: ResultPanel

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
public ResultPanel(HighlightedSearchResult searchResult) {
    HttpArticle article  = searchResult.getArticle();
    String highlights = searchResult.getHighlights().stream().collect(Collectors.joining("<br/>...<br/>"));
    String text = String.format(RESULTS_TEMPLATE,
            DataUtils.formatInUTC(article.getPublished()).replace("T", " "),
            article.getUrl(), article.getTitle(), article.getSource(), highlights);
    Label content = new Label(text);
    content.setContentMode(ContentMode.HTML);
    VerticalLayout component = new VerticalLayout(content);
    component.setMargin(true);
    setContent(component);
}
 
開發者ID:tokenmill,項目名稱:crawling-framework,代碼行數:13,代碼來源:ResultPanel.java

示例3: 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

示例4: init

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

	// Root layout
       final VerticalLayout root = new VerticalLayout();
       root.setSizeFull();

       root.setSpacing(false);
       root.setMargin(false);

       setContent(root);

       // Main panel
       springViewDisplay = new Panel();
       springViewDisplay.setSizeFull();

       root.addComponent(springViewDisplay);
       root.setExpandRatio(springViewDisplay, 1);

       // Footer
       Layout footer = getFooter();
       root.addComponent(footer);
       root.setExpandRatio(footer, 0);

       // Error handler
	UI.getCurrent().setErrorHandler(new UIErrorHandler());

	// Disable session expired notification, the page will be reloaded on any action
	VaadinService.getCurrent().setSystemMessagesProvider(
			systemMessagesInfo -> {
				CustomizedSystemMessages msgs = new CustomizedSystemMessages();
				msgs.setSessionExpiredNotificationEnabled(false);
				return msgs;
			});
}
 
開發者ID:vianneyfaivre,項目名稱:Persephone,代碼行數:36,代碼來源:PersephoneUI.java

示例5: ProgressIndicatorWindow

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
public ProgressIndicatorWindow() {
    center();
    setVisible(true);
    setResizable(false);
    setDraggable(false);
    setImmediate(true);
    setModal(true);
    setClosable(false);
    setCaption("Loading");

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setWidth("100%");

    this.currentStatus = new Label();
    this.currentStatus.addStyleName(StyleConstants.TEXT_ALIGN_CENTER);
    this.currentStatus.setSizeFull();
    this.currentStatus.setImmediate(true);

    ProgressBar progressBar = new ProgressBar();
    progressBar.setSizeFull();
    progressBar.setIndeterminate(true);
    progressBar.setImmediate(true);
    progressBar.setVisible(true);

    layout.addComponent(progressBar);
    layout.addComponent(this.currentStatus);
    layout.setComponentAlignment(this.currentStatus, Alignment.MIDDLE_CENTER);
    layout.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER);
    setContent(layout);
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:32,代碼來源:ProgressIndicatorWindow.java

示例6: createPopUpContent

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
 * Créé la popup SVA
 *
 * @param listeAlerteSva
 * @param dateSva
 * @return le contenu de la popup SVA
 */
private Content createPopUpContent(final List<AlertSva> listeAlerteSva, final String dateSva) {
	VerticalLayout vlAlert = new VerticalLayout();
	vlAlert.setMargin(true);
	vlAlert.setSpacing(true);

	Label labelTitle = new Label(applicationContext.getMessage("alertSva.popup.title",
			new Object[] {alertSvaController.getLibelleDateSVA(dateSva)}, UI.getCurrent().getLocale()));
	labelTitle.addStyleName(ValoTheme.LABEL_LARGE);
	labelTitle.addStyleName(ValoTheme.LABEL_BOLD);
	vlAlert.addComponent(labelTitle);

	listeAlerteSva.forEach(alert -> {
		vlAlert.addComponent(
				new Label(
						"<div style='display:inline-block;border:1px solid;width:20px;height:20px;background:"
								+ alert.getColorSva()
								+ ";'></div><div style='height:100%;display: inline-block;vertical-align: super;'>"
								+ applicationContext.getMessage("alertSva.popup.alert",
										new Object[] {alert.getNbJourSva()}, UI.getCurrent().getLocale())
								+ "</div>",
						ContentMode.HTML));
	});
	return new Content() {
		/** serialVersionUID **/
		private static final long serialVersionUID = -4599757106887300854L;

		@Override
		public String getMinimizedValueAsHTML() {
			return applicationContext.getMessage("alertSva.popup.link", null, UI.getCurrent().getLocale());
		}

		@Override
		public Component getPopupComponent() {
			return vlAlert;
		}
	};
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:45,代碼來源:CandidatureViewTemplate.java

示例7: init

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
 * Initialise la vue
 */
@PostConstruct
public void init() {		
	
	/* Style */
	setSizeFull();
	setSpacing(true);		
	
	/*Layout des mails*/
	VerticalLayout layoutMailModel = new VerticalLayout();
	layoutMailModel.setSizeFull();
	layoutMailModel.setSpacing(true);
	layoutMailModel.setMargin(true);
	
	/*Layout des typ decision*/
	VerticalLayout layoutMailTypeDec = new VerticalLayout();
	layoutMailTypeDec.setSizeFull();
	layoutMailTypeDec.setSpacing(true);
	layoutMailTypeDec.setMargin(true);
	
	/*Le layout a onglet*/
	TabSheet sheet = new TabSheet();
	sheet.setImmediate(true);
	sheet.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
	addComponent(sheet);
	sheet.setSizeFull();
	
	sheet.addTab(layoutMailModel, applicationContext.getMessage("mail.model.title", null, UI.getCurrent().getLocale()),FontAwesome.ENVELOPE_O);
	sheet.addTab(layoutMailTypeDec, applicationContext.getMessage("mail.typdec.title", null, UI.getCurrent().getLocale()),FontAwesome.ENVELOPE);
	
	/*Populate le layoutMailModel*/
	populateMailModelLayout(layoutMailModel);
	
	/*Populate le layoutMailModel*/
	populateMailTypeDecLayout(layoutMailTypeDec);
	
	
	/* Inscrit la vue aux mises à jour de mail */
	mailEntityPusher.registerEntityPushListener(this);
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:43,代碼來源:ScolMailView.java

示例8: getHealth

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
private VerticalLayout getHealth(Health health) {
	HorizontalLayout cards = new HorizontalLayout();

	if(health.getDiskSpace().isPresent()) {
		long diskFree = health.getDiskSpace().get().getFree();
		long diskTotal = health.getDiskSpace().get().getTotal();

		long percentageFree = (diskFree * 100) / diskTotal;

		cards.addComponent(new Card("Disk",
							health.getDiskSpace().get().getStatus(),
							String.format("Free diskspace: %s %%", percentageFree)));
	}

	if(health.getDb().isPresent()) {
		cards.addComponent(new Card("Database",
				health.getDb().get().getStatus(),
				String.format("Vendor: %s", health.getDb().get().getDatabase())));
	}

	VerticalLayout layout = new VerticalLayout();

	layout.addComponent(new Label(String.format("Application is %s", health.getStatus())));
	if(cards.getComponentCount() == 0) {
		layout.addComponent(new Label("No additional data to display"));
	} else {
		layout.addComponent(cards);
	}

	layout.setMargin(false);

	return layout;
}
 
開發者ID:vianneyfaivre,項目名稱:Persephone,代碼行數:34,代碼來源:MetricsPage.java

示例9: 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

示例10: init

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

	applications = this.appService.findAll();

	// Title
	Label title = new Label("<h2>Applications</h2>", ContentMode.HTML);

	initApplicationsGrid();

	// Build layout
	VerticalLayout leftLayout = new VerticalLayout(title, grid);
	leftLayout.setMargin(false);
	this.addComponent(leftLayout);

	// Center align layout
	this.setWidth("100%");
	this.setMargin(new MarginInfo(false, true));
}
 
開發者ID:vianneyfaivre,項目名稱:Persephone,代碼行數:20,代碼來源:ApplicationsPage.java

示例11: CtrCandActionPjWindow

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
 * Crée une fenêtre d'action sur une ou plusieurs pièces justif
 * @param listePj la liste des pièces à manipuler
 */
@SuppressWarnings("unchecked")
public CtrCandActionPjWindow(List<PjPresentation> listePj) {
	/* Style */
	setModal(true);
	setWidth(550,Unit.PIXELS);
	setResizable(true);
	setClosable(true);

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

	/* Titre */
	setCaption(applicationContext.getMessage("pj.action.window", null, UI.getCurrent().getLocale()));
       
       /*Le field group pour la decision*/
       fieldGroup = new CustomBeanFieldGroup<>(PjCand.class);
	fieldGroup.setItemDataSource(new PjCand());
	formLayout = new FormLayout();
	formLayout.setCaption(applicationContext.getMessage("pj.action.label", new Object[]{listePj.size()}, UI.getCurrent().getLocale()));
	formLayout.setWidth(100, Unit.PERCENTAGE);
	formLayout.setSpacing(true);
	for (String fieldName : FIELDS_ORDER) {
		Field<?> field = fieldGroup.buildAndBind(applicationContext.getMessage("pj.action." + fieldName, null, UI.getCurrent().getLocale()), fieldName);
		field.setWidth(100, Unit.PERCENTAGE);
		formLayout.addComponent(field);
	}
	layout.addComponent(formLayout);
	
	RequiredTextField tf = (RequiredTextField)fieldGroup.getField(PjCand_.commentPjCand.getName());
	RequiredComboBox<TypeStatutPiece> cb = (RequiredComboBox<TypeStatutPiece>)fieldGroup.getField(PjCand_.typeStatutPiece.getName());
	cb.setRequired(true);
	cb.setRequiredError(applicationContext.getMessage("validation.obigatoire", null, UI.getCurrent().getLocale()));
	if (listePj.size()==1){						
		cb.setValue(new TypeStatutPiece(listePj.get(0).getCodStatut(),""));
		tf.setValue(listePj.get(0).getCommentaire());
	}
	
       
	/* Ajoute les boutons */
	HorizontalLayout buttonsLayout = new HorizontalLayout();
	buttonsLayout.setWidth(100, Unit.PERCENTAGE);
	buttonsLayout.setSpacing(true);
	layout.addComponent(buttonsLayout);
	
	btnClose = new OneClickButton(applicationContext.getMessage("btnClose", null, UI.getCurrent().getLocale()), FontAwesome.TIMES);
	btnClose.addClickListener(e -> close());
	buttonsLayout.addComponent(btnClose);
	buttonsLayout.setComponentAlignment(btnClose, Alignment.MIDDLE_LEFT);

	btnValid = new OneClickButton(applicationContext.getMessage("btnValid", null, UI.getCurrent().getLocale()), FontAwesome.SAVE);
	btnValid.addClickListener(e -> {
		try {
			/* Valide la saisie */
			fieldGroup.commit();
			/* Enregistre la typeStatutPiece saisie */
			changeStatutPieceWindowListener.btnOkClick((TypeStatutPiece)cb.getValue(),tf.getValue());
			/* Ferme la fenêtre */
			close();
		} catch (CommitException ce) {
		}			
	});
	buttonsLayout.addComponent(btnValid);
	buttonsLayout.setComponentAlignment(btnValid, Alignment.MIDDLE_RIGHT);
	
	/* Centre la fenêtre */
	center();
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:75,代碼來源:CtrCandActionPjWindow.java

示例12: 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

示例13: 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

示例14: ScolTypeStatutWindow

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
 * Crée une fenêtre d'édition de typeStatut
 * @param typeStatut la typeStatut à éditer
 */
public ScolTypeStatutWindow(TypeStatut typeStatut) {
	/* 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("typeStatut.window", null, UI.getCurrent().getLocale()));

	/* Formulaire */
	fieldGroup = new CustomBeanFieldGroup<>(TypeStatut.class);
	fieldGroup.setItemDataSource(typeStatut);
	FormLayout formLayout = new FormLayout();
	formLayout.setWidth(100, Unit.PERCENTAGE);
	formLayout.setSpacing(true);
	for (String fieldName : FIELDS_ORDER) {
		String caption = applicationContext.getMessage("typeStatut.table." + fieldName, null, UI.getCurrent().getLocale());
		Field<?> field = fieldGroup.buildAndBind(caption, fieldName);
		field.setWidth(100, Unit.PERCENTAGE);			
		formLayout.addComponent(field);
		if (fieldName.equals(TypeStatut_.i18nLibTypStatut.getName()) || fieldName.equals(TypeStatut_.temCommVisible.getName())){
			field.setEnabled(true);
		}else{
			field.setEnabled(false);
		}
	}
	
	((I18nField)fieldGroup.getField(TypeStatut_.i18nLibTypStatut.getName())).addCenterListener(e-> {if(e){center();}});

	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 typeStatut saisie */
			typeStatutController.saveTypeStatut(typeStatut);
			/* 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,代碼行數:74,代碼來源:ScolTypeStatutWindow.java

示例15: SearchCtrCandWindow

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
 * Crée une fenêtre de recherche de centre de candidature
 */
public SearchCtrCandWindow() {
	/* Style */
	setWidth(740, Unit.PIXELS);
	setHeight(480, Unit.PIXELS);
	setModal(true);
	setResizable(true);

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

	/* Titre */
	setCaption(applicationContext.getMessage("ctrCand.window.search.title", null, Locale.getDefault()));
	
	/* Table de Resultat de recherche*/
	grid.addItems(centreCandidatureController.getListCentreCandidature());
	grid.initColumn(FIELDS_ORDER, "ctrCand.table.", CentreCandidature_.codCtrCand.getName());
	grid.addSelectionListener(e->{
		// Le bouton d'enregistrement est actif seulement si un ctrCand est sélectionnée.
		boolean isSelected = grid.getSelectedItem() instanceof CentreCandidature;
		btnValider.setEnabled(isSelected);
	});
	grid.addItemClickListener(e->{
		if (e.isDoubleClick()) {
			grid.select(e.getItemId());
			btnValider.click();				
		}
	});
	
	grid.setColumnWidth(CentreCandidature_.codCtrCand.getName(), 180);
	grid.setExpendColumn(CentreCandidature_.libCtrCand.getName());
	
	layout.addComponent(grid);
	layout.setExpandRatio(grid, 1.0f);

	/* 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);
	
	btnValider = new OneClickButton(applicationContext.getMessage("btnValid", null, UI.getCurrent().getLocale()), FontAwesome.SAVE);
	btnValider.setEnabled(false);
	btnValider.addStyleName(ValoTheme.BUTTON_PRIMARY);
	btnValider.addClickListener(e -> {
		performAction();
	});
	buttonsLayout.addComponent(btnValider);
	buttonsLayout.setComponentAlignment(btnValider, Alignment.MIDDLE_RIGHT);
	

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


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