List of usage examples for com.vaadin.ui NativeSelect NativeSelect
public NativeSelect()
From source file:ch.bfh.ti.soed.hs16.srs.purple.view.ReservationView.java
License:Open Source License
/** * Function initalizes the reservation view *///from www .j a va 2 s .c o m @SuppressWarnings("serial") @Override public void initView() { siteTitle.addStyleName("h2"); GregorianCalendar start = new GregorianCalendar(); GregorianCalendar end = new GregorianCalendar(); end.add(GregorianCalendar.DAY_OF_YEAR, 40); cal.setSizeFull(); cal.setStartDate(start.getTime()); cal.setEndDate(end.getTime()); cal.setVisible(true); // Handler opens a new reservation pop-up cal.setHandler(new RangeSelectHandler() { @Override public void rangeSelect(RangeSelectEvent event) { Timestamp start = new Timestamp(event.getStart().getTime()); Timestamp ende = new Timestamp(event.getEnd().getTime()); if (start.compareTo(ende) == 0) ende.setTime(ende.getTime() + 3600 * 1000); //if start and end are the same, add 1 hour to the end showPopup(new Reservation(-1, start, ende, null, "", "")); } }); /** * DateClickHandler * switches between daily and monthly view */ cal.setHandler(new DateClickHandler() { @Override public void dateClick(DateClickEvent event) { if (cal.getEndDate().getTime() - cal.getStartDate().getTime() == 0) { cal.setStartDate(start.getTime()); cal.setEndDate(end.getTime()); } else { cal.setStartDate(event.getDate()); cal.setEndDate(event.getDate()); } } }); clButton = new ClickListener() { @SuppressWarnings("unchecked") @Override public void buttonClick(ClickEvent event) { if (event.getButton() == saveButton) //God save the queen { if (title.isReadOnly()) { setEditable(true); return; } //Validating checks if (title.getValue().length() < 3) title.setStyleName("errorTextField"); if (rooms.getValue() == null) return; Timestamp startTime = new Timestamp(startDate.getValue().getTime()); Timestamp endTime = new Timestamp(endDate.getValue().getTime()); List<User> hosts = new ArrayList<User>(); //Hosts auslesen Set<Integer> temp = (Set<Integer>) ReservationView.this.hosts.getValue(); for (int id : temp) for (int y = 0; y < hostList.size(); y++) if (hostList.get(y).getUserID() == id) hosts.add(hostList.get(y)); if (hosts.size() == 0) //Wenn kein User als Host ist, wird der aktuelle User als Host genommen hosts.add(actualUser); List<User> participants = new ArrayList<User>(); //Teilnehmer auslesen Set<Integer> temp2 = (Set<Integer>) ReservationView.this.participantList.getValue(); for (int id : temp2) for (int y = 0; y < hostList.size(); y++) if (hostList.get(y).getUserID() == id && !isHost(hostList.get(y), hosts)) //Teilnehmer nur speichern, wenn er nicht bereits Host ist participants.add(hostList.get(y)); System.out.println(hosts.get(0).getUsername()); if (res.getReservationID() > 0) //Edit { Reservation newRes = new Reservation(res.getReservationID(), startTime, endTime, resCont.getRoom((int) rooms.getValue()), title.getValue(), description.getValue(), hosts, participants); resCont.updateReservation(newRes); popUpWindow.close(); calendarUpdate(); } else //Neu { if (resCont.addReservation( new Reservation(-1, startTime, endTime, resCont.getRoom((int) rooms.getValue()), title.getValue(), description.getValue(), hosts, participants))) { popUpWindow.close(); calendarUpdate(); } } } if (event.getButton() == deleteButton) //Move the reservation into the trash { //Confirm ConfirmDialog.show(UI.getCurrent(), "Lschen besttigen", "Die Reservation wirklich lschen?", "Ja", "Abbrechen", new ConfirmDialog.Listener() { @Override public void onClose(ConfirmDialog arg0) { if (arg0.isConfirmed()) { resCont.deleteReservation(res.getReservationID()); cal.removeEvent(res); res = null; popUpWindow.close(); } } }); } if (event.getButton() == acceptButton) //Accept reservation as participant { if (resCont.acceptReservation(actualUser, res)) popUpWindow.close(); } if (event.getButton() == rejectButton) //reject reservation as participant { if (resCont.cancelReservation(actualUser, res)) popUpWindow.close(); } } }; cal.setHandler(new EventClickHandler() { @Override public void eventClick(EventClick event) { //show the reservation details if clicked on it Reservation e = (Reservation) event.getCalendarEvent(); showPopup(e); } }); ValueChangeListener vcl = new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (viewSelect.getValue() == null) return; int val = (int) viewSelect.getValue(); if (val != 0) actualView = val; calendarUpdate(); } }; viewSelect = new NativeSelect(); viewSelect.addItem(-1); viewSelect.setItemCaption(-1, "bersicht"); viewSelect.addItem(-2); viewSelect.setItemCaption(-2, "Eigene Reservationen"); viewSelect.select(-1); viewSelect.addValueChangeListener(vcl); viewSelect.addItem(0); viewSelect.setItemCaption(0, "--- Rume ---"); for (int i = 0; i < roomList.size(); i++) { viewSelect.addItem(roomList.get(i).getRoomID()); viewSelect.setItemCaption(roomList.get(i).getRoomID(), roomList.get(i).getName() + "(" + roomList.get(i).getNumberOfSeats() + " Pltze)"); } layout.addComponent(siteTitle, 0, 0); layout.addComponent(cal, 0, 1, 1, 1); layout.addComponent(viewSelect, 1, 0); layout.setComponentAlignment(viewSelect, Alignment.MIDDLE_RIGHT); layout.setRowExpandRatio(0, 0.1f); layout.setRowExpandRatio(1, 20); //layout.setMargin(true); //layout.setSpacing(true); layout.setSizeFull(); }
From source file:com.cavisson.gui.dashboard.components.controls.ValoThemeUI.java
License:Apache License
private Component createThemeSelect() { final NativeSelect ns = new NativeSelect(); ns.setNullSelectionAllowed(false);/*from w w w. j a v a 2 s . c o m*/ ns.setId("themeSelect"); ns.addContainerProperty("caption", String.class, ""); ns.setItemCaptionPropertyId("caption"); for (final String identifier : themeVariants.keySet()) { ns.addItem(identifier).getItemProperty("caption").setValue(themeVariants.get(identifier)); } ns.setValue("tests-valo"); ns.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { setTheme((String) ns.getValue()); } }); return ns; }
From source file:com.foo01.ui.ReservationDetailView.java
@Override protected final void onBecomingVisible() { getNavigationBar().setCaption("Detail Rezervace"); //buttony pod navbarem HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setStyleName("buttonToolBarLayout"); buttonsLayout.setWidth("100%"); Button deleteButton = new Button(); deleteButton.setCaption("SMAZAT"); deleteButton.setWidth(null);/*from w w w . j av a 2 s.c o m*/ buttonsLayout.addComponent(deleteButton); Label plug = new Label(); buttonsLayout.addComponent(plug); Button saveButton = new Button(); saveButton.setCaption("ULOIT"); saveButton.setWidth(null); buttonsLayout.addComponent(saveButton); buttonsLayout.setExpandRatio(plug, 1.0f); List<Source> sourcesList = MockSource.mockSources(); //combobox na zdroje a jmeno uzivatele HorizontalLayout sourceAndNameLayout = new HorizontalLayout(); sourceAndNameLayout.setWidth("100%"); sourceAndNameLayout.setStyleName("sourceAndNameLayout"); NativeSelect select = new NativeSelect(); select.setNullSelectionAllowed(false); System.out.println(Page.getCurrent().getBrowserWindowWidth()); String width = Page.getCurrent().getBrowserWindowWidth() / 2.5 + "px"; select.setWidth(width); select.addItems(sourcesList); for (Source s : sourcesList) { if (reservation.getSource().equals(s)) { select.select(s); break; } } sourceAndNameLayout.addComponent(select); Label plug2 = new Label(); sourceAndNameLayout.addComponent(plug2); Label name = new Label(reservation.getUser()); name.setWidth(null); sourceAndNameLayout.addComponent(name); sourceAndNameLayout.setExpandRatio(plug2, 1.0f); //datepickery DatePicker dateFrom = new DatePicker(); dateFrom.setStyleName("datePickerDetailView"); dateFrom.setValue(reservation.getBeginning()); dateFrom.setUseNative(true); dateFrom.setResolution(Resolution.TIME); dateFrom.setWidth("100%"); DatePicker dateTo = new DatePicker(); dateTo.setStyleName("datePickerDetailView"); dateTo.setValue(reservation.getEnding()); dateTo.setUseNative(true); dateTo.setResolution(Resolution.TIME); dateTo.setWidth("100%"); //layout pro slider a popisky HorizontalLayout sliderLayout = new HorizontalLayout(); sliderLayout.setStyleName("sliderLayout"); sliderLayout.setWidth("100%"); sliderLayout.setSpacing(true); Label sliderCaption = new Label("Po?et: "); sliderCaption.addStyleName("sliderCaption"); sliderCaption.setWidth(null); sliderLayout.addComponent(sliderCaption); final Label horvalue = new Label(); horvalue.setWidth("45px"); horvalue.setStyleName("value"); sliderLayout.addComponent(horvalue); final Slider horslider = new Slider(1, 10); horslider.setOrientation(SliderOrientation.HORIZONTAL); horslider.setValue(Double.valueOf(1)); horslider.getState(); horslider.getValue(); horslider.setImmediate(true); horslider.setWidth("100%"); sliderLayout.addComponent(horslider); sliderLayout.setExpandRatio(horslider, 1.0f); horvalue.setValue(String.valueOf(horslider.getValue().intValue())); horslider.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { int value = horslider.getValue().intValue(); horvalue.setValue(String.valueOf(value)); } }); //switch schvaleno HorizontalLayout switchLayout = new HorizontalLayout(); switchLayout.setStyleName("switchLayout"); switchLayout.addComponent(new Label("Schvleno:")); switchLayout.setSpacing(true); Switch checkbox = new Switch(null, true); switchLayout.addComponent(checkbox); //popis rezervace TextArea description = new TextArea(); description.setStyleName("descriptionDetailView"); description.setWidth("100%"); description.setImmediate(false); description.setCaption("Popis:"); description.setValue(reservation.getDescription()); //description.setRequired(true); description.setRequiredError("Popis mus bt zadn!"); description.setNullRepresentation(""); description.setReadOnly(true); //description.setRows(0); final VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); content.setStyleName(width); content.addComponent(buttonsLayout); content.addComponent(sourceAndNameLayout); content.addComponent(dateFrom); content.addComponent(dateTo); content.addComponent(sliderLayout); content.addComponent(switchLayout); content.addComponent(description); setContent(content); }
From source file:com.foo01.ui.ReservationView.java
@Override protected final void onBecomingVisible() { getNavigationBar().setCaption("Detail Rezervace"); //buttony pod navbarem // HorizontalLayout buttonsLayout = new HorizontalLayout(); // buttonsLayout.setStyleName("buttonToolBarLayout"); // buttonsLayout.setWidth("100%"); ///*from w ww . jav a2 s . c o m*/ // Button deleteButton = new Button(); // deleteButton.setCaption("SMAZAT"); // deleteButton.setWidth(null); // buttonsLayout.addComponent(deleteButton); // // Label plug = new Label(); // buttonsLayout.addComponent(plug); // // Button saveButton = new Button(); // saveButton.setCaption("ULOIT"); // saveButton.setWidth(null); // buttonsLayout.addComponent(saveButton); // buttonsLayout.setExpandRatio(plug, 1.0f); //combobox na zdroje a jmeno uzivatele List<Source> sourcesList = MockSource.mockSources(); HorizontalLayout sourceAndNameLayout = new HorizontalLayout(); sourceAndNameLayout.setWidth("100%"); sourceAndNameLayout.setStyleName("sourceAndNameLayout"); NativeSelect select = new NativeSelect(); select.setNullSelectionAllowed(false); System.out.println(Page.getCurrent().getBrowserWindowWidth()); String width = Page.getCurrent().getBrowserWindowWidth() / 2.5 + "px"; select.setWidth(width); select.addItems(sourcesList); for (Source s : sourcesList) { if (reservation.getSource().equals(s)) { select.select(s); break; } } sourceAndNameLayout.addComponent(select); Label plug2 = new Label(); sourceAndNameLayout.addComponent(plug2); Label name = new Label(reservation.getUser()); name.setWidth(null); sourceAndNameLayout.addComponent(name); sourceAndNameLayout.setExpandRatio(plug2, 1.0f); //datepickery DatePicker dateFrom = new DatePicker(); dateFrom.setStyleName("datePickerDetailView"); dateFrom.setValue(reservation.getBeginning()); dateFrom.setUseNative(true); dateFrom.setResolution(Resolution.TIME); dateFrom.setWidth("100%"); DatePicker dateTo = new DatePicker(); dateTo.setStyleName("datePickerDetailView"); dateTo.setValue(reservation.getEnding()); dateTo.setUseNative(true); dateTo.setResolution(Resolution.TIME); dateTo.setWidth("100%"); //layout pro slider a popisky HorizontalLayout sliderLayout = new HorizontalLayout(); sliderLayout.setStyleName("sliderLayout"); sliderLayout.setWidth("100%"); sliderLayout.setSpacing(true); Label sliderCaption = new Label("Po?et: "); sliderCaption.addStyleName("sliderCaption"); sliderCaption.setWidth(null); sliderLayout.addComponent(sliderCaption); final Label horvalue = new Label(); horvalue.setWidth("45px"); horvalue.setStyleName("value"); sliderLayout.addComponent(horvalue); final Slider horslider = new Slider(1, 10); horslider.setOrientation(SliderOrientation.HORIZONTAL); horslider.setValue(Double.valueOf(1)); horslider.getState(); horslider.getValue(); horslider.setImmediate(true); horslider.setWidth("100%"); sliderLayout.addComponent(horslider); sliderLayout.setExpandRatio(horslider, 1.0f); horvalue.setValue(String.valueOf(horslider.getValue().intValue())); horslider.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { int value = horslider.getValue().intValue(); horvalue.setValue(String.valueOf(value)); } }); //switch schvaleno HorizontalLayout switchLayout = new HorizontalLayout(); switchLayout.setStyleName("switchLayout"); switchLayout.addComponent(new Label("Schvleno:")); switchLayout.setSpacing(true); Switch checkbox = new Switch(null, true); switchLayout.addComponent(checkbox); //popis rezervace TextArea description = new TextArea(); description.setStyleName("descriptionDetailView"); description.setWidth("100%"); description.setImmediate(false); description.setCaption("Popis:"); description.setValue(reservation.getDescription()); //description.setRequired(true); description.setRequiredError("Popis mus bt zadn!"); description.setNullRepresentation(""); description.setReadOnly(true); //description.setRows(0); final VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); content.addComponent(new ButtonToolBarLayout(this)); content.addComponent(sourceAndNameLayout); content.addComponent(dateFrom); content.addComponent(dateTo); content.addComponent(sliderLayout); content.addComponent(switchLayout); content.addComponent(description); setContent(content); }
From source file:com.github.carljmosca.ui.SearchView.java
@PostConstruct private void init() { setCaption("ZoneMinderV"); VerticalComponentGroup content = new VerticalComponentGroup(); cmbMonitors = new NativeSelect<>(); if (monitorsRepository.count() > 0) { List<Monitors> monitors = monitorsRepository.findAll(); cmbMonitors.setItems(monitors);//from w w w .j a v a 2 s.com cmbMonitors.setValue(monitors.get(0)); } cmbMonitors.setItemCaptionGenerator(p -> p.getName()); cmbMonitors.setEmptySelectionAllowed(false); cmbMonitors.setEmptySelectionCaption("Select monitor"); content.addComponent(cmbMonitors); datePicker = new DatePicker("Event Date"); datePicker.setValue(new Date()); content.addComponent(datePicker); final Button btnSearch = new Button("Search"); btnSearch.addClickListener((ClickEvent event) -> { DemoUI demoUI = (DemoUI) this.getUI(); if (cmbMonitors.getValue() != null && datePicker.getValue() != null) { demoUI.setMonitorId(cmbMonitors.getValue().getId()); demoUI.setEventStartTime(datePicker.getValue()); getNavigationManager().navigateTo(eventsView); } else { Notification.show("Select monitor and date"); } }); setContent(new CssLayout(content, btnSearch)); }
From source file:com.ocs.dynamo.ui.component.TimeField.java
License:Apache License
private NativeSelect getSelect() { NativeSelect select = new NativeSelect(); select.setImmediate(true);//from ww w. ja va 2 s .c o m select.setNullSelectionAllowed(false); select.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 3383351188340627219L; @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { if (maskInternalValueChange) { return; } maskInternalValueChange = true; updateValue(); TimeField.this.fireValueChange(true); maskInternalValueChange = false; } }); return select; }
From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.all.AllView.java
License:Open Source License
@PostConstruct public void init() { setSizeFull();//from w ww.j a v a 2 s . c o m setSpacing(true); setMargin(true); HorizontalLayout header = new HorizontalLayout(); header.setWidth("100%"); header.setSpacing(true); header.setMargin(true); final TextField filter = new TextField(); filter.setInputPrompt("Type artifact name or maven dependency"); filter.setWidth("100%"); filter.addTextChangeListener(new FilterFiles(AbstractDeployableContainer.DEPLOYABLE_NAME, directoryContainer.getContainer(), mavenContainer.getContainer())); header.addComponent(filter); header.setComponentAlignment(filter, Alignment.TOP_LEFT); header.setExpandRatio(filter, 3); HorizontalLayout actionArea = new HorizontalLayout(); final NativeSelect actionSelection = new NativeSelect(); actionSelection.addItem(DeploymentActions.DEPLOY); actionSelection.addItem(DeploymentActions.DEPLOYMENT_PLAN); actionSelection.setWidth("100px"); actionSelection.setNullSelectionAllowed(false); TreeTable directoryTable = createDeployableTable(AbstractDeployableContainer.DEPLOYABLE_NAME, DIRECTORY_ITEM_ID, directoryContainer.getContainer()); TreeTable mavenTable = createDeployableTable(AbstractDeployableContainer.DEPLOYABLE_NAME, MAVEN_ITEM_ID, mavenContainer.getContainer()); //mavenTable.addExpandListener(new TreeItemExpandListener(this, mavenRepositoryService)); Button doButton = new Button("Do"); doButton.addStyleName("default"); doButton.addClickListener( new DoClickListener(artifactBuilder, directoryTable, actionSelection, deploymentViewManager)); actionArea.addComponent(actionSelection); actionArea.addComponent(doButton); header.addComponent(actionArea); header.setExpandRatio(actionArea, 2); header.setComponentAlignment(actionArea, Alignment.TOP_RIGHT); addComponent(header); addComponent(directoryTable); setExpandRatio(directoryTable, 1.5f); addComponent(mavenTable); setExpandRatio(mavenTable, 1.5f); }
From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.directory.DirectoryView.java
License:Open Source License
@PostConstruct public void init() { File deploy = new File(System.getProperty("user.dir") + File.separator + "deploy"); repositoryManager.addRepository(formatUrl(deploy), "Deploy", RepositoryType.DIRECTORY); File m2 = new File( System.getProperty("user.home") + File.separator + ".m2" + File.separator + "repository"); if (m2.exists()) { repositoryManager.addRepository(formatUrl(m2), "Local M2 repository", RepositoryType.DIRECTORY); }/* w ww.j av a2 s .c om*/ File tmp = new File(Constants.STORAGE_DIRECTORY); if (!tmp.exists()) { tmp.mkdirs(); } repositoryManager.addRepository(formatUrl(tmp), "Temporary directory", RepositoryType.DIRECTORY); HorizontalLayout header = new HorizontalLayout(); header.setWidth("100%"); header.setSpacing(true); header.setMargin(true); final TextField filter = new TextField(); filter.setInputPrompt("Filter deployable files"); filter.setWidth("100%"); filter.addTextChangeListener(new FilterFiles(DEPLOYABLE_NAME, getContainer())); header.addComponent(filter); header.setComponentAlignment(filter, Alignment.TOP_LEFT); header.setExpandRatio(filter, 3); HorizontalLayout actionArea = new HorizontalLayout(); final NativeSelect actionSelection = new NativeSelect(); actionSelection.addItem(DeploymentActions.DEPLOY); actionSelection.addItem(DeploymentActions.DELETE); actionSelection.addItem(DeploymentActions.DEPLOYMENT_PLAN); actionSelection.setWidth("100px"); actionSelection.setNullSelectionAllowed(false); Button doButton = new Button("Do"); doButton.addStyleName("default"); doButton.addClickListener( new DoClickListener(artifactBuilder, getTree(), actionSelection, deploymentViewManager)); actionArea.addComponent(actionSelection); actionArea.addComponent(doButton); header.addComponent(actionArea); header.setExpandRatio(actionArea, 2); header.setComponentAlignment(actionArea, Alignment.TOP_RIGHT); addComponent(header); HorizontalLayout repositoryInfo = new HorizontalLayout(); repositoryInfo.setWidth("100%"); repositoryInfo.addComponent(getFetching()); repositoryInfo.setComponentAlignment(getFetching(), Alignment.MIDDLE_LEFT); addComponent(repositoryInfo); getTree().addShortcutListener(new DeleteFileShortcutListener(deploymentViewManager, getTree(), "Delete", ShortcutAction.KeyCode.DELETE, null)); getTree().addExpandListener(new TreeItemExpandListener(this, getRepositoryService(), repositoryManager)); addComponent(getTree()); setExpandRatio(getTree(), 1.5f); }
From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.maven.MavenView.java
License:Open Source License
@PostConstruct public void init() throws URISyntaxException { repositoryManager.loadRepositoriesInCache(); addRootItemToContainer("Peergreen Releases", new URI("https://forge.peergreen.com/repository/content/repositories/releases/")); addRootItemToContainer("Maven Central", new URI("http://repo1.maven.org/maven2/")); HorizontalLayout header = new HorizontalLayout(); header.setWidth("100%"); header.setSpacing(true);/*w ww.j a v a 2 s. c o m*/ header.setMargin(true); final TextField filterG = new TextField(); filterG.setInputPrompt("Filter by group id"); filterG.addTextChangeListener(new FilterFiles(MVN_GROUP_ID, getContainer())); header.addComponent(filterG); header.setComponentAlignment(filterG, Alignment.TOP_LEFT); final TextField filterA = new TextField(); filterA.setInputPrompt("Filter by artifact id"); filterA.addTextChangeListener(new FilterFiles(MVN_ARTIFACT_ID, getContainer())); header.addComponent(filterA); header.setComponentAlignment(filterA, Alignment.TOP_LEFT); // final TextField filterV = new TextField(); // filterV.setInputPrompt("Filter by version"); // filterV.addTextChangeListener(new FilterFiles(MVN_VERSION, getContainer())); // header.addComponent(filterV); // header.setComponentAlignment(filterV, Alignment.TOP_LEFT); HorizontalLayout actionArea = new HorizontalLayout(); final NativeSelect actionSelection = new NativeSelect(); actionSelection.addItem(DeploymentActions.DEPLOY); actionSelection.addItem(DeploymentActions.DEPLOYMENT_PLAN); actionSelection.addItem(CLEAR_FILTER); actionSelection.setWidth("100px"); actionSelection.setNullSelectionAllowed(false); Button doButton = new Button("Do"); doButton.addStyleName("default"); doButton.addClickListener( new DoClickListener(artifactBuilder, getTree(), actionSelection, deploymentViewManager)); doButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (CLEAR_FILTER.equals(actionSelection.getValue())) { getContainer().removeAllContainerFilters(); } } }); actionArea.addComponent(actionSelection); actionArea.addComponent(doButton); header.addComponent(actionArea); header.setExpandRatio(actionArea, 2); header.setComponentAlignment(actionArea, Alignment.TOP_RIGHT); addComponent(header); HorizontalLayout repositoryInfo = new HorizontalLayout(); repositoryInfo.setWidth("100%"); repositoryInfo.addComponent(getFetching()); repositoryInfo.setComponentAlignment(getFetching(), Alignment.MIDDLE_LEFT); addComponent(repositoryInfo); getTree().addExpandListener(new TreeItemExpandListener(this, getRepositoryService(), repositoryManager)); addComponent(getTree()); setExpandRatio(getTree(), 1.5f); updateTree(); }
From source file:com.peergreen.webconsole.scope.deployment.internal.deployed.DeployedPanel.java
License:Open Source License
@PostConstruct public void init() { setSizeFull();/*from ww w. j a v a2 s .co m*/ Table table = new Table(); VerticalLayout mainContent = new VerticalLayout(); mainContent.setSpacing(true); mainContent.setMargin(true); mainContent.setStyleName("deployable-style"); mainContent.setSizeFull(); setContent(mainContent); HorizontalLayout toolBar = new HorizontalLayout(); toolBar.setMargin(true); toolBar.setSpacing(true); toolBar.setWidth("100%"); // Select all deployed artifacts CheckBox selectAll = new CheckBox("All"); selectAll.addValueChangeListener(new SelectAll(table)); toolBar.addComponent(selectAll); toolBar.setExpandRatio(selectAll, 1); // Filter TextField filter = new TextField(); filter.setInputPrompt("Filter deployed artifacts"); filter.setWidth("100%"); filter.addTextChangeListener(new FilterFiles(TREE_ITEM_ID, container)); toolBar.addComponent(filter); toolBar.setComponentAlignment(filter, Alignment.TOP_LEFT); toolBar.setExpandRatio(filter, 3); HorizontalLayout actionArea = new HorizontalLayout(); final NativeSelect actionSelection = new NativeSelect(); actionSelection.addItem(DeploymentActions.UNDEPLOY); actionSelection.addItem(DeploymentActions.DELETE); actionSelection.addItem(DeploymentActions.DEPLOYMENT_PLAN); actionSelection.setWidth("100px"); actionSelection.setNullSelectionAllowed(false); Button doButton = new Button("Do"); doButton.addStyleName("default"); doButton.addClickListener( new DoClickListener(artifactBuilder, table, actionSelection, deploymentViewManager)); actionArea.addComponent(actionSelection); actionArea.addComponent(doButton); toolBar.addComponent(actionArea); toolBar.setComponentAlignment(actionArea, Alignment.TOP_RIGHT); mainContent.addComponent(toolBar); VerticalLayout deployedContainer = new VerticalLayout(); DragAndDropWrapper deployedContainerWrapper = new DragAndDropWrapper(deployedContainer); deployedContainerWrapper .setDropHandler(new DeploymentDropHandler(deploymentViewManager, this, notifierService)); deployedContainerWrapper.setSizeFull(); mainContent.addComponent(deployedContainerWrapper); mainContent.setExpandRatio(deployedContainerWrapper, 1.5f); container.addContainerProperty(TREE_ITEM_ID, String.class, null); table.setSizeFull(); table.setImmediate(true); table.setMultiSelect(true); table.setSelectable(true); table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); table.setContainerDataSource(container); table.setDragMode(Table.TableDragMode.MULTIROW); table.setItemCaptionPropertyId(TREE_ITEM_ID); table.setCellStyleGenerator(new ItemStyle(DeployableContainerType.DEPLOYED, deploymentManager)); table.addShortcutListener(new DeleteFileShortcutListener(deploymentViewManager, table, "Delete", ShortcutAction.KeyCode.DELETE, null)); table.setItemDescriptionGenerator(new ItemDescription()); table.addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (event.isDoubleClick()) { DeployableEntry deployableEntry = (DeployableEntry) event.getItemId(); try { ArtifactStatusReport report = deploymentManager .getReport(deployableEntry.getUri().toString()); event.getComponent().getUI() .addWindow(new DeployableWindow(deployableEntry, report).getWindow()); } catch (ArtifactStatusReportException e) { LOGGER.warn("Cannot get artifact status report for ''{0}''", deployableEntry.getUri(), e); event.getComponent().getUI().addWindow(new DeployableWindow(deployableEntry).getWindow()); } } } }); deployedContainer.addComponent(table); deployedContainer.setExpandRatio(table, 1.5f); refresh(); }