List of usage examples for com.vaadin.ui TabSheet addTab
public Tab addTab(Component component, int position)
From source file:ru.codeinside.adm.ui.GroupTab.java
License:Mozilla Public License
private void showGroupTab(TabSheet t, final String typeGroup) { VerticalLayout l = new VerticalLayout(); l.setSizeFull();// w ww. ja va 2 s.com TableGroup tableGroup = new TableGroup(typeGroup); ButtonCreateGroup buttonCreateGroup = new ButtonCreateGroup(typeGroup, tableGroup); l.addComponent(buttonCreateGroup); l.addComponent(tableGroup); l.setExpandRatio(buttonCreateGroup, 0.1f); l.setExpandRatio(tableGroup, 100f); t.addTab(l, typeGroup); }
From source file:ru.codeinside.gses.webui.declarant.DeclarantFactory.java
License:Mozilla Public License
public static Component create() { // TODO: ?? ??! final ServiceQueryDefinition amSQ = new ServiceQueryDefinition(ProcedureType.Administrative); final LazyQueryContainer amSC = new LazyQueryContainer(amSQ, new ServiceQueryFactory(false)); final ProcedureQueryDefinition amPQ = new ProcedureQueryDefinition(ProcedureType.Administrative); final LazyQueryContainer amPC = new LazyQueryContainer(amPQ, new ProcedureQueryFactory(Flash.login(), false)); final ProcedureQueryDefinition mmQ = new ProcedureQueryDefinition(ProcedureType.Interdepartmental); final LazyQueryContainer mmC = new LazyQueryContainer(mmQ, new ProcedureQueryFactory(Flash.login(), false)); final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull();/*from w w w .j a v a 2s . co m*/ layout.setMargin(true); final Label header = new Label( " ? ?? ?? ?"); header.addStyleName("h1"); layout.addComponent(header); final Select amS = new Select("", amPC); String selectWidth = "400px"; amS.setWidth(selectWidth); amS.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY); amS.setItemCaptionPropertyId("name"); amS.setFilteringMode(AbstractSelect.Filtering.FILTERINGMODE_CONTAINS); amS.setNullSelectionAllowed(true); amS.setNewItemsAllowed(false); amS.setImmediate(true); final Select amSS = new Select("?", amSC); amSS.setWidth(selectWidth); amSS.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY); amSS.setItemCaptionPropertyId("name"); amSS.setFilteringMode(AbstractSelect.Filtering.FILTERINGMODE_CONTAINS); amSS.setNullSelectionAllowed(true); amSS.setNewItemsAllowed(false); amSS.setImmediate(true); final FormLayout amLayout = new FormLayout(); final Panel amPanel = new Panel(); amLayout.addComponent(amSS); amLayout.addComponent(amS); amPanel.addComponent(amLayout); final Select mmS = new Select("", mmC); mmS.setFilteringMode(Select.FILTERINGMODE_OFF); mmS.setWidth(selectWidth); mmS.setItemCaptionPropertyId("name"); mmS.setFilteringMode(AbstractSelect.Filtering.FILTERINGMODE_CONTAINS); mmS.setNullSelectionAllowed(true); mmS.setNewItemsAllowed(false); mmS.setImmediate(true); final FormLayout mmLayout = new FormLayout(); final Panel mmPanel = new Panel(); // mmLayout.addComponent(mmSS); mmLayout.addComponent(mmS); mmPanel.addComponent(mmLayout); final VerticalLayout amWrapper = new VerticalLayout(); amWrapper.setSizeFull(); amWrapper.addComponent(amPanel); final VerticalLayout imWrapper = new VerticalLayout(); imWrapper.setSizeFull(); imWrapper.addComponent(mmPanel); final TabSheet typeSheet = new TabSheet(); typeSheet.setSizeFull(); typeSheet.addTab(amWrapper, "?? "); typeSheet.addTab(imWrapper, "? "); layout.addComponent(typeSheet); layout.setExpandRatio(typeSheet, 1); // amSS.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { final Property prop = event.getProperty(); if (prop.getValue() == null) { amPQ.serviceId = -1; } else { amPQ.serviceId = (Long) amSC.getItem(prop.getValue()).getItemProperty("id").getValue(); } amS.select(null); amPC.refresh(); } }); final ProcedureSelectListener administrativeProcedureSelectListener = new ProcedureSelectListener() { private static final long serialVersionUID = 1L; @Override public void selectProcedure(long id) { if (amWrapper.getComponentCount() > 1) { amWrapper.removeComponent(amWrapper.getComponent(1)); } if (id > 0) { final Component cmp = createStartEventForm(id, this, layout); if (cmp != null) { amWrapper.addComponent(cmp); amWrapper.setExpandRatio(cmp, 1f); } else { amS.select(null); amPC.refresh(); amSC.refresh(); } } } }; final ProcedureSelectListener interdepartamentalProcedureSelectListener = new ProcedureSelectListener() { private static final long serialVersionUID = 1L; @Override public void selectProcedure(long id) { if (imWrapper.getComponentCount() > 1) { imWrapper.removeComponent(imWrapper.getComponent(1)); } if (id > 0) { final Component cmp = createStartEventForm(id, this, layout); if (cmp != null) { imWrapper.addComponent(cmp); imWrapper.setExpandRatio(cmp, 1f); } } } }; amS.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { final Object itemId = event.getProperty().getValue(); final long procedureId = itemId == null ? -1 : (Long) amPC.getItem(itemId).getItemProperty("id").getValue(); administrativeProcedureSelectListener.selectProcedure(procedureId); } }); mmS.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { final Object itemId = event.getProperty().getValue(); final long procedureId = itemId == null ? -1 : (Long) mmC.getItem(itemId).getItemProperty("id").getValue(); interdepartamentalProcedureSelectListener.selectProcedure(procedureId); } }); return layout; }
From source file:ru.codeinside.gses.webui.executor.ExecutorFactory.java
License:Mozilla Public License
static private void showForm(final TabSheet tabs, final String taskId) { // ? //from w ww. j a v a 2 s .c o m for (int i = tabs.getComponentCount(); i > 0; i--) { final Tab tab = tabs.getTab(i - 1); if (tab.getComponent() instanceof WithTaskId) { if (taskId.equals(((WithTaskId) tab.getComponent()).getTaskId())) { tabs.setSelectedTab(tab); return; } } } DataAccumulator accumulator = new DataAccumulator(); ExecutorService executorService = Flash.flash().getExecutorService(); final FormDescription formDescription = Functions .withEngine(new FormDescriptionBuilder(FormID.byTaskId(taskId), executorService, accumulator)); final TaskForm taskForm = new TaskForm(formDescription, new TaskForm.CloseListener() { private static final long serialVersionUID = 3726145663843346543L; @Override public void onFormClose(final TaskForm form) { final TabSheet.Tab tab = tabs.getTab(tabs.getSelectedTab()); int pos = tabs.getTabPosition(tab); tabs.removeTab(tab); int count = tabs.getComponentCount(); tabs.setSelectedTab(count == pos ? pos - 1 : pos); } }, accumulator); final Tab tab = tabs.addTab(taskForm, formDescription.task.getName()); tab.setDescription("? \"" + formDescription.processDefinition.getName() + "\""); tabs.setSelectedTab(tab); }
From source file:ru.codeinside.gses.webui.MemoryUsage.java
License:Mozilla Public License
public MemoryUsage(TabSheet tabs) { this.tabs = tabs; sizeErr = new TextArea(); sizeErr.setStyleName("debug-panel"); sizeErr.setSizeFull();/*from w w w . j a v a 2 s . c o m*/ sizeErr.setReadOnly(true); setCompositionRoot(sizeErr); setSizeFull(); Flash.router().addListener(SizeEvent.class, this, "onSizeEvent"); tabs.addTab(this, "?").setDescription("? ?"); }
From source file:ru.codeinside.gses.webui.Workplace.java
License:Mozilla Public License
public Workplace(String login, Set<Role> roles, boolean production) { TabSheet tabSheet = new TabSheet(); tabSheet.setSizeFull();/*ww w . j av a2s .c o m*/ tabSheet.setStyleName(Reindeer.TABSHEET_BORDERLESS); tabSheet.setCloseHandler(new DelegateCloseHandler()); if (!production) { new MemoryUsage(tabSheet); } UserInfoPanel.addClosableToTabSheet(tabSheet, login); if (roles.contains(Role.Executor)) { TabChanger archiveChanger = new TabChanger(tabSheet); archiveChanger.set(ArchiveFactory.create(), "?"); TabChanger executorChanger = new TabChanger(tabSheet); executorChanger.set(ExecutorFactory.create(executorChanger, tabSheet), "?"); } if (roles.contains(Role.Declarant)) { new TabChanger(tabSheet).set(DeclarantFactory.create(), " ?"); } if (roles.contains(Role.Supervisor) || roles.contains(Role.SuperSupervisor)) { new TabChanger(tabSheet).set(new SupervisorWorkplace(), " ??"); } if (roles.contains(Role.SuperSupervisor)) { new TabChanger(tabSheet).set(new TaskManager(), "?? ??"); } if (roles.contains(Role.Manager)) { new TabChanger(tabSheet).set(new ManagerWorkplace(), " "); } if (roles.contains(Role.Executor) || roles.contains(Role.Declarant) || roles.contains(Role.Supervisor) || roles.contains(Role.SuperSupervisor)) { SmevTasksPanel smevTasksPanel = new SmevTasksPanel(); tabSheet.addTab(smevTasksPanel, " "); tabSheet.addListener(smevTasksPanel); } setCompositionRoot(tabSheet); setSizeFull(); }