List of usage examples for com.vaadin.ui Window Window
public Window()
From source file:ac.uk.icl.dell.vaadin.glycanbuilder.GlycanBuilderWindow.java
License:Open Source License
@Override public void init() { Window mainWindow = new Window(); setMainWindow(mainWindow);//from w w w .j a v a2 s . com setTheme("ucdb_2011theme"); SimpleFileMenu menu = new SimpleFileMenu(); CustomLayout layout = new CustomLayout("header_content_footer_layout"); layout.addComponent(menu, "header"); }
From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java
License:Open Source License
public void appendImportMenu(CustomMenuBar.MenuItem parent, CustomMenuBar.MenuItem beforeItem) { final Window importWindow = new Window() { private static final long serialVersionUID = -397373017493034496L; @Override/*from ww w. ja va2s . c o m*/ public void close() { setVisible(false); } }; importWindow.setCaption("Import from sequence"); importWindow.setResizable(false); final CanvasImport canvasImport = new CanvasImport(); importWindow.getContent().addComponent(canvasImport); importWindow.center(); importWindow.setVisible(false); @SuppressWarnings("unused") CustomMenuBar.MenuItem importMenu = parent.addItemBefore("Import", null, new CustomMenuBar.Command() { private static final long serialVersionUID = -6735134306275926140L; @Override public void menuSelected(CustomMenuBar.MenuItem selectedItem) { if (!importWindow.isVisible()) { if (getWindow().getChildWindows().contains(importWindow) == false) { getWindow().addWindow(importWindow); } importWindow.setVisible(true); } } }, beforeItem); importWindow.setSizeUndefined(); importWindow.getContent().setSizeUndefined(); final Window importFromStringWindow = new Window() { private static final long serialVersionUID = 7035248961169308096L; @Override public void close() { setVisible(false); } }; importFromStringWindow.setCaption("Import sequence from string"); importFromStringWindow.setWidth("400px"); final ImportStructureFromStringDialog importStructureStringDialog = new ImportStructureFromStringDialog( theCanvas); importStructureStringDialog.addListener(new UserInputEndedListener() { @Override public void done(boolean cancelled) { if (!cancelled) { if (!theCanvas.theDoc.importFromString(importStructureStringDialog.getSequenceString(), theCanvas .getImportFormatShortFormat(importStructureStringDialog.getSequenceFormat()))) { IGGApplication.reportMessage(LogUtils.getLastError()); LogUtils.clearLastError(); } } } }); WeeLayout layout = new WeeLayout(Direction.VERTICAL); layout.setSizeFull(); importFromStringWindow.setContent(layout); layout.addComponent(importStructureStringDialog, Alignment.MIDDLE_CENTER); importFromStringWindow.center(); importFromStringWindow.setVisible(false); @SuppressWarnings("unused") CustomMenuBar.MenuItem importFromStringMenu = parent.addItemBefore("Import from string", null, new CustomMenuBar.Command() { private static final long serialVersionUID = 1586089744665899803L; @Override public void menuSelected(CustomMenuBar.MenuItem selectedItem) { if (!importFromStringWindow.isVisible()) { if (getWindow().getChildWindows().contains(importFromStringWindow) == false) { getWindow().addWindow(importFromStringWindow); } importFromStringWindow.setVisible(true); } } }, beforeItem); }
From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java
License:Open Source License
public void showMessage(String message, String width, String height, String caption) { Window window = new Window(); window.setCaption(caption);/*from w w w .jav a 2 s .co m*/ window.setWidth(width); window.setHeight(height); window.center(); Panel panel = new Panel(); panel.getContent().addComponent(new Label(message)); window.getContent().addComponent(panel); getWindow().addWindow(window); }
From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java
License:Open Source License
public void appendNotationMenu(CustomMenuBar.MenuItem parent) { final HashMap<String, String> notationIndex = new HashMap<String, String>(); CustomMenuBar.Command notationChangeCommand = new CustomMenuBar.Command() { private static final long serialVersionUID = 5081687058270283137L; @Override//from ww w .j a va2 s . com public void menuSelected(CustomMenuBar.MenuItem selectedItem) { String notation = notationIndex.get(selectedItem.getText()); theCanvas.setNotation(notation); } }; parent.addItem("CFG notation", notationChangeCommand); notationIndex.put("CFG notation", GraphicOptions.NOTATION_CFG); parent.addItem("CFG black and white notation", notationChangeCommand); notationIndex.put("CFG black and white notation", GraphicOptions.NOTATION_CFGBW); parent.addItem("CFG with linkage placement notation", notationChangeCommand); notationIndex.put("CFG with linkage placement notation", GraphicOptions.NOTATION_CFGLINK); parent.addItem("UOXF notation", notationChangeCommand); notationIndex.put("UOXF notation", GraphicOptions.NOTATION_UOXF); parent.addItem("UOXFCOL notation", notationChangeCommand); notationIndex.put("UOXFCOL notation", GraphicOptions.NOTATION_UOXFCOL); parent.addItem("Text only notation", notationChangeCommand); notationIndex.put("Text only notation", GraphicOptions.NOTATION_TEXT); parent.addItem("Show Masses", new ThemeResource("icons/uncheckedbox.png"), new CustomMenuBar.Command() { private static final long serialVersionUID = 6140157670134115820L; @Override public void menuSelected(CustomMenuBar.MenuItem selectedItem) { //selectedItem.setIcon(arg0); boolean showMasses = theCanvas.theWorkspace.getGraphicOptions().SHOW_MASSES_CANVAS; if (showMasses) { theCanvas.theWorkspace.getGraphicOptions().SHOW_MASSES_CANVAS = false; selectedItem.setIcon(new ThemeResource("icons/uncheckedbox.png")); } else { theCanvas.theWorkspace.getGraphicOptions().SHOW_MASSES_CANVAS = true; selectedItem.setIcon(new ThemeResource("icons/checkbox.png")); } theCanvas.documentUpdated(); } }); parent.addItem("Show reducing end symbol", new ThemeResource("icons/uncheckedbox.png"), new CustomMenuBar.Command() { private static final long serialVersionUID = -5209359926737326181L; @Override public void menuSelected(CustomMenuBar.MenuItem selectedItem) { boolean showRedEnd = theCanvas.theWorkspace.getGraphicOptions().SHOW_REDEND_CANVAS; if (showRedEnd) { theCanvas.theWorkspace.getGraphicOptions().SHOW_REDEND_CANVAS = false; selectedItem.setIcon(new ThemeResource("icons/uncheckedbox.png")); } else { theCanvas.theWorkspace.getGraphicOptions().SHOW_REDEND_CANVAS = true; selectedItem.setIcon(new ThemeResource("icons/checkbox.png")); } theCanvas.documentUpdated(); } }); final Window massOptionsDialog = new Window() { private static final long serialVersionUID = -5094399884130705221L; @Override public void close() { setVisible(false); } }; massOptionsDialog.setResizable(false); //massOptionsDialog.setIcon(new ThemeResource("icons/massoptions.png")); massOptionsDialog.setCaption("Mass options"); MassOptionsDialog dialog = new MassOptionsDialog(theCanvas.theDoc.getStructures(), theCanvas.theWorkspace.getDefaultMassOptions()); dialog.addMassOptionListener(this); massOptionsDialog.addComponent(dialog); ((VerticalLayout) massOptionsDialog.getContent()).setComponentAlignment(dialog, Alignment.MIDDLE_CENTER); massOptionsDialog.setVisible(false); massOptionsDialog.center(); parent.addItem("Mass options", new CustomMenuBar.Command() { private static final long serialVersionUID = -589321392382766804L; @Override public void menuSelected(CustomMenuBar.MenuItem selectedItem) { if (massOptionsDialog.getParent() == null) { getWindow().addWindow(massOptionsDialog); } massOptionsDialog.setVisible(true); } }); massOptionsDialog.setSizeUndefined(); massOptionsDialog.getContent().setSizeUndefined(); }
From source file:annis.gui.docbrowser.DocBrowserTable.java
License:Apache License
public Button generateInfoButtonCell(final String docName) { Button btn = new Button(); btn.setStyleName(ChameleonTheme.BUTTON_BORDERLESS); btn.setIcon(INFO_ICON);// w w w . j a v a 2 s. c om btn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { List<Annotation> annos = getDocMetaData(docName); /** * Transforms to a list of key value pairs. The values concates the * namespace and ordinary value. Namespaces "NULL" are ignored. */ // create datasource and bind it to a table BeanItemContainer<Annotation> metaContainer = new BeanItemContainer<>(Annotation.class); metaContainer.addAll(annos); metaContainer.sort(new Object[] { "namespace", "name" }, new boolean[] { true, true }); Table metaTable = new Table(); metaTable.setContainerDataSource(metaContainer); metaTable.addGeneratedColumn("genname", new MetaDataPanel.MetaTableNameGenerator(metaContainer)); metaTable.addGeneratedColumn("genvalue", new MetaDataPanel.MetaTableValueGenerator(metaContainer)); metaTable.setVisibleColumns("genname", "genvalue"); metaTable.setColumnHeaders(new String[] { "Name", "Value" }); metaTable.setSizeFull(); metaTable.setColumnWidth("genname", -1); metaTable.setColumnExpandRatio("genvalue", 1.0f); metaTable.addStyleName(ChameleonTheme.TABLE_STRIPED); // create and style the extra window for the metadata table Window metaWin = new Window(); metaWin.setContent(metaTable); metaWin.setCaption("metadata doc " + docName); metaWin.center(); metaWin.setWidth(400, Unit.PIXELS); metaWin.setHeight(400, Unit.PIXELS); // paint the window docBrowserPanel.getUI().addWindow(metaWin); } catch (UniformInterfaceException ex) { log.error("can not retrieve metadata for document " + docName, ex); } } }); return btn; }
From source file:ch.bfh.ti.soed.hs16.srs.purple.view.ReservationView.java
License:Open Source License
/** * Shows the popup window where a reservation can be modified, deleted or inserted * @param res The Reservation Object (for a new reservation, fill the startDate with the current Timestamp!) */// w w w .j ava 2 s .c o m @SuppressWarnings("serial") private void showPopup(Reservation res) { this.res = res; //Update the member boolean newRes = res.getReservationID() > 0 ? false : true; boolean isHost = isHost(actualUser, res.getHostList()); boolean isParticipant = isHost(actualUser, res.getParticipantList()); final GridLayout gridLayout = new GridLayout(3, 5); ValueChangeListener vcl = new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { List<Room> roomList = resCont.getAllFreeRooms(new Timestamp(startDate.getValue().getTime()), new Timestamp(endDate.getValue().getTime())); if (ReservationView.this.res.getReservationID() > 0) { System.out.println("Aktuellen Raum"); rooms.addItem(ReservationView.this.res.getRoom().getRoomID()); rooms.setItemCaption(ReservationView.this.res.getRoom().getRoomID(), ReservationView.this.res.getRoom().getName() + " (" + ReservationView.this.res.getRoom().getNumberOfSeats() + " Pltze)"); rooms.select(ReservationView.this.res.getRoom().getRoomID()); } for (int i = 0; i < roomList.size(); i++) { rooms.addItem(roomList.get(i).getRoomID()); String caption = roomList.get(i).getName() + " (" + roomList.get(i).getNumberOfSeats() + " Pltze)"; rooms.setItemCaption(roomList.get(i).getRoomID(), caption); } if (ReservationView.this.res.getReservationID() <= 0 && actualRoom != null) rooms.select(actualRoom.getRoomID()); } }; popUpWindow = new Window(); popUpWindow.center(); popUpWindow.setModal(true); startDate = new DateField("Startzeit"); startDate.setLocale(VaadinSession.getCurrent().getLocale()); startDate.setValue(res.getStart()); startDate.addValueChangeListener(vcl); startDate.setDateFormat("dd.MM.yyyy HH:mm"); startDate.setResolution(Resolution.HOUR); endDate = new DateField("Endzeit"); endDate.setValue(res.getEnd()); endDate.addValueChangeListener(vcl); endDate.setDateFormat("dd.MM.yyyy HH:mm"); endDate.setLocale(VaadinSession.getCurrent().getLocale()); endDate.setResolution(Resolution.HOUR); title = new TextField("Titel"); title.setValue(res.getTitle()); title.setWidth(100, Unit.PERCENTAGE); description = new TextArea("Beschreibung"); description.setValue(res.getDescription()); description.setRows(3); description.setWidth(100, Unit.PERCENTAGE); hosts = new ListSelect("Reservierender"); hosts.setMultiSelect(true); hosts.clear(); for (int i = 0; i < hostList.size(); i++) { hosts.addItem(hostList.get(i).getUserID()); hosts.setItemCaption(hostList.get(i).getUserID(), hostList.get(i).getUsername()); } //select the hosts in list if (!newRes) { List<User> resHosts = res.getHostList(); for (int i = 0; i < resHosts.size(); i++) for (int y = 0; y < hostList.size(); y++) if (hostList.get(y).getUserID() == resHosts.get(i).getUserID()) hosts.select(resHosts.get(i).getUserID()); } else hosts.select(actualUser.getUserID()); hosts.select(0); hosts.setRows(hostList.size() > 5 ? 5 : hostList.size()); participantList = new ListSelect("Teilnehmer"); participantList.setMultiSelect(true); participantList.clear(); for (int i = 0; i < participant.size(); i++) { participantList.addItem(participant.get(i).getUserID()); participantList.setItemCaption(participant.get(i).getUserID(), participant.get(i).getUsername()); } //select the participants in list if (!newRes) { List<User> resPart = res.getParticipantList(); for (int i = 0; i < resPart.size(); i++) for (int y = 0; y < participant.size(); y++) if (participant.get(y).getUserID() == resPart.get(i).getUserID()) participantList.select(resPart.get(i).getUserID()); } participantList.setRows(participant.size() > 5 ? 5 : participant.size()); rooms = new NativeSelect("Raum"); rooms.setNullSelectionAllowed(false); rooms.removeAllItems(); List<Room> roomList = resCont.getAllFreeRooms(new Timestamp(startDate.getValue().getTime()), new Timestamp(endDate.getValue().getTime())); if (!newRes) { rooms.addItem(res.getRoom().getRoomID()); rooms.setItemCaption(res.getRoom().getRoomID(), res.getRoom().getName() + " (" + res.getRoom().getNumberOfSeats() + " Pltze)"); rooms.select(res.getRoom().getRoomID()); } for (int i = 0; i < roomList.size(); i++) { rooms.addItem(roomList.get(i).getRoomID()); String caption = roomList.get(i).getName() + " (" + roomList.get(i).getNumberOfSeats() + " Pltze)"; rooms.setItemCaption(roomList.get(i).getRoomID(), caption); } if (newRes && actualRoom != null) rooms.select(actualRoom.getRoomID()); saveButton = new Button("Speichern"); saveButton.addClickListener(clButton); deleteButton = new Button("Lschen"); deleteButton.addClickListener(clButton); deleteButton.setVisible(res.getReservationID() > 0 ? true : false); if (!newRes) setEditable(false); gridLayout.addComponent(startDate, 0, 0); gridLayout.addComponent(endDate, 0, 1); gridLayout.addComponent(hosts, 1, 0, 1, 1); gridLayout.addComponent(participantList, 2, 0, 2, 1); gridLayout.addComponent(title, 0, 2); gridLayout.addComponent(rooms, 1, 2, 2, 2); gridLayout.addComponent(description, 0, 3, 1, 3); if (roomList.size() == 0) saveButton.setEnabled(false); if (isHost || newRes) //show buttons for edit and delete only if the user is host or its a new reservation { gridLayout.addComponent(saveButton, 0, 4); gridLayout.addComponent(deleteButton, 1, 4); } if (isParticipant) //show buttons for accept oder decline a reservation { acceptButton = new Button("Zusagen"); rejectButton = new Button("Absagen"); acceptButton.addClickListener(clButton); rejectButton.addClickListener(clButton); if (isHost(actualUser, res.getAcceptedParticipantsList())) { acceptButton.setEnabled(false); rejectButton.setEnabled(true); } else { rejectButton.setEnabled(false); acceptButton.setEnabled(true); } gridLayout.addComponent(acceptButton, 0, 4); gridLayout.addComponent(rejectButton, 1, 4); } gridLayout.setSpacing(true); gridLayout.setMargin(new MarginInfo(false, false, false, true)); gridLayout.setWidth(100, Unit.PERCENTAGE); popUpWindow.setContent(gridLayout); popUpWindow.setWidth("600px"); popUpWindow.setHeight("450px"); popUpWindow.setCaption(res.getReservationID() > 0 ? "Reservierungsdetails" : "Neue Reservierung"); UI.getCurrent().addWindow(popUpWindow); }
From source file:ch.bfh.ti.soed.hs16.srs.red.ui.views.MyReservationView.java
License:Open Source License
public MyReservationView(Navigator nav) { /*--------------------------------- initialize objects//from w w w .ja v a2s . co m ---------------------------------*/ this.root = new VerticalLayout(); this.subWindowReservation = new Window(); this.navigation = new Menu(nav); this.labelWelcome = new Label(); this.error = new Label(); this.calendarWeek = new Calendar(); this.buttonAddRes = new Button("add Reservation", this::buttonAddReservation); //handle event in method addReservation this.contentSubWindow = new SubWindowReservation(); this.saveButton = contentSubWindow.getButtonSave(); this.deleteButton = contentSubWindow.getButtonDelete(); this.reservationController = new ReservationController(); this.userController = new UserController(); this.roomController = new RoomController(); /*--------------------------------- specialize objects ---------------------------------*/ calendarWeek.setFirstDayOfWeek(GregorianCalendar.MONDAY); saveButton.addClickListener(this::buttonSave); deleteButton.addClickListener(this::buttonDelete); List<Room> rooms = roomController.getAllRooms(); for (int i = 0; i < rooms.size(); i++) { contentSubWindow.getRooms().addItem(rooms.get(i).getId() + " " + rooms.get(i).getName()); } /*--------------------------------- add style names ---------------------------------*/ calendarWeek.setPrimaryStyleName("calendarWeek"); /*------------------------------- add components to root --------------------------------*/ Layout layoutMenu = navigation.getMenu(); root.addComponents(layoutMenu, labelWelcome, error, buttonAddRes, calendarWeek); setCompositionRoot(root); /*------------------------------- double click on calendar events --------------------------------*/ calendarWeek.setHandler((CalendarComponentEvents.EventClickHandler) event -> { addSubWindowToRoot(event); }); }
From source file:com.dungnv.streetfood.ui.RichTextWinDowUI.java
public void addAction() { btnEdit.addClickListener(new Button.ClickListener() { @Override/*from w ww.j a va 2 s . c om*/ public void buttonClick(Button.ClickEvent event) { Window window = new Window(); window.setSizeFull(); window.setResizable(false); window.setClosable(false); window.setContent(layoutWindow); UI.getCurrent().addWindow(window); } }); btnCloseWindow.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().removeWindow(event.getButton().findAncestor(Window.class)); } }); }
From source file:com.etest.view.systemadministration.SemestralTeam.AddSemestralTeamMembersWindow.java
Window removeTeamMemberWindow(int facultyRowId) { Window sub = new Window(); sub.setCaption("REMOVE TEAM MEMBER"); sub.setWidth("250px"); sub.setModal(true);//from ww w .jav a 2s.co m sub.center(); VerticalLayout vlayout = new VerticalLayout(); vlayout.setSizeFull(); vlayout.setMargin(true); Button removeBtn = new Button("REMOVE"); removeBtn.setWidth("100%"); removeBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); removeBtn.addStyleName(ValoTheme.BUTTON_SMALL); removeBtn.addClickListener((Button.ClickEvent event) -> { boolean result = tts.removeTeamMember(getTeamTeachId(), facultyRowId); if (result) { populateDataTable(); sub.close(); } }); vlayout.addComponent(removeBtn); sub.setContent(vlayout); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.etest.view.systemadministration.SemestralTeam.AddSemestralTeamMembersWindow.java
Window editTeamMemberPositionWindow(int facultyRowId) { Window sub = new Window(); sub.setCaption("REMOVE TEAM MEMBER"); sub.setWidth("250px"); sub.setModal(true);/*from w w w .ja v a 2 s . c o m*/ sub.center(); VerticalLayout vlayout = new VerticalLayout(); vlayout.setSizeFull(); vlayout.setSpacing(true); vlayout.setMargin(true); String name = fs.getFacultyNameById(facultyRowId); vlayout.addComponent(new Label("Set " + name.toUpperCase() + " as Team Leader.")); Button updateBtn = new Button("UPDATE"); updateBtn.setWidth("100%"); updateBtn.setIcon(FontAwesome.USER); updateBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); updateBtn.addStyleName(ValoTheme.BUTTON_SMALL); updateBtn.addClickListener((Button.ClickEvent event) -> { int userId = us.getUserIdByFacultyId(facultyRowId); boolean result = tts.updateTeamTeach(getTeamTeachId(), userId); if (result) { sub.close(); populateDataTable(); close(); } }); vlayout.addComponent(updateBtn); sub.setContent(vlayout); sub.getContent().setHeightUndefined(); return sub; }