List of usage examples for com.vaadin.server ThemeResource ThemeResource
public ThemeResource(String resourceId)
From source file:com.anphat.list.ui.DialogAddMapStaffCustomer.java
public void initDialog(boolean isCustInfo) { buildInfoLayout(isCustInfo);/*from www .j a v a 2 s . c o m*/ mainLayout.addComponent(infoLayout); // searchLayout buildSearchLayout(isCustInfo); mainLayout.addComponent(searchLayout); // btnSearch btnSearch = new Button(); btnSearch.setCaption(BundleUtils.getString("common.button.search")); btnSearch.setIcon(new ThemeResource(Constants.ICON.SEARCH)); btnSearch.setImmediate(true); btnSearch.setWidth("-1px"); btnSearch.setHeight("-1px"); mainLayout.addComponent(btnSearch); mainLayout.setComponentAlignment(btnSearch, new Alignment(48)); buildMainLayout(); mainLayout.addComponent(horizontalLayout); //Nut luu va huy bo GridManyButton gridManyButton = new GridManyButton( new String[] { Constants.BUTTON_SAVE, Constants.BUTTON_CANCEL }); btnSave = gridManyButton.getBtnCommon().get(0); btnCancel = gridManyButton.getBtnCommon().get(1); mainLayout.addComponent(gridManyButton); }
From source file:com.anphat.list.ui.DialogAddMapStaffCustomer.java
private void buildCenterLayout() { // common part: create layout centerLayout = new VerticalLayout(); centerLayout.setImmediate(true);//from ww w. j a va2s . c om centerLayout.setWidth("30px"); centerLayout.setHeight("-1px"); centerLayout.setMargin(false); // btnAdd btnAdd = new Button(); btnAdd.setIcon(new ThemeResource(Constants.ICON.FORWARD)); btnAdd.setImmediate(true); btnAdd.setWidth("-1px"); btnAdd.setHeight("-1px"); centerLayout.addComponent(btnAdd); centerLayout.setComponentAlignment(btnAdd, new Alignment(48)); }
From source file:com.anphat.list.ui.DialogCreateDepartment.java
@AutoGenerated private HorizontalLayout buildHorizontalLayoutButton() { // common part: create layout horizontalLayoutButton = new HorizontalLayout(); horizontalLayoutButton.setImmediate(true); horizontalLayoutButton.setWidth("100.0%"); horizontalLayoutButton.setHeight("-1px"); horizontalLayoutButton.setMargin(true); horizontalLayoutButton.setSpacing(true); // btnSave//from w w w .ja v a 2 s . com btnSave = new Button(); btnSave.setCaption(BundleUtils.getString("common.button.save")); btnSave.setImmediate(true); btnSave.setWidth("-1px"); btnSave.setHeight("-1px"); btnSave.setIcon(new ThemeResource("img/save_icon.png")); horizontalLayoutButton.addComponent(btnSave); horizontalLayoutButton.setComponentAlignment(btnSave, new Alignment(34)); // btnCancel btnCancel = new Button(); btnCancel.setCaption(BundleUtils.getString("common.button.cancel")); btnCancel.setImmediate(true); btnCancel.setWidth("-1px"); btnCancel.setHeight("-1px"); btnCancel.setIcon(new ThemeResource("img/cancel_icon.png")); horizontalLayoutButton.addComponent(btnCancel); horizontalLayoutButton.setComponentAlignment(btnCancel, new Alignment(33)); return horizontalLayoutButton; }
From source file:com.anphat.list.ui.DialogCreateStaff.java
@AutoGenerated private HorizontalLayout buildHorizontalLayoutButton() { // common part: create layout horizontalLayoutButton = new HorizontalLayout(); horizontalLayoutButton.setImmediate(false); horizontalLayoutButton.setWidth("100.0%"); horizontalLayoutButton.setHeight("-1px"); horizontalLayoutButton.setMargin(true); horizontalLayoutButton.setSpacing(true); // btnSave//w w w . jav a 2 s. c o m btnSave = new Button(); btnSave.setCaption(BundleUtils.getString("common.button.save")); btnSave.setImmediate(true); btnSave.setWidth("-1px"); btnSave.setHeight("-1px"); btnSave.setIcon(new ThemeResource(Constants.ICON.SAVE)); horizontalLayoutButton.addComponent(btnSave); horizontalLayoutButton.setComponentAlignment(btnSave, new Alignment(34)); // btnCancel btnCancel = new Button(); btnCancel.setCaption(BundleUtils.getString("common.button.cancel")); btnCancel.setImmediate(true); btnCancel.setWidth("-1px"); btnCancel.setHeight("-1px"); btnCancel.setIcon(new ThemeResource(Constants.ICON.CANCEL)); horizontalLayoutButton.addComponent(btnCancel); horizontalLayoutButton.setComponentAlignment(btnCancel, new Alignment(33)); return horizontalLayoutButton; }
From source file:com.cavisson.gui.dashboard.components.controls.ComboBoxes.java
License:Apache License
public ComboBoxes() { setMargin(true);/* ww w .j av a 2s. c om*/ Label h1 = new Label("Combo Boxes"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); ComboBox combo = new ComboBox("Normal"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setNullSelectionAllowed(false); combo.select(combo.getItemIds().iterator().next()); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.setItemIcon(combo.getItemIds().iterator().next(), new ThemeResource("../runo/icons/16/document.png")); row.addComponent(combo); CssLayout group = new CssLayout(); group.setCaption("Grouped with a Button"); group.addStyleName("v-component-group"); row.addComponent(group); combo = new ComboBox(); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setNullSelectionAllowed(false); combo.select(combo.getItemIds().iterator().next()); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.setWidth("240px"); group.addComponent(combo); Button today = new Button("Do It"); group.addComponent(today); combo = new ComboBox("Explicit size"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setWidth("260px"); combo.setHeight("60px"); row.addComponent(combo); combo = new ComboBox("No text input allowed"); combo.setInputPrompt("You can click here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setTextInputAllowed(false); combo.setNullSelectionAllowed(false); combo.select("Option One"); row.addComponent(combo); combo = new ComboBox("Error"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setNullSelectionAllowed(false); combo.select("Option One"); combo.setComponentError(new UserError("Fix it, now!")); row.addComponent(combo); combo = new ComboBox("Error, borderless"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setNullSelectionAllowed(false); combo.select("Option One"); combo.setComponentError(new UserError("Fix it, now!")); combo.addStyleName("borderless"); row.addComponent(combo); combo = new ComboBox("Disabled"); combo.setInputPrompt("You can't type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setEnabled(false); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("color1"); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("color2"); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("color3"); row.addComponent(combo); combo = new ComboBox("Small"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("small"); row.addComponent(combo); combo = new ComboBox("Large"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("large"); row.addComponent(combo); combo = new ComboBox("Borderless"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.addStyleName("borderless"); row.addComponent(combo); combo = new ComboBox("Tiny"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("tiny"); row.addComponent(combo); combo = new ComboBox("Huge"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("huge"); row.addComponent(combo); }
From source file:com.cavisson.gui.dashboard.components.controls.Dragging.java
License:Apache License
private List<Component> createComponents() { final List<Component> components = new ArrayList<Component>(); final Label label = new Label("This is a long text block that will wrap."); label.setWidth("120px"); components.add(label);/*from w ww . ja va2 s. co m*/ final Embedded image = new Embedded("", new ThemeResource("../runo/icons/64/document.png")); components.add(image); final CssLayout documentLayout = new CssLayout(); documentLayout.setWidth("19px"); for (int i = 0; i < 5; ++i) { final Embedded e = new Embedded(null, new ThemeResource("../runo/icons/16/document.png")); e.setHeight("16px"); e.setWidth("16px"); documentLayout.addComponent(e); } components.add(documentLayout); final VerticalLayout buttonLayout = new VerticalLayout(); final Button button = new Button("Button"); button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { Notification.show("Button clicked"); } }); buttonLayout.addComponent(button); buttonLayout.setComponentAlignment(button, Alignment.MIDDLE_CENTER); components.add(buttonLayout); return components; }
From source file:com.cavisson.gui.dashboard.components.controls.ValoThemeUI.java
License:Apache License
CssLayout buildMenu() { // Add items/*from www .ja va 2 s. co m*/ menuItems.put("common", "Common UI Elements"); menuItems.put("labels", "Labels"); menuItems.put("buttons-and-links", "Buttons & Links"); menuItems.put("textfields", "Text Fields"); menuItems.put("datefields", "Date Fields"); menuItems.put("comboboxes", "Combo Boxes"); menuItems.put("selects", "Selects"); menuItems.put("checkboxes", "Check Boxes & Option Groups"); menuItems.put("sliders", "Sliders & Progress Bars"); menuItems.put("colorpickers", "Color Pickers"); menuItems.put("menubars", "Menu Bars"); menuItems.put("trees", "Trees"); menuItems.put("tables", "Tables"); menuItems.put("dragging", "Drag and Drop"); menuItems.put("panels", "Panels"); menuItems.put("splitpanels", "Split Panels"); menuItems.put("tabs", "Tabs"); menuItems.put("accordions", "Accordions"); menuItems.put("popupviews", "Popup Views"); // menuItems.put("calendar", "Calendar"); menuItems.put("forms", "Forms"); final HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName("valo-menu-title"); menu.addComponent(top); menu.addComponent(createThemeSelect()); final Button showMenu = new Button("Menu", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { if (menu.getStyleName().contains("valo-menu-visible")) { menu.removeStyleName("valo-menu-visible"); } else { menu.addStyleName("valo-menu-visible"); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName("valo-menu-toggle"); showMenu.setIcon(FontAwesome.LIST); menu.addComponent(showMenu); final Label title = new Label("<h3>Vaadin <strong>Valo Theme</strong></h3>", ContentMode.HTML); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); final StringGenerator sg = new StringGenerator(); final MenuItem settingsItem = settings.addItem( sg.nextString(true) + " " + sg.nextString(true) + sg.nextString(false), new ThemeResource("../tests-valo/img/profile-pic-300px.jpg"), null); settingsItem.addItem("Edit Profile", null); settingsItem.addItem("Preferences", null); settingsItem.addSeparator(); settingsItem.addItem("Sign Out", null); menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); Label label = null; int count = -1; for (final Entry<String, String> item : menuItems.entrySet()) { if (item.getKey().equals("labels")) { label = new Label("Components", ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } if (item.getKey().equals("panels")) { label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>"); count = 0; label = new Label("Containers", ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } if (item.getKey().equals("forms")) { label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>"); count = 0; label = new Label("Other", ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } final Button b = new Button(item.getValue(), new ClickListener() { @Override public void buttonClick(final ClickEvent event) { navigator.navigateTo(item.getKey()); } }); if (count == 2) { b.setCaption(b.getCaption() + " <span class=\"valo-menu-badge\">123</span>"); } b.setHtmlContentAllowed(true); b.setPrimaryStyleName("valo-menu-item"); b.setIcon(testIcon.get()); menuItemsLayout.addComponent(b); count++; } label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>"); return menu; }
From source file:com.cms.view.ExportContractFromTaxCode.java
private void buildGridButton() { GridManyButton gridManyButton = new GridManyButton(new String[] { Constants.BUTTON_SAVE, Constants.BUTTON_EXPORT, Constants.BUTTON_DETAIL, Constants.BUTTON_DEFAULT }); btnSave = gridManyButton.getBtnCommon().get(0); btnCreateDoc = gridManyButton.getBtnCommon().get(1); btnCreateDoc.setCaption(BundleUtils.getString("common.button.export.word")); btnCreateDoc.setIcon(new ThemeResource(Constants.ICON.DOCX)); btnCreateDoc.setEnabled(false);//from w ww . ja va 2 s .co m btnEmail = gridManyButton.getBtnCommon().get(2); btnEmail.setCaption(BundleUtils.getString("common.button.email")); btnEmail.setIcon(FontAwesome.MAIL_FORWARD); btnExportExcel = gridManyButton.getBtnCommon().get(3); btnExportExcel.setCaption(BundleUtils.getString("common.button.exportFile")); btnExportExcel.setIcon(new ThemeResource(Constants.ICON.EXPORT_EXCEL)); // btnClose = gridManyButton.getBtnCommon().get(4); layoutMain.addComponent(gridManyButton); }
From source file:com.cms.view.ListStaffDepartment.java
public ListStaffDepartment() { super(BundleUtils.getString("caption.title.listDept"), BundleUtils.getString("caption.title.listEmp")); mainLayout.setSplitPosition(30, Unit.PERCENTAGE); setCompositionRoot(mainLayout);//from w w w. java2 s. c om //khoi tao cac thanh phan //khoi tao form search searchDepartmentForm = new DepartmentSearchPanel(); //khoi tao table ui tblListDepartmentUI = new CommonTableFilterPanel(); //100316 NgocND6 chuyen quyen quan ly hang hoa btnTransferRoleCusts = new Button(TRANSFERROLE); btnTransferRoleCusts.setIcon(new ThemeResource("img/transfer_icon.png")); //them cac component vao layout GridLayout horizontalLayout = new GridLayout(2, 1); horizontalLayout.setWidth("-1px"); horizontalLayout.setMargin(true); horizontalLayout.setSpacing(true); //btn search btnSearchDept = new Button(Constants.BUTTON_SEARCH); btnSearchDept.setIcon(new ThemeResource(Constants.ICON.SEARCH)); horizontalLayout.addComponent(btnSearchDept, 0, 0); //btn refresh btnRefreshDept = new Button(Constants.BUTTON_REFRESH); btnRefreshDept.setIcon(new ThemeResource(Constants.ICON.RESET)); horizontalLayout.addComponent(btnRefreshDept, 1, 0); //add component leftLayout.addComponent(searchDepartmentForm); leftLayout.addComponent(horizontalLayout); leftLayout.addComponent(tblListDepartmentUI); leftLayout.setComponentAlignment(horizontalLayout, Alignment.MIDDLE_CENTER); leftLayout.setMargin(true); //===============right========================== searchStaffForm = new StaffSearchPanel(); //khoi tao table ui tblListStaffUI = new CommonTableFilterPanel(); btnAddMapStaffCustomer = new Button(BundleUtils.getString("staff.customer.map")); btnAddMapStaffCustomer.setDescription(BundleUtils.getString("staff.customer.map")); btnAddMapStaffCustomer.setIcon(new ThemeResource(Constants.ICON.IMPORT)); btnAssignRole = new Button(BundleUtils.getString("assign.roles.button")); btnAssignRole.setIcon(FontAwesome.ANCHOR); //them cac component vao layout GridLayout horizontalLayout2 = new GridLayout(3, 1); horizontalLayout2.setWidth("-1px"); horizontalLayout2.setMargin(true); horizontalLayout2.setSpacing(true); //NgocND6 tao layout de add button chuyen quyen cho nhan vien GridLayout gridLayout = new GridLayout(3, 1); gridLayout.setMargin(true); gridLayout.setSpacing(true); gridLayout.addComponent(btnAssignRole, 0, 0); // gridLayout.addComponent(btnAddMapStaffCustomer, 1, 0); gridLayout.addComponent(btnTransferRoleCusts, 2, 0); //Tam thoi an nut phan bo lai khach hang btnTransferRoleCusts.setVisible(false); //btn search emp btnSearchEmp = new Button(Constants.BUTTON_SEARCH); btnSearchEmp.setIcon(new ThemeResource(Constants.ICON.SEARCH)); horizontalLayout2.addComponent(btnSearchEmp, 0, 0); //btn refresh emp btnRefreshEmp = new Button(Constants.BUTTON_REFRESH); btnRefreshEmp.setIcon(new ThemeResource(Constants.ICON.RESET)); horizontalLayout2.addComponent(btnRefreshEmp, 1, 0); // //add component rightLayout.addComponent(searchStaffForm); rightLayout.addComponent(horizontalLayout2); rightLayout.addComponent(tblListStaffUI); rightLayout.setComponentAlignment(horizontalLayout2, Alignment.MIDDLE_CENTER); rightLayout.addComponent(gridLayout); rightLayout.setComponentAlignment(gridLayout, Alignment.MIDDLE_CENTER); rightLayout.setMargin(true); //============= this.listDeptAndStaffController = new ListDeptAndStaffController(this); }
From source file:com.constellio.app.ui.pages.base.MainLayoutImpl.java
protected void buildInitJavascript() { JavaScript.getCurrent().addFunction("constellio_easter_egg_code", new JavaScriptFunction() { @Override/*from ww w.j a va 2 s . c o m*/ public void call(JsonArray arguments) { ((ConstellioMenuImpl) mainMenu).getUserSettingsItem() .setIcon(new ThemeResource("images/profiles/egg.jpg")); } }); }