/** * @param container * @param size * @return une table pour formatter les données */ private TableFormating getTable(BeanItemContainer<SimpleTablePresentation> container, Integer size){ TableFormating table = new TableFormating(null, container); table.addBooleanColumn(SimpleTablePresentation.CHAMPS_VALUE,false); table.setVisibleColumns((Object[]) FIELDS_ORDER); table.setColumnCollapsingAllowed(false); table.setColumnReorderingAllowed(false); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); table.setSelectable(false); table.setImmediate(true); table.setPageLength(size); table.setWidth(100, Unit.PERCENTAGE); table.setColumnWidth(SimpleTablePresentation.CHAMPS_TITLE, 300); table.setCellStyleGenerator((components, itemId, columnId)->{ if (columnId!=null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)){ return (ValoTheme.LABEL_BOLD); } return null; }); return table; }
/** * Set whether the listing column headers are visible. * @param headersVisible whether the listing column headers are visible */ public void setHeadersVisible(boolean headersVisible) { switch (getRenderingMode()) { case GRID: getGrid().setHeaderVisible(headersVisible); break; case TABLE: getTable().setColumnHeaderMode( headersVisible ? ColumnHeaderMode.EXPLICIT_DEFAULTS_ID : ColumnHeaderMode.HIDDEN); break; default: break; } }
/** * Initialise la vue */ @PostConstruct public void init() { super.init(); setNavigationButton(CandidatAdresseView.NAME, (parametreController.getIsGetCursusInterne()?CandidatCursusInterneView.NAME:CandidatCursusExterneView.NAME)); /*Edition des donneés*/ OneClickButton btnEdit = new OneClickButton(applicationContext.getMessage("btnSaisir", null, UI.getCurrent().getLocale()), FontAwesome.PENCIL); btnEdit.addClickListener(e -> { candidatParcoursController.editBac(candidat, this); }); addGenericButton(btnEdit, Alignment.MIDDLE_LEFT); noInfoLabel = new Label(applicationContext.getMessage("infobac.noinfo", null, UI.getCurrent().getLocale())); addGenericComponent(noInfoLabel); /*Table de présentation*/ table.setSizeFull(); table.setVisibleColumns((Object[]) FIELDS_ORDER_BAC); table.setColumnCollapsingAllowed(false); table.setColumnReorderingAllowed(false); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); table.setSelectable(false); table.setImmediate(true); table.setColumnWidth(SimpleTablePresentation.CHAMPS_TITLE, 250); table.setCellStyleGenerator((components, itemId, columnId)->{ if (columnId!=null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)){ return (ValoTheme.LABEL_BOLD); } return null; }); addGenericComponent(table); setGenericExpandRatio(table); }
/** * Initialise la vue */ @PostConstruct public void init() { super.init(); setNavigationButton(CandidatInfoPersoView.NAME, CandidatBacView.NAME); /*Edition des donneés d'adresse*/ OneClickButton btnEdit = new OneClickButton(FontAwesome.PENCIL); btnEdit.setCaption(applicationContext.getMessage("adresse.edit.btn", null, UI.getCurrent().getLocale())); btnEdit.addClickListener(e -> { candidatController.editAdresse(cptMin, this); }); addGenericButton(btnEdit, Alignment.MIDDLE_LEFT); noInfoLabel.setValue(applicationContext.getMessage("adresse.noinfo", null, UI.getCurrent().getLocale())); addGenericComponent(noInfoLabel); /*L'adresse*/ table.setSizeFull(); table.setVisibleColumns((Object[]) FIELDS_ORDER); table.setColumnCollapsingAllowed(false); table.setColumnReorderingAllowed(false); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); table.setSelectable(false); table.setImmediate(true); table.setColumnWidth(SimpleTablePresentation.CHAMPS_TITLE, 250); table.setCellStyleGenerator((components, itemId, columnId)->{ if (columnId!=null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)){ return (ValoTheme.LABEL_BOLD); } return null; }); addGenericComponent(table); setGenericExpandRatio(table); }
public ObjectTypeSelectionPopup(String title, final Map<String, Class<?>> typeList, final ObjectTypeSelectionCallback callback) { super(title); VerticalLayout layout = new VerticalLayout(); // generate table with type list final Table table = new Table(); table.setSizeFull(); table.setSelectable(true); table.setColumnReorderingAllowed(true); table.addContainerProperty(UIConstants.PROP_NAME, String.class, null); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); table.setPageLength(10); table.setMultiSelect(false); final Map<Object, Class<?>> idTypeMap = new HashMap<Object, Class<?>>(); for (Entry<String, Class<?>> item: typeList.entrySet()) { Object id = table.addItem(new Object[] {item.getKey()}, null); idTypeMap.put(id, item.getValue()); } layout.addComponent(table); // add OK button Button okButton = new Button("OK"); okButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { Object selectedItemId = table.getValue(); if (selectedItemId != null) { Class<?> clazz = idTypeMap.get(selectedItemId); if (clazz != null) callback.typeSelected(clazz); } close(); } }); layout.addComponent(okButton); layout.setComponentAlignment(okButton, Alignment.MIDDLE_CENTER); setContent(layout); center(); }
@PostConstruct protected void init() { setSizeFull(); tabbedPanel = new TabbedPanel(); HorizontalSplitPanel leftSplit = new HorizontalSplitPanel(); leftSplit.setSizeFull(); leftSplit.setSplitPosition(UIConstants.DEFAULT_LEFT_SPLIT, Unit.PIXELS); VerticalLayout container = new VerticalLayout(); container.setSizeFull(); container.addComponent(tabbedPanel); leftSplit.setSecondComponent(container); table = new TreeTable(); table.addStyleName(ValoTheme.TREETABLE_NO_HORIZONTAL_LINES); table.addStyleName(ValoTheme.TREETABLE_NO_STRIPES); table.addStyleName(ValoTheme.TREETABLE_NO_VERTICAL_LINES); table.addStyleName(ValoTheme.TREETABLE_BORDERLESS); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); table.setSizeFull(); table.setCacheRate(100); table.setPageLength(100); table.setImmediate(true); table.setSelectable(true); table.addItemClickListener(this); table.addStyleName("noselect"); table.addContainerProperty("id", String.class, null); table.setVisibleColumns(new Object[] { "id" }); table.setColumnExpandRatio("id", 1); addItem("Users", Icons.USER); addItem("Groups", Icons.GROUP); addItem("REST", Icons.REST); addItem("General Settings", Icons.SETTINGS); addItem("Plugin Repositories", Icons.DATABASE); addItem("Plugins", Icons.COMPONENT); addItem("Mail Server", Icons.EMAIL); addItem("Notifications", Icons.NOTIFICATION); addItem("Active Users", FontAwesome.USERS); addItem("Audit Events", FontAwesome.BARS); addItem("Logging", Icons.LOGGING); addItem("About", FontAwesome.QUESTION); VerticalLayout navigator = new VerticalLayout(); navigator.addStyleName(ValoTheme.MENU_ROOT); navigator.setSizeFull(); leftSplit.setFirstComponent(navigator); MenuBar leftMenuBar = new MenuBar(); leftMenuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS); leftMenuBar.setWidth(100, Unit.PERCENTAGE); navigator.addComponent(leftMenuBar); navigator.addComponent(table); navigator.setExpandRatio(table, 1); addComponent(leftSplit); }