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


Java VerticalLayout.setExpandRatio方法代碼示例

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


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

示例1: init

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
@Override
protected void init(VaadinRequest request) {
	final VerticalLayout root = new VerticalLayout();
	root.setSizeFull();
	root.setMargin(true);
	root.setSpacing(true);
	setContent(root);
	MHorizontalLayout horizontalLayout = new MHorizontalLayout();
	for (MenuEntry menuEntry : menuEntries) {
		horizontalLayout.addComponent(new MButton(menuEntry.getName(), event -> {
			navigator.navigateTo(menuEntry.getNavigationTarget());
		}));
	}
	root.addComponent(horizontalLayout);
	springViewDisplay = new Panel();
	springViewDisplay.setSizeFull();
	root.addComponent(springViewDisplay);
	root.setExpandRatio(springViewDisplay, 1.0f);

}
 
開發者ID:dve,項目名稱:spring-boot-plugins-example,代碼行數:21,代碼來源:VaadinUI.java

示例2: init

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

    final CssLayout navigationBar = new CssLayout();
    navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    navigationBar.addComponent(createNavigationButton("Demo View (Default)",
            Constants.VIEW_DEFAULT));
    navigationBar.addComponent(createNavigationButton("Stream View",
            Constants.VIEW_STREAM));
    rootLayout.addComponent(navigationBar);

    springViewDisplay = new Panel();
    springViewDisplay.setSizeFull();
    
    rootLayout.addComponent(springViewDisplay);
    rootLayout.setExpandRatio(springViewDisplay, 1.0f);

}
 
開發者ID:MikeQin,項目名稱:spring-boot-vaadin-rabbitmq-pipeline-demo,代碼行數:22,代碼來源:NavigatorUI.java

示例3: createSubView

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
private void createSubView(String title, ToolbarButtons[] buttons) {
    setSizeFull();
    final VerticalLayout layout = new VerticalLayout();
    layout.addStyleName(StyleConstants.BASE_CONTAINER);
    layout.setSizeFull();

    final VerticalLayout panel = new VerticalLayout();
    panel.addStyleName("panel");
    panel.setSizeFull();

    layout.addComponent(createHeader(title));
    layout.addComponent(panel);

    if (buttons != null) {
        panel.addComponent(createToolbar(buttons));
    }

    panel.addComponent(createTable());
    panel.setExpandRatio(this.table, 1L);
    layout.setExpandRatio(panel, 1L);
    addComponent(layout);
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:23,代碼來源:CRUDBaseSubView.java

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

示例5: buildSidebar

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
private VerticalLayout buildSidebar() {
    VerticalLayout sideBar = new VerticalLayout();
    sideBar.addStyleName("sidebar");
    sideBar.addComponent(buildMainMenu());
    sideBar.setExpandRatio(this.menu, 1);
    sideBar.setWidth(null);
    sideBar.setHeight("100%");
    return sideBar;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:10,代碼來源:MainUI.java

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

示例7: CtrCandPostItAddWindow

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**Crée une fenêtre d'édition de postit
 * @param postIt
 */
public CtrCandPostItAddWindow(PostIt postIt) {		
	/* Layout */
	VerticalLayout layout = new VerticalLayout();
	layout.setWidth(600, Unit.PIXELS);
	layout.setMargin(true);
	layout.setSpacing(true);
	setContent(layout);

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

	/*Layout adresse*/		
	fieldGroup = new CustomBeanFieldGroup<PostIt>(PostIt.class,ConstanteUtils.TYP_FORM_CANDIDAT);
	fieldGroup.setItemDataSource(postIt);
	FormLayout formLayout = new FormLayout();
	formLayout.setWidth(100, Unit.PERCENTAGE);
	formLayout.setSpacing(true);
	Field<?> field = fieldGroup.buildAndBind(applicationContext.getMessage("postit.table." + PostIt_.messagePostIt.getName(), null, UI.getCurrent().getLocale()), PostIt_.messagePostIt.getName(), RequiredTextArea.class); 
	field.setWidth(100, Unit.PERCENTAGE);
	formLayout.addComponent(field);
	
	layout.addComponent(formLayout);
	layout.setExpandRatio(formLayout, 1);
	
	/* 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 du cursus*/
			fieldGroup.commit();
			/* Enregistre le cursus saisi */
			postItWindowListener.btnOkClick(candidatureCtrCandController.savePostIt(postIt));
			/* 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,代碼行數:58,代碼來源:CtrCandPostItAddWindow.java

示例8: CandidatAdresseWindow

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

	
	/*Layout adresse*/		
	fieldGroupAdresse = new CustomBeanFieldGroup<Adresse>(Adresse.class,ConstanteUtils.TYP_FORM_ADR);
	fieldGroupAdresse.setItemDataSource(adresse);
	AdresseForm adresseForm = new AdresseForm(fieldGroupAdresse, false);
	layout.addComponent(adresseForm);
	layout.setExpandRatio(adresseForm, 1);
	
	/* 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 de l'adresse*/
			fieldGroupAdresse.commit();
			/* Enregistre la commission saisie */
			adresseWindowListener.btnOkClick(fieldGroupAdresse.getItemDataSource().getBean());
			/* 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,代碼行數:60,代碼來源:CandidatAdresseWindow.java

示例9: SearchAnneeUnivApoWindow

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

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

	/* Titre */
	setCaption(applicationContext.getMessage("window.search.anneeUni.title", null, Locale.getDefault()));
	
	/* Table de Resultat de recherche*/
	List<SiScolAnneeUni> listeAnneeUni = cacheController.getListeAnneeUni();
	if (listeAnneeUni.size()==0){
		layout.addComponent(new Label(applicationContext.getMessage("window.search.anneeUni.noannee", null, Locale.getDefault())));
	}
	tableResult = new TableFormating(null, new BeanItemContainer<SiScolAnneeUni>(SiScolAnneeUni.class,listeAnneeUni));
	
	String[] columnHeadersHarp = new String[FIELDS_ORDER.length];
	for (int fieldIndex = 0; fieldIndex < FIELDS_ORDER.length; fieldIndex++){
		columnHeadersHarp[fieldIndex] = applicationContext.getMessage("window.search.anneeUni."+FIELDS_ORDER[fieldIndex], null, Locale.getDefault());
	}
	tableResult.setVisibleColumns((Object[])FIELDS_ORDER);
	tableResult.setSortContainerPropertyId(SiScolAnneeUni_.codAnu.getName());
	tableResult.setSortAscending(false);
	tableResult.setColumnHeaders(columnHeadersHarp);
	tableResult.setColumnCollapsingAllowed(true);
	tableResult.setColumnReorderingAllowed(true);
	tableResult.setSelectable(true);
	tableResult.setImmediate(true);
	tableResult.setSizeFull();
	tableResult.addItemSetChangeListener(e -> tableResult.sanitizeSelection());
	tableResult.addValueChangeListener(e -> {
		/* Le bouton d'enregistrement est actif seulement si un anneeUni est sélectionné. */
		boolean anneeUniIsSelected = tableResult.getValue() instanceof SiScolAnneeUni;
		btnValider.setEnabled(anneeUniIsSelected);
	});
	
	layout.addComponent(tableResult);
	layout.setExpandRatio(tableResult, 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("btnAdd", 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,代碼行數:75,代碼來源:SearchAnneeUnivApoWindow.java

示例10: SearchCommissionWindow

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**Crée une fenêtre de recherche de commission
 * @param ctrCand
 */
public SearchCommissionWindow(CentreCandidature ctrCand) {
	/* Style */
	setWidth(850, Unit.PIXELS);
	setHeight(480, Unit.PIXELS);
	setModal(true);
	setResizable(true);

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

	/* Titre */
	setCaption(applicationContext.getMessage("commission.window.search.title", null, Locale.getDefault()));
	
	/* Table de Resultat de recherche*/
	List<Commission> listeCommission;
	if (ctrCand != null){
		listeCommission = commissionController.getCommissionsByCtrCand(ctrCand);
	}else{
		listeCommission = commissionController.getCommissionsGestionnaire();
	}
	
	grid.addItems(listeCommission);
	grid.initColumn(FIELDS_ORDER, "commission.table.", Commission_.codComm.getName());
	grid.addSelectionListener(e->{
		// Le bouton d'enregistrement est actif seulement si une commission est sélectionnée.
		boolean isSelected = grid.getSelectedItem() instanceof Commission;
		btnValider.setEnabled(isSelected);
	});
	grid.addItemClickListener(e->{
		if (e.isDoubleClick()) {
			grid.select(e.getItemId());
			btnValider.click();				
		}
	});
	
	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,代碼行數:70,代碼來源:SearchCommissionWindow.java

示例11: InfoWindow

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
 * Crée une fenêtre d'information
 * @param message
 * @param titre
 */
public InfoWindow(String titre, String message, Integer width, Integer percentageHeight) {
	/* Style */
	if (width==null){
		width = 400;
	}
	setWidth(width, Unit.PIXELS);
	if (percentageHeight!=null){
		setHeight(percentageHeight,Unit.PERCENTAGE);
	}
	setModal(true);
	setResizable(false);
	setClosable(false);

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

	/* Titre */
	setCaption(titre);

	/* Texte */
	Label textLabel = new Label(message,ContentMode.HTML);
	
	if (percentageHeight!=null){
		layout.setSizeFull();
		/* Titre */
		VerticalLayout layoutItem = new VerticalLayout();
		layoutItem.setMargin(true);
		layoutItem.setWidth(100, Unit.PERCENTAGE);
		layoutItem.setSpacing(true);
		layoutItem.addComponent(textLabel);
		/* Panel */
		Panel panel = new Panel();
		panel.setSizeFull();
		panel.setContent(layoutItem);
		
		layout.addComponent(panel);
		layout.setExpandRatio(panel, 1);
	}else{
		layout.addComponent(textLabel);
	}
	
	

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

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

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

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

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

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**Rempli le layout de mail modele
 * @param layoutMailModel
 */
private void populateMailModelLayout(VerticalLayout layoutMailModel) {
	/* Boutons */
	HorizontalLayout buttonsLayout = new HorizontalLayout();
	buttonsLayout.setWidth(100, Unit.PERCENTAGE);
	buttonsLayout.setSpacing(true);
	layoutMailModel.addComponent(buttonsLayout);


	OneClickButton btnEditMailModel = new OneClickButton(applicationContext.getMessage("btnEdit", null, UI.getCurrent().getLocale()), FontAwesome.PENCIL);
	btnEditMailModel.setEnabled(false);
	btnEditMailModel.addClickListener(e -> {
		if (mailModelTable.getValue() instanceof Mail) {
			mailController.editMail((Mail) mailModelTable.getValue());
		}
	});
	buttonsLayout.addComponent(btnEditMailModel);
	buttonsLayout.setComponentAlignment(btnEditMailModel, Alignment.MIDDLE_LEFT);

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

示例15: HorizontalStepper

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
 * Create a new horizontal stepper using the given iterator and label change handler.
 *
 * @param stepIterator
 *     The iterator that handles the iteration over the given steps
 * @param labelProvider
 *     The handler that handles changes to labels
 */
private HorizontalStepper(StepIterator stepIterator, LabelProvider labelProvider) {
  super(stepIterator, labelProvider);

  addStepperCompleteListener(this);
  getStepIterator().addElementAddListener(this);
  getStepIterator().addElementRemoveListener(this);

  this.labelBar = new HorizontalLayout();
  this.labelBar.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
  this.labelBar.setWidth(100, Unit.PERCENTAGE);
  this.labelBar.addStyleName(STYLE_LABEL_BAR);
  this.labelBar.setMargin(false);
  this.labelBar.setSpacing(false);

  this.buttonBar = new HorizontalLayout();
  this.buttonBar.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
  this.buttonBar.addStyleName(STYLE_BUTTON_BAR);
  this.buttonBar.setWidth(100, Unit.PERCENTAGE);
  this.buttonBar.setMargin(false);
  this.buttonBar.setSpacing(true);

  this.stepContent = new Panel();
  this.stepContent.addStyleName(ValoTheme.PANEL_BORDERLESS);
  this.stepContent.addStyleName(STYLE_CONTENT_CONTAINER);
  this.stepContent.setSizeFull();

  this.dividerExpandRatio = DEFAULT_EXPAND_RATIO_DIVIDER;

  VerticalLayout rootLayout = new VerticalLayout();
  rootLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
  rootLayout.setSizeFull();
  rootLayout.setMargin(false);
  rootLayout.setSpacing(true);
  rootLayout.addComponent(labelBar);
  rootLayout.addComponent(stepContent);
  rootLayout.addComponent(buttonBar);
  rootLayout.setExpandRatio(stepContent, 1);

  setCompositionRoot(rootLayout);
  addStyleName(STYLE_ROOT_LAYOUT);
  setSizeFull();
  refreshLabelBar();
}
 
開發者ID:Juchar,項目名稱:md-stepper,代碼行數:52,代碼來源:HorizontalStepper.java


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