List of usage examples for com.vaadin.ui Button setSizeFull
@Override public void setSizeFull()
From source file:at.jku.ce.adaptivetesting.vaadin.ui.MockQuestion.java
License:LGPL
public MockQuestion(Question question) { this.question = question; TextArea textArea = new TextArea("Question text"); textArea.setSizeFull();// w ww . j av a 2 s. com // Download the result Button button = new Button("Display current user's solution"); button.setSizeFull(); button.addClickListener(e -> { Window window = new Window("Current user solution"); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); window.setContent(layout); // Update questionText textArea.addTextChangeListener(ev -> questionText = ev.getText()); textArea.setTextChangeEventMode(TextChangeEventMode.EAGER); Label label; try { label = new Label(toXML()); } catch (Exception e1) { label = new Label( "<h1>Error parsing XML</h1><p>" + e1.getMessage() + Arrays.toString(e1.getStackTrace()), ContentMode.HTML); LogHelper.logThrowable(e1); } layout.addComponent(label); window.center(); getUI().addWindow(window); }); // Add components to the UI addComponent(textArea); addComponent(question); addComponent(button); }
From source file:com.cavisson.gui.dashboard.components.controls.Panels.java
License:Apache License
Component panelContent() { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull();/*ww w. j a va 2 s.c o m*/ layout.setMargin(true); layout.setSpacing(true); Label content = new Label( "Suspendisse dictum feugiat nisl ut dapibus. Mauris iaculis porttitor posuere. Praesent id metus massa, ut blandit odio."); content.setWidth("10em"); layout.addComponent(content); Button button = new Button("Button"); button.setSizeFull(); layout.addComponent(button); return layout; }
From source file:com.etest.view.notification.NotificationMainUI.java
Table populateNoficationTable() { notificationTable.removeAllItems();//from ww w .ja v a2 s . c o m int i = 0; for (EtestNotification en : ns.getAllNotificationByUser( CommonUtilities.convertStringToInt(VaadinSession.getCurrent().getAttribute("userId").toString()))) { VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); Button read = new Button(); read.setWidthUndefined(); read.setCaption((en.getStatus() == 0) ? "unread" : "read"); read.setData(en.getNotificationId()); read.setIcon(FontAwesome.VIDEO_CAMERA); read.addStyleName(ValoTheme.BUTTON_LINK); read.addStyleName(ValoTheme.BUTTON_TINY); read.addStyleName(ValoTheme.BUTTON_QUIET); read.addStyleName("button-container"); read.addClickListener(buttonClickListener); v.addComponent(read); v.setComponentAlignment(read, Alignment.MIDDLE_LEFT); message.setContentMode(ContentMode.HTML); String[] split = en.getNotice().split(" "); int cellCaseId; if (split[0].equals("CellCaseID")) { message.setCaption(en.getRemarks() + en.getNotice()); cellCaseId = CommonUtilities.convertStringToInt(split[1].replace("#", "")); } else { cellCaseId = cis.getCellItemById(CommonUtilities.convertStringToInt(split[1].replace("#", ""))) .getCellCaseId(); message.setCaption(en.getRemarks() + en.getNotice() + " from CellCaseID #" + cellCaseId); } Button approve = new Button("status"); approve.setSizeFull(); approve.addStyleName(ValoTheme.BUTTON_LINK); approve.addStyleName(ValoTheme.BUTTON_TINY); approve.addStyleName(ValoTheme.BUTTON_QUIET); approve.addStyleName("button-container"); v.addComponent(approve); v.setComponentAlignment(approve, Alignment.MIDDLE_LEFT); if (ccs.getCellCaseById(cellCaseId).getApprovalStatus() == 0) { approve.setIcon(FontAwesome.THUMBS_DOWN); } else { approve.setIcon(FontAwesome.THUMBS_UP); } notificationTable.addItem(new Object[] { message.getCaption().toString(), ss.getUsernameById(en.getSenderId()), en.getNoteDate(), v }, i); i++; } notificationTable.setPageLength(0); notificationTable.setHeight("100%"); return notificationTable; }
From source file:com.etest.view.systemadministration.CurriculumMainUI.java
Table populateDataTable() { table.removeAllItems();//from w ww.j a va 2 s . c o m int i = 0; for (Curriculum c : cs.getAllCurriculum()) { HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); Button edit = new Button("edit"); edit.setSizeFull(); edit.setIcon(FontAwesome.PENCIL); edit.setData(c.getCurriculumId()); edit.addStyleName(ValoTheme.BUTTON_LINK); edit.addStyleName(ValoTheme.BUTTON_TINY); edit.addStyleName("button-container"); edit.addClickListener(buttonClickListener); h.addComponent(edit); Button delete = new Button("del"); delete.setSizeFull(); delete.setIcon(FontAwesome.TRASH_O); delete.setData(c.getCurriculumId()); delete.addStyleName(ValoTheme.BUTTON_LINK); delete.addStyleName(ValoTheme.BUTTON_TINY); delete.addStyleName("button-container"); delete.addClickListener(buttonClickListener); h.addComponent(delete); table.addItem(new Object[] { // c.getCurriculumId(), CommonVariableMap.getYearLevel(c.getYearLevel()), c.getSubject(), c.getDescriptiveTitle(), CommonVariableMap.getNormCourseOffering(c.getNormCourseOffering()), h }, i); i++; } table.setPageLength(table.size()); // table.getListeners(ItemClickEvent.class).stream().forEach((listener) -> { // table.removeListener(ItemClickEvent.class, listener); // }); // // table.addItemClickListener((ItemClickEvent event) -> { // Property itemProperty = event.getItem().getItemProperty("id"); // // Window sub = new CurriculumFormWindow(CommonUtilities.convertStringToInt(itemProperty.getValue().toString())); // if(sub.getParent() == null){ // UI.getCurrent().addWindow(sub); // } // sub.addCloseListener((Window.CloseEvent e) -> { // populateDataTable(); // }); // }); return table; }
From source file:com.etest.view.testbank.CellCaseMainUI.java
Table populateDataTable() { table.removeAllItems();/*from w w w .ja v a 2 s . c o m*/ int i = 0; for (CellCase cc : ccs.getCellCaseByTopic(getSyllabusId())) { VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); Button edit = new Button("modify"); edit.setSizeFull(); edit.setData(cc.getCellCaseId()); edit.setIcon(FontAwesome.PENCIL); edit.addStyleName(ValoTheme.BUTTON_LINK); edit.addStyleName(ValoTheme.BUTTON_TINY); edit.addStyleName(ValoTheme.BUTTON_QUIET); edit.addStyleName("button-container"); edit.addClickListener(modifyBtnClickListener); v.addComponent(edit); v.setComponentAlignment(edit, Alignment.MIDDLE_LEFT); Button approve = new Button("status"); approve.setSizeFull(); approve.setData(cc.getCellCaseId()); approve.addStyleName(ValoTheme.BUTTON_LINK); approve.addStyleName(ValoTheme.BUTTON_TINY); approve.addStyleName(ValoTheme.BUTTON_QUIET); approve.addStyleName("button-container"); v.addComponent(approve); v.setComponentAlignment(approve, Alignment.MIDDLE_LEFT); if (cc.getApprovalStatus() == 0) { approve.setIcon(FontAwesome.THUMBS_DOWN); } else { approve.setIcon(FontAwesome.THUMBS_UP); } Button stem = new Button("stems"); stem.setSizeFull(); stem.setData(cc.getCellCaseId()); stem.setIcon(FontAwesome.BRIEFCASE); stem.addStyleName(ValoTheme.BUTTON_LINK); stem.addStyleName(ValoTheme.BUTTON_TINY); stem.addStyleName(ValoTheme.BUTTON_QUIET); stem.addStyleName("button-container"); stem.addClickListener(stemBtnClickListener); v.addComponent(stem); v.setComponentAlignment(stem, Alignment.MIDDLE_LEFT); Label label = new Label(cc.getCaseTopic(), ContentMode.HTML); label.setStyleName("label-padding"); table.addItem(new Object[] { cc.getCellCaseId(), label, cc.getUsername_(), cc.getDateCreated(), v }, i); i++; } table.setPageLength(table.size()); return table; }
From source file:com.etest.view.tq.TQListUI.java
public Table populateDataTable() { removeAllItems();/* ww w . j av a2 s.c o m*/ int i = 0; for (TQCoverage t : tq.getAllTQCoverage()) { VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); Button view = new Button("view"); view.setSizeFull(); view.setData(t.getTqCoverageId()); view.setIcon(FontAwesome.VIDEO_CAMERA); view.addStyleName(ValoTheme.BUTTON_LINK); view.addStyleName(ValoTheme.BUTTON_TINY); view.addStyleName(ValoTheme.BUTTON_QUIET); view.addStyleName("button-container"); view.addClickListener(remarksBtnClickListener); v.addComponent(view); v.setComponentAlignment(view, Alignment.MIDDLE_LEFT); Button approve = new Button("status"); approve.setSizeFull(); approve.setData(t.getTqCoverageId()); approve.addStyleName(ValoTheme.BUTTON_LINK); approve.addStyleName(ValoTheme.BUTTON_TINY); approve.addStyleName(ValoTheme.BUTTON_QUIET); approve.addStyleName("button-container"); v.addComponent(approve); v.setComponentAlignment(approve, Alignment.MIDDLE_LEFT); // Button print = new Button("print"); // print.setSizeFull(); // print.setData(t.getTqCoverageId()); // print.setIcon(FontAwesome.PRINT); // print.addStyleName(ValoTheme.BUTTON_LINK); // print.addStyleName(ValoTheme.BUTTON_TINY); // print.addStyleName(ValoTheme.BUTTON_QUIET); // print.addStyleName("button-container"); // print.addClickListener(remarksBtnClickListener); // v.addComponent(print); // v.setComponentAlignment(print, Alignment.MIDDLE_LEFT); if (t.getStatus() == 0) { approve.setIcon(FontAwesome.THUMBS_DOWN); // print.setVisible(false); } else { approve.setIcon(FontAwesome.THUMBS_UP); // print.setVisible(true); } addItem(new Object[] { t.getExamTitle(), cs.getCurriculumById(t.getCurriculumId()).getSubject(), t.getDateCreated(), t.getTotalHoursCoverage(), t.getTotalItems(), v }, i); i++; } setPageLength(size()); return this; }
From source file:com.haulmont.cuba.web.gui.components.WebPopupButton.java
License:Apache License
protected Button createActionButton(Action action) { WebButton button = new PopupButtonActionButton() { @Override// w w w .j a v a2 s . c om protected void beforeActionPerformed() { WebPopupButton.this.requestFocus(); } }; button.setAction(new PopupActionWrapper(action)); button.setIcon(this.isShowActionIcons() ? action.getIcon() : null); Button vButton = (Button) button.getComposition(); vButton.setImmediate(true); vButton.setSizeFull(); vButton.setStyleName(CONTEXT_MENU_BUTTON_STYLENAME); if (AppUI.getCurrent().isTestMode()) { String debugId = getDebugId(); if (debugId != null) { button.setDebugId(AppUI.getCurrent().getTestIdManager().getTestId(debugId + "_" + action.getId())); } button.setId(action.getId()); } return vButton; }
From source file:com.logicbomb.newschool.MyAppWidgetSet.core.MainMenuWidget.java
public MainMenuWidget() { setStyleName("backColorWhite"); //Accordion accordion = new Accordion(); // Create the first tab, specify caption when adding // Wrap in a layout /* tab1.addComponent( new Image(null, // No component caption new ThemeResource("img/planets/Mercury.jpg"))); accordion.addTab(tab1,/*from w ww . j av a2s . com*/ "Mercury", new ThemeResource("img/planets/Mercury_symbol.png"));*/ //Button b1= new Button("First"); //tab1.addComponent(b1); Layout tab1 = new VerticalLayout(); addTab(tab1, "To Do"); Layout tab2 = new VerticalLayout(); addTab(tab2, "Timetable"); Layout tab3 = new VerticalLayout(); addTab(tab3, "Subjects"); Layout tab4 = new VerticalLayout(); addTab(tab4, "Examinations"); Layout tab5 = new VerticalLayout(); addTab(tab5, "Attendance"); Layout tab6 = new VerticalLayout(); addTab(tab6, "Fees"); Layout tab7 = new VerticalLayout(); addTab(tab7, "Reports"); Layout tab8 = new VerticalLayout(); addTab(tab8, "Miscellaneous"); Layout tab9 = new VerticalLayout(); addTab(tab9, "About"); // Wrap in a layout /* tab1.addComponent( new Image(null, // No component caption new ThemeResource("img/planets/Mercury.jpg"))); accordion.addTab(tab1, "Mercury", new ThemeResource("img/planets/Mercury_symbol.png"));*/ for (int i = 0; i < 7; i++) { Button b2 = new Button("English"); tab3.addComponent(b2); b2.setSizeFull(); } Button b3 = new Button("Hindi"); tab3.addComponent(b3); b3.setSizeFull(); //addTab(tab2,"Teacher"); }
From source file:de.kaiserpfalzEdv.infopir.ui.register.editor.RegisterEditorViewImpl.java
License:Apache License
private Button createButton(final String i18nBase, final int tabIndex) { Button result = new Button(i18n.get(i18nBase + ".caption"), FontAwesome.valueOf(i18n.get(i18nBase + ".icon"))); result.setSizeFull(); result.setDescription(i18n.get(i18nBase + ".description")); result.setTabIndex(tabIndex);//w w w . j ava 2 s.co m buttonLayout.addComponent(result); return result; }
From source file:facs.components.BookAdmin.java
License:Open Source License
public BookAdmin(User user) { Date dNow = new Date(); SimpleDateFormat ft = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); System.out.println(ft.format(dNow) + " INFO Calendar Admin accessed! - User: " + LiferayAndVaadinUtils.getUser().getScreenName()); Label infoLabel = new Label( DBManager.getDatabaseInstance().getUserNameByUserID(LiferayAndVaadinUtils.getUser().getScreenName()) + " " + LiferayAndVaadinUtils.getUser().getScreenName()); infoLabel.addStyleName("h4"); String buttonRefreshTitle = "Refresh"; Button refresh = new Button(buttonRefreshTitle); refresh.setIcon(FontAwesome.REFRESH); refresh.setSizeFull(); refresh.setDescription("Click here to reload the data from the database!"); refresh.addStyleName(ValoTheme.BUTTON_FRIENDLY); String buttonUpdateTitle = "Update"; Button updateUser = new Button(buttonUpdateTitle); updateUser.setIcon(FontAwesome.WRENCH); updateUser.setSizeFull();//from www.jav a2 s.c o m updateUser.setDescription("Click here to update your user role and group!"); userDevice = new ListSelect("Select a device"); userDevice.addItems(DBManager.getDatabaseInstance().getDeviceNames()); userDevice.setRows(6); userDevice.setNullSelectionAllowed(false); userDevice.setSizeFull(); userDevice.setImmediate(true); /* * userDevice.addValueChangeListener(e -> Notification.show("Device:", * String.valueOf(e.getProperty().getValue()), Type.TRAY_NOTIFICATION)); */ userGroup = new ListSelect("Select a user group"); userGroup.addItems(DBManager.getDatabaseInstance().getUserGroups()); userGroup.setRows(6); userGroup.setNullSelectionAllowed(false); userGroup.setSizeFull(); userGroup.setImmediate(true); /* * userGroup.addValueChangeListener(e -> Notification.show("User Group:", * String.valueOf(e.getProperty().getValue()), Type.TRAY_NOTIFICATION)); */ userRole = new ListSelect("Select a user role"); userRole.addItems(DBManager.getDatabaseInstance().getUserRoles()); userRole.setRows(6); userRole.setNullSelectionAllowed(false); userRole.setSizeFull(); userRole.setImmediate(true); /* * userRole.addValueChangeListener(e -> Notification.show("User Role:", * String.valueOf(e.getProperty().getValue()), Type.TRAY_NOTIFICATION)); */ refresh.addClickListener(new ClickListener() { private static final long serialVersionUID = -3610721151565496269L; @Override public void buttonClick(ClickEvent event) { refreshDataSources(); } }); updateUser.addClickListener(new ClickListener() { private static final long serialVersionUID = -3610721151565496909L; @Override public void buttonClick(ClickEvent event) { try { if (userDevice.getValue().equals(null) || userRole.getValue().equals(null) || userGroup.getValue().equals(null)) { showErrorNotification("Something's missing!", "Please make sure that you selected a Device, a Role and a Group! Each list has to have one highligthed option.'."); // System.out.println("Device: "+userDevice.getValue()+" Group: "+userGroup.getValue()+" Role: "+userRole.getValue()); } else { DBManager.getDatabaseInstance().getShitDone( DBManager.getDatabaseInstance().getUserRoleIDbyDesc(userRole.getValue().toString()), DBManager.getDatabaseInstance() .getUserIDbyLDAPID(LiferayAndVaadinUtils.getUser().getScreenName()), DBManager.getDatabaseInstance() .getDeviceIDByName(userDevice.getValue().toString())); DBManager.getDatabaseInstance().getShitDoneAgain( DBManager.getDatabaseInstance() .getUserGroupIDByName(userGroup.getValue().toString()), LiferayAndVaadinUtils.getUser().getScreenName()); } } catch (Exception e) { showErrorNotification("Something's missing!", "Please make sure that you selected a Device, a Role and a Group! Each list has to have one highligthed option.'."); } refreshDataSources(); } }); // only admins are allowed to see the admin panel ;) if (!DBManager.getDatabaseInstance() .getUserAdminPanelAccessByLDAPId(LiferayAndVaadinUtils.getUser().getScreenName()).equals("1")) { VerticalLayout errorLayout = new VerticalLayout(); infoLabel.setValue("ACCESS DENIED"); errorLayout.addComponent(infoLabel); showErrorNotification("Access Denied!", "Sorry, you're not allowed to see anything here, at least your username told us so. Do you need assistance? Please contact 'info@qbic.uni-tuebingen.de'."); setCompositionRoot(errorLayout); return; } this.setCaption("Admin"); final TabSheet bookAdmin = new TabSheet(); bookAdmin.addStyleName(ValoTheme.TABSHEET_FRAMED); bookAdmin.addStyleName(ValoTheme.TABSHEET_EQUAL_WIDTH_TABS); ArrayList<String> deviceNames = new ArrayList<String>(); deviceNames = DBManager.getDatabaseInstance().getDeviceNames(); bookAdmin.addTab(awaitingRequestsGrid()); for (int i = 0; i < deviceNames.size(); i++) { bookAdmin.addTab(newDeviceGrid(deviceNames.get(i))); } bookAdmin.addTab(deletedBookingsGrid()); bookAdmin.addSelectedTabChangeListener(new SelectedTabChangeListener() { /** * */ private static final long serialVersionUID = 8987818794404251063L; @Override public void selectedTabChange(SelectedTabChangeEvent event) { userDevice.select(bookAdmin.getSelectedTab().getCaption()); userRole.select(DBManager.getDatabaseInstance() .getUserGroupDescriptionByLDAPId(LiferayAndVaadinUtils.getUser().getScreenName(), DBManager .getDatabaseInstance().getDeviceIDByName(bookAdmin.getSelectedTab().getCaption()))); userGroup.select(DBManager.getDatabaseInstance() .getUserRoleNameByLDAPId(LiferayAndVaadinUtils.getUser().getScreenName())); } }); gridLayout.setWidth("100%"); // add components to the grid layout // gridLayout.addComponent(infoLabel, 0, 0, 3, 0); gridLayout.addComponent(bookAdmin, 0, 1, 5, 1); gridLayout.addComponent(refresh, 0, 2); gridLayout.addComponent(userDevice, 0, 4, 1, 4); gridLayout.addComponent(userRole, 2, 4, 3, 4); gridLayout.addComponent(userGroup, 4, 4, 5, 4); gridLayout.addComponent(updateUser, 0, 5, 5, 5); gridLayout.setSizeFull(); gridLayout.setSpacing(true); setCompositionRoot(gridLayout); /* * JavaScript to update the Grid try { JDBCConnectionPool connectionPool = new * SimpleJDBCConnectionPool("com.mysql.jdbc.Driver", * "jdbc:mysql://localhost:8889/facs_facility", "facs", "facs"); QueryDelegate qd = new * FreeformQuery("select * from facs_facility", connectionPool, "id"); final SQLContainer c = * new SQLContainer(qd); bookAdmin.setContainerDataSource(c); } * * JavaScript.getCurrent().execute("setInterval(function(){refreshTable();},5000);"); * JavaScript.getCurrent().addFunction("refreshTable", new JavaScriptFunction() { * * @Override public void call(JsonArray arguments) { // TODO Auto-generated method stub * * } }); */ }