Java Code Examples for com.vaadin.ui.HorizontalLayout.addComponent()

The following are Jave code examples for showing how to use addComponent() of the com.vaadin.ui.HorizontalLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: esup-ecandidat   File: CtrCandFormationView.java   Source Code and License Vote up 6 votes
/**
 * @param txtCode
 * @return une ligne de légende
 */
private HorizontalLayout getLegendLineLayout(String txtCode) {
	HorizontalLayout hlLineLegend = new HorizontalLayout();
	hlLineLegend.setWidth(100, Unit.PERCENTAGE);
	hlLineLegend.setSpacing(true);

	Image flagImg = new Image(null, new ThemeResource("images/icon/Flag-" + txtCode + "-icon.png"));
	Label label = new Label(applicationContext.getMessage("formation.table.flagEtat.tooltip." + txtCode, null,
			UI.getCurrent().getLocale()));
	hlLineLegend.addComponent(flagImg);
	hlLineLegend.setComponentAlignment(flagImg, Alignment.MIDDLE_LEFT);
	hlLineLegend.addComponent(label);
	hlLineLegend.setComponentAlignment(label, Alignment.MIDDLE_LEFT);
	hlLineLegend.setExpandRatio(label, 1);
	return hlLineLegend;
}
 
Example 2
Project: osc-core   File: ViewUtil.java   Source Code and License Vote up 6 votes
/**
 * @param toolbar
 *            HorizontalLayout which contains all the action Buttons
 * @param toolbarButton
 *            Which Tool bar button to create (Provided using ENUM constant)
 * @param listner
 *            Click listener called when this button is clicked
 * @return
 */

public static Button buildToolbarButton(HorizontalLayout toolbar, ToolbarButtons toolbarButton,
        ClickListener listner) {
    Button button = new Button(toolbarButton.getText());
    button.addStyleName(StyleConstants.BUTTON_TOOLBAR);
    button.setDescription(toolbarButton.getTooltip());
    button.setStyleName(ValoTheme.BUTTON_LINK);
    if (StringUtils.isNotEmpty(toolbarButton.getImageLocation())) {
        button.setIcon(new ThemeResource(toolbarButton.getImageLocation()), toolbarButton.toString());
    }
    button.setEnabled(false);
    button.setId(toolbarButton.getId());
    button.addClickListener(listner);
    toolbar.addComponent(button);
    return button;
}
 
Example 3
Project: osc-core   File: SummaryLayout.java   Source Code and License Vote up 6 votes
public SummaryLayout(ServerApi server, BackupServiceApi backupService,
        ArchiveApi archiver) {
    super();
    this.server = server;
    this.backupService = backupService;
    this.archiver = archiver;
    this.summarytable = createTable();
    // creating Server table
    this.summarytable.addItem(new Object[] { "DNS Name: ", getHostName() }, new Integer(1));
    this.summarytable.addItem(new Object[] { "IP Address: ", getIpAddress() }, new Integer(2));
    this.summarytable.addItem(new Object[] { "Version: ", getVersion() }, new Integer(3));
    this.summarytable.addItem(new Object[] { "Uptime: ", server.uptimeToString() }, new Integer(4));
    this.summarytable.addItem(new Object[] { "Current Server Time: ", new Date().toString() }, new Integer(5));

    VerticalLayout tableContainer = new VerticalLayout();
    tableContainer.addComponent(this.summarytable);
    addComponent(tableContainer);
    addComponent(createCheckBox());

    HorizontalLayout actionContainer = new HorizontalLayout();
    actionContainer.addComponent(createDownloadButton());
    addComponent(actionContainer);
}
 
Example 4
Project: Persephone   File: ApplicationOverviewPanel.java   Source Code and License Vote up 5 votes
private Layout buttonsLayout(Button... buttons) {
	HorizontalLayout layout = new HorizontalLayout();
	layout.setSizeFull();

	List<Component> components = new ArrayList<>(Arrays.asList(buttons));

	// Set HTML id for each button
	for(Component b : components) {
		b.setId(b.getCaption().replace(' ', '-')+"-btn");
	}

	// Split components into sublists of 5 elements
	int partitionSize = 5;
	List<List<Component>> partitions = new ArrayList<>();
	for (int i = 0; i < components.size(); i += partitionSize) {
		partitions.add(components.subList(i, Math.min(i + partitionSize, components.size())));
	}

	// Create vertical layouts for each list of buttons
	for(List<Component> sublist : partitions) {
		VerticalLayout vLayout = new VerticalLayout();
		vLayout.setMargin(false);

		sublist.stream().forEach(btn -> {
			btn.setSizeFull();
			vLayout.addComponent(btn);
		});

		layout.addComponent(vLayout);
	}

	return layout;
}
 
Example 5
Project: vaadin-016-helloworld-14   File: MainView.java   Source Code and License Vote up 5 votes
@Override
protected Component createComponent() {
  final CssLayout contentLayout = new CssLayout(new Label("Content"));
  contentLayout.setSizeFull();
  contentLayout.setId(cssLayoutID().apply(MainUI.class, "Content"));

  final VerticalLayout menuLayout = new VerticalLayout();
  menuLayout.setId(verticalLayoutID().apply(MainUI.class, "MenuLayout"));
  menuLayout.setStyleName(ValoTheme.MENU_ROOT);
  menuLayout.setWidth(100, Unit.PERCENTAGE);
  menuLayout.setHeight(100, Unit.PERCENTAGE);
  menuLayout.setSizeFull();

  // to hard bound
  menuLayout.addComponent(new MenuComponent(contentLayout));


  final HorizontalLayout mainLayout = new HorizontalLayout();
  mainLayout.setId(horizontalLayoutID().apply(MainUI.class, "MainLayout"));
  mainLayout.setSizeFull();
  mainLayout.addComponent(menuLayout);
  mainLayout.addComponent(contentLayout);

  mainLayout.setExpandRatio(menuLayout, 0.20f);
  mainLayout.setExpandRatio(contentLayout, 0.80f);

  return mainLayout;
}
 
Example 6
Project: javamagazin-009-microkernel   File: MainView.java   Source Code and License Vote up 5 votes
private HorizontalLayout mainLayout() {
  menuLayout = new VerticalLayout();
  menuLayout.setStyleName(ValoTheme.MENU_ROOT);
  menuLayout.setWidth(100, Unit.PERCENTAGE);
  menuLayout.setHeight(100, Unit.PERCENTAGE);
  menuLayout.setSizeFull();

  final CssLayout menuButtons = new CssLayout();
  menuButtons.setSizeFull();
  menuButtons.addStyleName(ValoTheme.MENU_PART);
  menuButtons.addStyleName(ValoTheme.MENU_PART_LARGE_ICONS);

  menuButtons.addComponents(
      createMenuButton(VaadinIcons.VIEWPORT, "Dashboard", DashboardComponent::new),
      createMenuButton(VaadinIcons.SITEMAP, "Sitemap", DashboardComponent::new),
      createMenuButton(VaadinIcons.CALC_BOOK, "Calculate", CalcComponent::new),
      createMenuButton(VaadinIcons.NOTEBOOK, "Write", WriteComponent::new),
      createMenuButtonForNotification(VaadinIcons.EXIT, "Logout", "You want to go?")
  );
  menuLayout.addComponent(menuButtons);

  contentLayout = new CssLayout(new Label("Content"));
  contentLayout.setSizeFull();

  final HorizontalLayout layout = new HorizontalLayout();
  layout.setSizeFull();
  layout.addComponent(menuLayout);
  layout.addComponent(contentLayout);

  layout.setExpandRatio(menuLayout, 0.20f);
  layout.setExpandRatio(contentLayout, 0.80f);

  return layout;
}
 
Example 7
Project: Persephone   File: PageHeader.java   Source Code and License Vote up 5 votes
private HorizontalLayout getButtons(Component... components) {
	Button backButton = new Button("Go Back", VaadinIcons.BACKSPACE_A);
	backButton.setId("back-btn");
	backButton.addClickListener(e -> getUI().getNavigator().navigateTo(PersephoneViews.APPLICATIONS));

	HorizontalLayout layout = new HorizontalLayout();
	layout.addComponent(backButton);
	layout.addComponents(components);
	return layout;
}
 
Example 8
Project: spring-boot-vaadin-rabbitmq-pipeline-demo   File: StreamView.java   Source Code and License Vote up 5 votes
private void addDataGrid() {

		grid = streamDataGrid.get();
		grid.setWidth("100%");
		
		HorizontalLayout bottomLayout = new HorizontalLayout();
		bottomLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
		bottomLayout.addComponent(grid);
		bottomLayout.setWidth("100%");

		addComponent(bottomLayout);
	}
 
Example 9
Project: esup-ecandidat   File: I18nField.java   Source Code and License Vote up 5 votes
/** Renvoie un layout contenant un choix de langue et une traduction
 * @param traductionOther
 * @return le layout
 */
private HorizontalLayout getLangueLayout(I18nTraduction traductionOther){
	/*Le layout renvoyé*/
	HorizontalLayout hlLangueOther = new HorizontalLayout();
	listLayoutTraductions.add(hlLangueOther);
	hlLangueOther.setSpacing(true);
	hlLangueOther.setWidth(100, Unit.PERCENTAGE);
	
	/*La combobox avec les icones de drapeaux*/
	ComboBoxLangue cbLangue = new ComboBoxLangue(listeLangueEnService,false);
	cbLangue.selectLangue((traductionOther==null?null:traductionOther.getLangue()));
	cbLangue.setWidth(75, Unit.PIXELS);
	hlLangueOther.addComponent(cbLangue);
	
	/*Le textField... ou */
	AbstractField<String> tfValOther = getNewValueComponent();		
	tfValOther.setWidth(100, Unit.PERCENTAGE);
	if (traductionOther!=null){
		tfValOther.setValue(traductionOther.getValTrad());
	}		
	hlLangueOther.addComponent(tfValOther);
	hlLangueOther.setExpandRatio(tfValOther,1);
	
	/*Le bouton de suppression de la langue*/
	OneClickButton removeLangue = new OneClickButton(FontAwesome.MINUS_SQUARE_O);
	removeLangue.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
	removeLangue.addStyleName(ValoTheme.BUTTON_BORDERLESS);
	removeLangue.addClickListener(e->{layoutLangue.removeComponent(hlLangueOther);listLayoutTraductions.remove(hlLangueOther);checkVisibleAddLangue();centerWindow();});
	hlLangueOther.addComponent(removeLangue);
	return hlLangueOther;
}
 
Example 10
Project: osc-core   File: ViewUtil.java   Source Code and License Vote up 5 votes
/**
 * @param caption
 *            Caption Text Representing Header
 * @param guid
 *            Help GUID for caller view
 * @return
 *         Horizontal Layout containing Caption text and Help button
 */
public static HorizontalLayout createSubHeader(String caption, String guid) {

    HorizontalLayout subHeader = new HorizontalLayout();
    subHeader.setWidth("100%");
    subHeader.setHeight("35px");
    subHeader.setSpacing(true);
    subHeader.addStyleName("toolbar");
    final Label title = new Label(caption);
    title.setSizeUndefined();
    subHeader.addComponent(title);
    subHeader.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
    subHeader.setExpandRatio(title, 1);

    // create help button if we have some GUID else do not add this button
    if (guid != null) {

        Button helpButton = new Button();
        helpButton.setImmediate(true);
        helpButton.setStyleName(Reindeer.BUTTON_LINK);
        helpButton.setDescription("Help");
        helpButton.setIcon(new ThemeResource("img/Help.png"));
        subHeader.addComponent(helpButton);
        helpButton.addClickListener(new HelpButtonListener(guid));
    }

    return subHeader;
}
 
Example 11
Project: esup-ecandidat   File: AdminLangueWindow.java   Source Code and License Vote up 4 votes
/**
 * Crée une fenêtre d'édition de langue
 * @param langue la langue à éditer
 */
public AdminLangueWindow(Langue langue) {
	/* Style */
	setModal(true);
	setWidth(350,Unit.PIXELS);
	setResizable(false);
	setClosable(false);

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

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

	/* Formulaire */
	fieldGroup = new CustomBeanFieldGroup<>(Langue.class);
	fieldGroup.setItemDataSource(langue);
	FormLayout formLayout = new FormLayout();
	formLayout.setSpacing(true);
	formLayout.setSizeUndefined();
	for (String fieldName : LANGUE_FIELDS_ORDER) {
		formLayout.addComponent(fieldGroup.buildAndBind(applicationContext.getMessage("langue.table." + fieldName, null, UI.getCurrent().getLocale()), fieldName));
	}

	fieldGroup.getField(Langue_.codLangue.getName()).setReadOnly(true);
	fieldGroup.getField(Langue_.libLangue.getName()).setReadOnly(true);
	if (langue.getCodLangue().equals(NomenclatureUtils.LANGUE_FR)){
		fieldGroup.getField(Langue_.tesLangue.getName()).setEnabled(false);
	}

	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 langue saisie */
			langueController.saveLangue(langue);
			/* Ferme la fenêtre */
			close();
		} catch (CommitException ce) {
		}
	});
	buttonsLayout.addComponent(btnEnregistrer);
	buttonsLayout.setComponentAlignment(btnEnregistrer, Alignment.MIDDLE_RIGHT);

	/* Centre la fenêtre */
	center();
}
 
Example 12
Project: esup-ecandidat   File: ScolGestCandidatWindow.java   Source Code and License Vote up 4 votes
/**
 * Crée une fenêtre d'édition de date d'alerte SVA
 * @param parametre le parametre à éditer
 */
public ScolGestCandidatWindow(Parametre parametre, String title) {
	/* Style */
	setModal(true);
	setWidth(600,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(title);

	/* Formulaire */
	fieldGroup = new CustomBeanFieldGroup<>(Parametre.class);
	fieldGroup.setItemDataSource(parametre);
	FormLayout formLayout = new FormLayout();
	formLayout.setWidth(100, Unit.PERCENTAGE);
	formLayout.setSpacing(true);
	
	ComboBoxPresentation field = fieldGroup.buildAndBind(applicationContext.getMessage("droitprofilind.gestCandidat.title", null, UI.getCurrent().getLocale()), 
			Parametre_.valParam.getName(), ComboBoxPresentation.class);
	field.setListe(parametreController.getListeGestionnaireCandidat());
	field.setWidth(100, Unit.PERCENTAGE);			
	formLayout.addComponent(field);

	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 alertSva saisie */
			changeGestCandidatWindowListener.btnOkClick(parametre);
			/* Ferme la fenêtre */
			close();
		} catch (CommitException ce) {
		}
	});
	buttonsLayout.addComponent(btnEnregistrer);
	buttonsLayout.setComponentAlignment(btnEnregistrer, Alignment.MIDDLE_RIGHT);

	/* Centre la fenêtre */
	center();
}
 
Example 13
Project: spring-boot-vaadin-rabbitmq-pipeline-demo   File: StreamView.java   Source Code and License Vote up 4 votes
private void addHeaderAndButtons() {
	HorizontalLayout topLayout = new HorizontalLayout();
	topLayout.setWidth("80%");

	Label header = new Label("Streaming Console");
	header.addStyleName(ValoTheme.LABEL_H2);

	Button showButton = new Button("");
	showButton.setCaption("Stream");
	showButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
	// showButton.setIcon(VaadinIcons.PLUS_CIRCLE);
	showButton.addClickListener(click -> {
		System.out.println("[x] Show button clicked ...");
		// Start the data feed thread
		new FeederThread().start();	
	});

	Button sendButton = new Button("");
	sendButton.setCaption("Send");
	sendButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
	sendButton.setIcon(VaadinIcons.PLUS);
	sendButton.addClickListener(click -> {
		
		Runnable r = new Runnable() {
			@Override
			public void run() {
				System.out.println("[x] Send button clicked ...");
				sender.stream();
			}
		};

		new Thread(r).start();
	});

	topLayout.addComponent(header);
	topLayout.setComponentAlignment(header, Alignment.BOTTOM_CENTER);
	topLayout.addComponent(showButton);
	topLayout.setComponentAlignment(showButton, Alignment.MIDDLE_CENTER);
	topLayout.addComponent(sendButton);
	topLayout.setComponentAlignment(sendButton, Alignment.MIDDLE_CENTER);

	addComponent(topLayout);
}
 
Example 14
Project: esup-ecandidat   File: SearchCtrCandWindow.java   Source Code and License Vote up 4 votes
/**
 * 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();
}
 
Example 15
Project: esup-ecandidat   File: ScolAlertSvaParametreWindow.java   Source Code and License Vote up 4 votes
/** Crée une fenêtre d'édition de date d'alerte SVA
 * @param parametreDate
 * @param parametreDefinitif
 */
public ScolAlertSvaParametreWindow(Parametre parametreDate, Parametre parametreDefinitif) {
	/* Style */
	setModal(true);
	setWidth(600,Unit.PIXELS);
	setResizable(true);
	setClosable(true);
	
	ParametreSvaPresentation parametre = new ParametreSvaPresentation(parametreDate.getValParam(),parametreDefinitif.getValParam());

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

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

	/* Formulaire */
	fieldGroup = new CustomBeanFieldGroup<>(ParametreSvaPresentation.class);
	fieldGroup.setItemDataSource(parametre);
	FormLayout formLayout = new FormLayout();
	formLayout.setWidth(100, Unit.PERCENTAGE);
	formLayout.setSpacing(true);
	
	ComboBoxPresentation field = fieldGroup.buildAndBind(applicationContext.getMessage("alertSva.date.title", null, UI.getCurrent().getLocale()), 
			ParametreSvaPresentation.CHAMPS_DATE, ComboBoxPresentation.class);
	field.setListe(alertSvaController.getListeDateSVA());
	field.setWidth(100, Unit.PERCENTAGE);
	formLayout.addComponent(field);
	
	RequiredStringCheckBox fieldDefinitif = fieldGroup.buildAndBind(applicationContext.getMessage("alertSva.definitif.title", null, UI.getCurrent().getLocale()), 
			ParametreSvaPresentation.CHAMPS_DEFINITF, RequiredStringCheckBox.class);
	fieldDefinitif.setWidth(100, Unit.PERCENTAGE);
	formLayout.addComponent(fieldDefinitif);

	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 alertSva saisie */
			changeAlertSVAWindowListener.btnOkClick(parametre);
			/* Ferme la fenêtre */
			close();
		} catch (CommitException ce) {
		}
	});
	buttonsLayout.addComponent(btnEnregistrer);
	buttonsLayout.setComponentAlignment(btnEnregistrer, Alignment.MIDDLE_RIGHT);

	/* Centre la fenêtre */
	center();
}
 
Example 16
Project: esup-ecandidat   File: CandidatAdresseWindow.java   Source Code and License Vote up 4 votes
/**
 * 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();
}
 
Example 17
Project: osc-core   File: PageInformationComponent.java   Source Code and License Vote up 4 votes
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;
}
 
Example 18
Project: esup-ecandidat   File: AdminBatchImmediatWindow.java   Source Code and License Vote up 4 votes
/**
 * 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();
}
 
Example 19
Project: esup-ecandidat   File: CtrCandPostItAddWindow.java   Source Code and License Vote up 4 votes
/**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();
}
 
Example 20
Project: esup-ecandidat   File: CtrCandOdfCandidatureWindow.java   Source Code and License Vote up 4 votes
/**
 * Crée une fenêtre de choix pour le gestionnaire : proposition ou candidature simple
 * @param message
 */
public CtrCandOdfCandidatureWindow(String message) {
	/* Style */
	setWidth(630, Unit.PIXELS);
	setModal(true);
	setResizable(false);
	setClosable(false);

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

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

	/* Texte */
	layout.addComponent(new Label(message));
	layout.addComponent(new Label(applicationContext.getMessage("candidature.gest.window.choice", null, UI.getCurrent().getLocale())));
	
	/*Le container d'options*/
	BeanItemContainer<SimpleTablePresentation> optContainer = new BeanItemContainer<SimpleTablePresentation>(SimpleTablePresentation.class);
	SimpleTablePresentation optionClassique = new SimpleTablePresentation(ConstanteUtils.OPTION_CLASSIQUE,applicationContext.getMessage("candidature.gest.window.choice.classique", null, UI.getCurrent().getLocale()),null);
	SimpleTablePresentation optionProposition = new SimpleTablePresentation(ConstanteUtils.OPTION_PROP,applicationContext.getMessage("candidature.gest.window.choice.proposition", null, UI.getCurrent().getLocale()),null);
	optContainer.addItem(optionClassique);
	optContainer.addItem(optionProposition);
	
	optionGroupAction.setContainerDataSource(optContainer);
	optionGroupAction.addStyleName(StyleConstants.OPTION_GROUP_HORIZONTAL);
	optionGroupAction.setItemCaptionPropertyId(SimpleTablePresentation.CHAMPS_TITLE);
	optionGroupAction.setItemCaptionMode(ItemCaptionMode.PROPERTY);
	optionGroupAction.setValue(optionClassique);
	
	layout.addComponent(optionGroupAction);
	layout.setComponentAlignment(optionGroupAction, Alignment.MIDDLE_CENTER);
	

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

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

	OneClickButton btnOui = new OneClickButton(applicationContext.getMessage("confirmWindow.btnOui", null, UI.getCurrent().getLocale()),FontAwesome.CHECK);
	btnOui.setIcon(FontAwesome.CHECK);
	btnOui.addStyleName(ValoTheme.BUTTON_PRIMARY);
	btnOui.addClickListener(e -> {
		SimpleTablePresentation option = (SimpleTablePresentation)optionGroupAction.getValue();
		odfCandidatureListener.btnOkClick(option.getCode());
		close();
	});
	buttonsLayout.addComponent(btnOui);
	buttonsLayout.setComponentAlignment(btnOui, Alignment.MIDDLE_RIGHT);

	/* Centre la fenêtre */
	center();
}