List of usage examples for com.vaadin.ui HorizontalSplitPanel setSplitPosition
public void setSplitPosition(float pos, Unit unit, boolean reverse)
From source file:org.jumpmind.metl.ui.views.ManageView.java
License:Open Source License
@SuppressWarnings("serial") @PostConstruct// w ww . ja v a2 s . c o m protected void init() { viewButton = new Button("View Log"); viewButton.setEnabled(false); viewButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { viewLog(table.getValue()); } }); VerticalLayout mainTab = new VerticalLayout(); mainTab.setSizeFull(); HorizontalLayout header = new HorizontalLayout(); header.addComponent(viewButton); header.setComponentAlignment(viewButton, Alignment.BOTTOM_RIGHT); statusSelect = new ComboBox("Status"); statusSelect.setNewItemsAllowed(false); statusSelect.setNullSelectionAllowed(false); statusSelect.addItem(ANY); statusSelect.setValue(ANY); for (ExecutionStatus status : ExecutionStatus.values()) { statusSelect.addItem(status.toString()); } ; statusSelect.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { refreshUI(getBackgroundData()); } }); header.addComponent(statusSelect); header.setComponentAlignment(statusSelect, Alignment.BOTTOM_RIGHT); HorizontalLayout limitLayout = new HorizontalLayout(); limitLayout.setSpacing(true); Label limitLabel = new Label("Limit:"); limitLayout.addComponent(limitLabel); limitLayout.setComponentAlignment(limitLabel, Alignment.MIDDLE_CENTER); TextField limitField = new TextField(null, String.valueOf(DEFAULT_LIMIT)); limitField.setWidth("5em"); limitField.setImmediate(true); limitField.setTextChangeEventMode(TextChangeEventMode.LAZY); limitField.setTextChangeTimeout(200); limitField.addTextChangeListener(new TextChangeListener() { public void textChange(TextChangeEvent event) { try { limit = Integer.parseInt(event.getText()); } catch (Exception e) { } refreshUI(getBackgroundData()); } }); limitLayout.addComponent(limitField); limitLayout.setComponentAlignment(limitField, Alignment.BOTTOM_RIGHT); header.addComponent(limitLayout); header.setComponentAlignment(limitLayout, Alignment.BOTTOM_RIGHT); header.setExpandRatio(limitLayout, 1.0f); TextField filterField = new TextField(); filterField.setInputPrompt("Filter"); filterField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); filterField.setIcon(FontAwesome.SEARCH); filterField.setImmediate(true); filterField.setTextChangeEventMode(TextChangeEventMode.LAZY); filterField.setTextChangeTimeout(200); filterField.addTextChangeListener(new TextChangeListener() { public void textChange(TextChangeEvent event) { executionContainer.removeAllContainerFilters(); if (!StringUtils.isBlank(event.getText())) { executionContainer.addContainerFilter(new MultiPropertyFilter(event.getText(), new String[] { "agentName", "hostName", "flowName", "status", "startTime", "endTime" })); } } }); header.addComponent(filterField); header.setComponentAlignment(filterField, Alignment.BOTTOM_RIGHT); header.setSpacing(true); header.setMargin(true); header.setWidth("100%"); mainTab.addComponent(header); table = new Table(); table.setContainerDataSource(executionContainer); table.setSelectable(true); table.setMultiSelect(false); table.setSizeFull(); table.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (event.isDoubleClick()) { viewLog(event.getItemId()); } } }); table.setVisibleColumns( new Object[] { "agentName", "deploymentName", "hostName", "status", "startTime", "endTime" }); table.setColumnHeaders(new String[] { "Agent", "Deployment", "Host", "Status", "Start", "End" }); table.setSortContainerPropertyId("startTime"); table.setSortAscending(false); table.addValueChangeListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { viewButton.setEnabled(table.getValue() != null); } }); mainTab.addComponent(table); mainTab.setExpandRatio(table, 1.0f); tabs = new TabbedPanel(); tabs.setMainTab("Executions", Icons.EXECUTION, mainTab); HorizontalSplitPanel split = new HorizontalSplitPanel(); split.setSizeFull(); split.setSplitPosition(AppConstants.DEFAULT_LEFT_SPLIT, Unit.PIXELS, false); manageNavigator = new ManageNavigator(FolderType.AGENT, context); manageNavigator.addValueChangeListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { refreshUI(getBackgroundData()); } }); split.setFirstComponent(manageNavigator); VerticalLayout container = new VerticalLayout(); container.setSizeFull(); container.addComponent(tabs); split.setSecondComponent(container); addComponent(split); setSizeFull(); context.getBackgroundRefresherService().register(this); }