List of usage examples for com.vaadin.ui NativeButton NativeButton
public NativeButton()
From source file:co.edu.icesi.academ.client.perfiles.propietario.CrearCompetencia.java
License:Open Source License
@AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false);/* www .ja v a 2 s . co m*/ mainLayout.setWidth("700px"); mainLayout.setHeight("480px"); // top-level component properties setWidth("700px"); setHeight("480px"); // resutadoAprendizajeSelect resutadoAprendizajeSelect = new TwinColSelect(); resutadoAprendizajeSelect.setImmediate(false); resutadoAprendizajeSelect.setWidth("100.0%"); resutadoAprendizajeSelect.setHeight("-1px"); mainLayout.addComponent(resutadoAprendizajeSelect, "top:60.0px;right:63.0px;left:80.0px;"); // label_1 label_1 = new Label(); label_1.setImmediate(false); label_1.setWidth("229px"); label_1.setHeight("-1px"); label_1.setValue("Resultados de Aprendizaje Disponibles:"); mainLayout.addComponent(label_1, "top:20.0px;left:80.0px;"); // label_2 label_2 = new Label(); label_2.setImmediate(false); label_2.setWidth("229px"); label_2.setHeight("-1px"); label_2.setValue("Resultados de Aprendizaje Asociados:"); mainLayout.addComponent(label_2, "top:20.0px;left:380.0px;"); // label_3 label_3 = new Label(); label_3.setImmediate(false); label_3.setWidth("89px"); label_3.setHeight("18px"); label_3.setValue("Competencia:"); mainLayout.addComponent(label_3, "top:222.0px;left:80.0px;"); // btGuardarCompetencia btGuardarCompetencia = new NativeButton(); btGuardarCompetencia.setCaption("Guardar"); btGuardarCompetencia.setImmediate(true); btGuardarCompetencia.setWidth("-1px"); btGuardarCompetencia.setHeight("-1px"); mainLayout.addComponent(btGuardarCompetencia, "top:418.0px;left:566.0px;"); // textDescripcion textDescripcion = new TextArea(); textDescripcion.setImmediate(false); textDescripcion.setWidth("560px"); textDescripcion.setHeight("140px"); textDescripcion.setMaxLength(100); mainLayout.addComponent(textDescripcion, "top:260.0px;left:80.0px;"); return mainLayout; }
From source file:com.example.mmowgli_2_0.RootCards.java
@AutoGenerated private VerticalLayout buildVerticalLayout_idea1() { // common part: create layout verticalLayout_idea1 = new VerticalLayout(); verticalLayout_idea1.setImmediate(false); verticalLayout_idea1.setWidth("-1px"); verticalLayout_idea1.setHeight("-1px"); verticalLayout_idea1.setMargin(false); // label_idea1 label_idea1 = new Label(); label_idea1.setImmediate(false);/*www.j a va2s.c om*/ label_idea1.setWidth("-1px"); label_idea1.setHeight("-1px"); label_idea1.setValue("Idea 1"); verticalLayout_idea1.addComponent(label_idea1); verticalLayout_idea1.setComponentAlignment(label_idea1, new Alignment(48)); // root_button1 root_button1 = new NativeButton(); root_button1.setCaption( "Project Gutenbergs The Time Machine by H. G. Herbert George Wells This eBook is for the use of anyone anywhere at no cost and with almost no "); root_button1.setImmediate(true); root_button1.setWidth("399px"); root_button1.setHeight("134px"); verticalLayout_idea1.addComponent(root_button1); return verticalLayout_idea1; }
From source file:com.example.mmowgli_2_0.RootCards.java
@AutoGenerated private VerticalLayout buildVerticalLayout_idea2() { // common part: create layout verticalLayout_idea2 = new VerticalLayout(); verticalLayout_idea2.setImmediate(false); verticalLayout_idea2.setWidth("-1px"); verticalLayout_idea2.setHeight("-1px"); verticalLayout_idea2.setMargin(false); // label_idea2 label_idea2 = new Label(); label_idea2.setImmediate(false);/*w w w. j a va 2 s. com*/ label_idea2.setWidth("-1px"); label_idea2.setHeight("-1px"); label_idea2.setValue("Idea 2"); verticalLayout_idea2.addComponent(label_idea2); verticalLayout_idea2.setComponentAlignment(label_idea2, new Alignment(20)); // root_button2 root_button2 = new NativeButton(); root_button2.setCaption( "restrictions whatsoever. You may copy it give it away or reuse it under the terms of the Project Gutenberg License included with this eBook or on"); root_button2.setImmediate(true); root_button2.setWidth("399px"); root_button2.setHeight("134px"); verticalLayout_idea2.addComponent(root_button2); return verticalLayout_idea2; }
From source file:com.foc.vaadin.gui.components.objectSelectorPopupView.FVObjectSelectorWindow.java
License:Apache License
private NativeButton getAddNewValueButton() { if (addValueButton == null) { addValueButton = new NativeButton(); addValueButton.setIcon(FVIconFactory.getInstance().getFVIcon_24(FVIconFactory.ICON_ADD)); addValueButton.addClickListener(new ClickListener() { @Override/* w w w. j a v a 2 s. co m*/ public void buttonClick(ClickEvent event) { if (getObjectSelector() != null && getObjectSelector().getComboBox() != null) { getObjectSelector().getComboBox() .setiObjectSelectWindowListener(FVObjectSelectorWindow.this); getObjectSelector().getComboBox().addNewObject(); } } }); } return addValueButton; }
From source file:com.logicbomb.newschool.MyAppWidgetSet.core.HourWidget.java
public HourWidget(int aHourNumber, int aTotalHourNumber) { setWidth("500px"); setHeight("500px"); //setStyleName("backColorGrey"); String[] classes = { "VI", "VII", "VIII", "IX", "X" }; int index1 = new Random().nextInt(classes.length); String selectedClass = (classes[index1]); String[] sections = { "A", "B", "C", "D", "E" }; int index2 = new Random().nextInt(classes.length); String selectedSection = (sections[index2]); String[] content = { "Gravitation", "Lab", "Electricity", "Force", "Motion" }; int index3 = new Random().nextInt(classes.length); String selectedContent = (content[index3]); //Button b= new Button("2"); //addComponent(b); //c.setSizeFull(); Button iMinorText = new Button(selectedContent); double redOrGreen = Math.random(); if (Math.random() > 0.5) { iMinorText.setStyleName("v-button-type1-red"); } else {//from w w w. ja v a 2 s. c om iMinorText.setStyleName("v-button-type1-green"); } iMinorText.setHeight("40px"); iMinorText.setWidth("125px"); //c.setCaptionAsHtml(true); kkk addComponent(iMinorText);//,"top:10px;left:10px"); Label iMajorText = new Label(selectedClass + " - " + selectedSection); iMajorText.setStyleName("v-label-type1"); iMajorText.setHeight("15px"); iMajorText.setWidth("50px"); addComponent(iMajorText, "top:2px;left:1px"); double numberOfMemos = Math.floor(Math.random() * 5); //Diplay if any memo present NativeButton memoButton; if (numberOfMemos > 0) { memoButton = new NativeButton();//String.valueOf(numberOfMemos).replace(".0", "")); memoButton.setStyleName("v-button-type2"); //memoButton.setHeight("15px"); //memoButton.setWidth("30px"); memoButton.setIcon(FontAwesome.PENCIL); addComponent(memoButton, "top:2px;left:85px"); } double numberOfNotifications = Math.floor(Math.random() * 5); NativeButton notificationButton; if (numberOfNotifications > 0) { notificationButton = new NativeButton();//String.valueOf(numberOfNotifications).replace(".0", "")); notificationButton.setStyleName("v-button-type2"); //notificationButton.setHeight("15px"); //notificationButton.setWidth("30px"); notificationButton.setIcon(FontAwesome.BELL); addComponent(notificationButton, "top:2px;left:100px"); } }
From source file:com.neatresults.mgnltweaks.ui.column.ColumnFormatterUtils.java
License:Open Source License
private static Button createButton(final String title, final String appName, final String subAppName, final String path, final Object itemId, final String rootPath, EventBus adminEventBus, EventBus eventBus, NeatTweaks4DevelopersModule module) { Button selectButton = new NativeButton(); selectButton.addStyleName("neatmagnoliabutton"); selectButton.setCaption(title);/* ww w. j a v a 2 s . com*/ selectButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { String workPath = path; if (StringUtils.isNotBlank(rootPath) && !"/".equals(rootPath)) { workPath = StringUtils.removeStart(workPath, rootPath); } if ("browser".equals(subAppName)) { Location location = new BrowserLocation(appName, subAppName, workPath + ":treeview:"); adminEventBus.fireEvent(new LocationChangedEvent(location)); } else { // open app (subapp) Location location = new RerootBrowserLocation(appName, subAppName, workPath, module.isShowSubtreeOnlyInHelper()); adminEventBus.fireEvent(new LocationChangedEvent(location)); // expand selected node try { ContentChangedEvent cce = new ContentChangedEvent( JcrItemUtil.getItemId(RepositoryConstants.CONFIG, path), true); eventBus.fireEvent(cce); } catch (RepositoryException e) { log.error( "Ooops, failed to retrieve node at path {} and open it while trying to open definition with {}", path, e.getMessage(), e); } } } }); return selectButton; }
From source file:com.skysql.manager.ui.components.SystemLayout.java
License:Open Source License
/** * Instantiates a new system layout.//w ww . jav a2 s . c om * * @param systemRecord the system record */ public SystemLayout(SystemRecord systemRecord) { addStyleName("systemLayout"); setWidth(Sizeable.SIZE_UNDEFINED, Sizeable.Unit.PERCENTAGE); setMargin(new MarginInfo(false, true, false, false)); final HorizontalLayout systemHeader = new HorizontalLayout(); systemHeader.addStyleName("panelHeaderLayout"); systemHeader.setSpacing(true); systemHeader.setWidth("100%"); systemHeader.setHeight("23px"); addComponent(systemHeader); backButton = new NativeButton(); backButton.setStyleName("backButton"); backButton.setDescription("Back to Systems"); systemHeader.addComponent(backButton); backButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { VaadinSession session = getSession(); SystemInfo systemInfo = session.getAttribute(SystemInfo.class); OverviewPanel overviewPanel = session.getAttribute(OverviewPanel.class); ComponentButton button = systemInfo.getCurrentSystem().getButton(); String parentID = systemInfo.getCurrentSystem().getParentID(); systemInfo.setCurrentSystem(parentID); session.setAttribute(SystemInfo.class, systemInfo); ManagerUI.log("new systemID: " + parentID); overviewPanel.clickLayout(button, false); overviewPanel.refresh(); } }); final Label systemLabel = new Label("Systems"); systemLabel.setSizeUndefined(); systemHeader.addComponent(systemLabel); systemHeader.setComponentAlignment(systemLabel, Alignment.MIDDLE_LEFT); systemHeader.setExpandRatio(systemLabel, 1.0f); systemSlot = new HorizontalLayout(); addComponent(systemSlot); // initialize System button refresh(null, null); }
From source file:com.skysql.manager.ui.PanelInfo.java
License:Open Source License
/** * Creates the charts layout./*from ww w. j av a 2 s . co m*/ */ private void createChartsLayout() { chartsLayout = new VerticalLayout(); chartsLayout.addStyleName("chartsLayout"); chartsLayout.setHeight("100%"); chartsLayout.setSpacing(true); addComponent(chartsLayout); final HorizontalLayout chartsHeaderLayout = new HorizontalLayout(); chartsHeaderLayout.setStyleName("panelHeaderLayout"); chartsHeaderLayout.setWidth("100%"); chartsHeaderLayout.setSpacing(true); chartsHeaderLayout.setMargin(new MarginInfo(false, true, false, true)); chartsLayout.addComponent(chartsHeaderLayout); chartControls = new ChartControls(); chartControls.addIntervalSelectionListener(chartIntervalListener); chartControls.addThemeSelectionListener(chartThemeListener); chartsHeaderLayout.addComponent(chartControls); chartsHeaderLayout.setComponentAlignment(chartControls, Alignment.MIDDLE_LEFT); final HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSpacing(true); chartsHeaderLayout.addComponent(buttonsLayout); chartsHeaderLayout.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_RIGHT); SettingsDialog settingsDialog = new SettingsDialog("Edit Monitors...", "Monitors"); final Button editMonitorsButton = settingsDialog.getButton(); editMonitorsButton.setVisible(false); buttonsLayout.addComponent(editMonitorsButton); final Button addChartButton = new Button("Add Chart..."); addChartButton.setVisible(false); buttonsLayout.addComponent(addChartButton); addChartButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { new ChartsDialog(chartsArrayLayout, null); } }); final Button editButton = new Button("Edit"); editButton.setDescription("Enter Editing mode"); final Button saveButton = new Button("Done"); saveButton.setDescription("Exit Editing mode"); buttonsLayout.addComponent(editButton); editButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { buttonsLayout.replaceComponent(editButton, saveButton); chartsArrayLayout.setDragMode(LayoutDragMode.CLONE); chartsArrayLayout.setEditable(true); chartsHeaderLayout.setStyleName("panelHeaderLayout-editable"); editMonitorsButton.setVisible(true); addChartButton.setVisible(true); OverviewPanel overviewPanel = getSession().getAttribute(OverviewPanel.class); overviewPanel.setEnabled(false); } }); saveButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { buttonsLayout.replaceComponent(saveButton, editButton); chartsArrayLayout.setDragMode(LayoutDragMode.NONE); chartsArrayLayout.setEditable(false); chartsHeaderLayout.setStyleName("panelHeaderLayout"); editMonitorsButton.setVisible(false); addChartButton.setVisible(false); OverviewPanel overviewPanel = getSession().getAttribute(OverviewPanel.class); overviewPanel.setEnabled(true); refresh(); } }); final Button expandButton = new NativeButton(); expandButton.setStyleName("expandButton"); expandButton.setDescription("Expand/Reduce viewing area"); buttonsLayout.addComponent(expandButton); buttonsLayout.setComponentAlignment(expandButton, Alignment.MIDDLE_CENTER); expandButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { isExpanded = !isExpanded; AnimatorProxy proxy = getSession().getAttribute(AnimatorProxy.class); proxy.addListener(new AnimationListener() { public void onAnimation(AnimationEvent event) { Component component = event.getComponent(); component.setVisible(isExpanded ? false : true); } }); // OverviewPanel overviewPanel = getSession().getAttribute(OverviewPanel.class); // if (!isExpanded) { // overviewPanel.setVisible(isExpanded ? false : true); // } // proxy.animate(overviewPanel, isExpanded ? AnimType.ROLL_UP_CLOSE : AnimType.ROLL_DOWN_OPEN).setDuration(500).setDelay(100); // // TopPanel topPanel = getSession().getAttribute(TopPanel.class); // if (!isExpanded) { // topPanel.setVisible(isExpanded ? false : true); // } // proxy.animate(topPanel, isExpanded ? AnimType.ROLL_UP_CLOSE : AnimType.ROLL_DOWN_OPEN).setDuration(500).setDelay(100); VerticalLayout topMid = getSession().getAttribute(VerticalLayout.class); if (!isExpanded) { topMid.setVisible(isExpanded ? false : true); } proxy.animate(topMid, isExpanded ? AnimType.ROLL_UP_CLOSE : AnimType.ROLL_DOWN_OPEN) .setDuration(500).setDelay(100); expandButton.setStyleName(isExpanded ? "contractButton" : "expandButton"); } }); chartsPanel = new Panel(); chartsPanel.setSizeFull(); chartsPanel.addStyleName(Runo.PANEL_LIGHT); chartsLayout.addComponent(chartsPanel); chartsLayout.setExpandRatio(chartsPanel, 1.0f); }
From source file:edu.kit.dama.ui.admin.utils.PathSelector.java
License:Apache License
/** * *///from w w w.j a v a2s .c om private void buildSelectButton() { String id = "selectButton"; LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ..."); selectButton = new NativeButton(); selectButton.setId(DEBUG_ID_PREFIX + id); selectButton.setImmediate(true); selectButton.setIcon(new ThemeResource(IconContainer.FOLDER_OK)); selectButton.setStyleName(BaseTheme.BUTTON_LINK); selectButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { String path = (String) getPathField().getValue(); if (path != null) { path = path.trim(); } iPathSelector.firePathSelectorCloseEvent(path); close(); } }); }
From source file:edu.kit.dama.ui.commons.util.PaginationLayout.java
License:Apache License
/** * Update the layout. This method is either called internally when scrolling * or/*from ww w . j a v a 2 s . c o m*/ */ public final void update() { //remove all components (old result page and navigation) removeAllComponents(); //add current results renderPage(); //build pagination int pages = overallEntries / entriesPerPage; if (overallEntries % entriesPerPage > 0) { pages++; } final int overallPages = pages; HorizontalLayout navigation = new HorizontalLayout(); //add "JumpToFirstPage" button final NativeButton first = new NativeButton(); first.setIcon(firstIcon); if (firstIcon == null) { first.setCaption("<<"); } first.setDescription("First Page"); first.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { currentPage = 0; update(); } }); //add "PreviousPage" button final NativeButton prev = new NativeButton(); prev.setIcon(prevIcon); if (prevIcon == null) { prev.setCaption("<"); } prev.setDescription("Previous Page"); prev.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (currentPage > 0) { currentPage--; update(); } } }); //add "NextPage" button final NativeButton next = new NativeButton(); next.setIcon(nextIcon); if (nextIcon == null) { next.setCaption(">"); } next.setDescription("Next Page"); next.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (currentPage + 1 < overallPages) { currentPage++; update(); } } }); //add "JumpToLastPage" button final NativeButton last = new NativeButton(); last.setIcon(endIcon); if (endIcon == null) { next.setCaption(">>"); } last.setDescription("Last Page"); last.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { currentPage = overallPages - 1; update(); } }); //enable/disable buttons depending on the current page if (overallPages == 0) { first.setEnabled(false); prev.setEnabled(false); next.setEnabled(false); last.setEnabled(false); } else { first.setEnabled(!(currentPage == 0) || !(overallPages < 2)); prev.setEnabled(!(currentPage == 0) || !(overallPages < 2)); next.setEnabled(!(currentPage == overallPages - 1) || !(overallPages < 2)); last.setEnabled(!(currentPage == overallPages - 1) || !(overallPages < 2)); } //at first, put the page size selection box into the navigation final ComboBox entriesPerPageBox = new ComboBox(); entriesPerPageBox.setItemCaptionPropertyId("name"); entriesPerPageBox.addContainerProperty("name", String.class, null); entriesPerPageBox.addItem(5); entriesPerPageBox.getContainerProperty(5, "name").setValue("5 Entries / Page"); entriesPerPageBox.addItem(10); entriesPerPageBox.getContainerProperty(10, "name").setValue("10 Entries / Page"); entriesPerPageBox.addItem(15); entriesPerPageBox.getContainerProperty(15, "name").setValue("15 Entries / Page"); entriesPerPageBox.addItem(20); entriesPerPageBox.getContainerProperty(20, "name").setValue("20 Entries / Page"); entriesPerPageBox.setValue(entriesPerPage); entriesPerPageBox.setNullSelectionAllowed(false); entriesPerPageBox.setImmediate(true); entriesPerPageBox.addListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { entriesPerPage = (Integer) entriesPerPageBox.getValue(); update(); } }); navigation.addComponent(entriesPerPageBox); //filler labels are added to the beginning and to the end to keep the navigation in the middle Label leftFiller = new Label(); leftFiller.setWidth("25px"); navigation.addComponent(leftFiller); navigation.addComponent(first); navigation.addComponent(prev); //Show max. 10 pages at once for performance and layout reasons. //If there are more than 10 pages, "move" the to show 10 pages based on the current page. int start = currentPage - 5; start = (start < 0) ? 0 : start; int end = start + 10; end = (end > pages) ? pages : end; if (end - start < 10 && pages > 10) { start = end - 10; } if (overallPages == 0) { Label noEntryLabel = new Label("<i>No entries</i>", Label.CONTENT_XHTML); //noEntryLabel.setWidth("80px"); noEntryLabel.setSizeUndefined(); navigation.addComponent(noEntryLabel); navigation.setComponentAlignment(noEntryLabel, Alignment.MIDDLE_CENTER); } //build the actual page entries for (int i = start; i < end; i++) { if (i == currentPage) { //the current page is marked with a special style Label pageLink = new Label("<b>" + Integer.toString(i + 1) + "</b>", Label.CONTENT_XHTML); pageLink.setStyleName("currentpage"); pageLink.setWidth("15px"); navigation.addComponent(pageLink); navigation.setComponentAlignment(pageLink, Alignment.MIDDLE_CENTER); } else { //otherwise normal links are added, click-events are handled via LayoutClickListener Link pageLink = new Link(Integer.toString(i + 1), null); navigation.addComponent(pageLink); navigation.setComponentAlignment(pageLink, Alignment.MIDDLE_CENTER); } } //add right navigation buttons navigation.addComponent(next); navigation.addComponent(last); //...and fill the remaining space Label rightFiller = new Label(); navigation.addComponent(rightFiller); // navigation.setExpandRatio(leftFiller, 1.0f); navigation.setExpandRatio(rightFiller, 1.0f); navigation.setSpacing(true); //put everything ot the middle navigation.setComponentAlignment(first, Alignment.MIDDLE_CENTER); navigation.setComponentAlignment(prev, Alignment.MIDDLE_CENTER); navigation.setComponentAlignment(next, Alignment.MIDDLE_CENTER); navigation.setComponentAlignment(last, Alignment.MIDDLE_CENTER); //add layout click listener to be able to navigate by clicking the single pages navigation.addListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { // Get the child component which was clicked Component child = event.getChildComponent(); if (child == null) { // Not over any child component } else { // Over a child component if (child instanceof Link) { // Over a valid child element currentPage = Integer.parseInt(((Link) child).getCaption()) - 1; update(); } } } }); //finalize navigation.setWidth("100%"); navigation.setHeight("25px"); //add navigation and align it right below the result page addComponent(page); setExpandRatio(page, 1f); if (overallEntries > 0) { addComponent(navigation); setComponentAlignment(navigation, Alignment.BOTTOM_CENTER); setExpandRatio(navigation, .05f); } requestRepaint(); }