List of usage examples for com.vaadin.ui HorizontalLayout setDefaultComponentAlignment
@Override public void setDefaultComponentAlignment(Alignment defaultAlignment)
From source file:info.magnolia.configuration.app.overview.toolbar.ToolbarViewImpl.java
License:Open Source License
private Component decorateComponent(String caption, Component toWrap) { final HorizontalLayout result = new HorizontalLayout(); result.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); result.setSpacing(true);//w w w.jav a 2 s .c o m result.setSizeUndefined(); final Label captionLabel = new Label(caption); captionLabel.setSizeUndefined(); captionLabel.addStyleName("caption-label"); result.addComponent(captionLabel); result.addComponent(toWrap); return result; }
From source file:io.mateu.ui.vaadin.framework.MyUI.java
License:Apache License
/** * construye el menu//from w ww . ja v a2 s.co m * * @param request * @return */ CssLayout buildMenu(VaadinRequest request) { HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName(ValoTheme.MENU_TITLE); menu.addComponent(top); //menu.addComponent(createThemeSelect()); Button showMenu = new Button("Menu", new ClickListener() { @Override public void buttonClick(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); //Label title = new Label("<h3><strong>" + getApp().getName() + "</strong></h3>", ContentMode.HTML); Button title = new Button(getApp().getName(), new ClickListener() { @Override public void buttonClick(ClickEvent event) { Page.getCurrent().open("#!", (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName()); } }); title.addStyleName(ValoTheme.BUTTON_LINK); title.addStyleName("tituloapp"); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); settings = new MenuBar(); settings.addStyleName("user-menu"); settings.addStyleName("mi-user-menu"); menu.addComponent(settings); HorizontalLayout navlinks = new HorizontalLayout(); navlinks.setSpacing(true); { Button nav = new Button(VaadinIcons.ARROWS_CROSS, new ClickListener() { @Override public void buttonClick(ClickEvent event) { Page.getCurrent().open("#!nav", (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName()); } }); nav.addStyleName(ValoTheme.BUTTON_LINK); nav.setDescription("Search inside menu"); nav.addStyleName("navlink"); navlinks.addComponent(nav); } if (MateuUI.getApp().isFavouritesAvailable()) { Button nav = new Button(VaadinIcons.USER_STAR, new ClickListener() { @Override public void buttonClick(ClickEvent event) { Page.getCurrent().open("#!favourites", (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName()); } }); nav.addStyleName(ValoTheme.BUTTON_LINK); nav.addStyleName("navlink"); nav.setDescription("My favourites"); nav.setVisible(MateuUI.getApp().getUserData() != null); linkFavoritos = nav; navlinks.addComponent(nav); } if (MateuUI.getApp().isLastEditedAvailable()) { Button nav = new Button(VaadinIcons.RECORDS, new ClickListener() { @Override public void buttonClick(ClickEvent event) { Page.getCurrent().open("#!lastedited", (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName()); } }); nav.addStyleName(ValoTheme.BUTTON_LINK); nav.addStyleName("navlink"); nav.setDescription("Last edited records"); nav.setVisible(MateuUI.getApp().getUserData() != null); linkUltimosRegistros = nav; navlinks.addComponent(nav); } HorizontalLayout aux = new HorizontalLayout(navlinks); aux.setSpacing(false); aux.addStyleName("contenedoriconosnav"); menu.addComponent(aux); if (MateuUI.getApp().isFavouritesAvailable()) { aux = new HorizontalLayout(); { Button nav = new Button(VaadinIcons.STAR, new ClickListener() { @Override public void buttonClick(ClickEvent event) { System.out.println(Page.getCurrent().getUriFragment()); System.out.println(Page.getCurrent().getLocation()); } }); nav.addStyleName(ValoTheme.BUTTON_LINK); nav.addStyleName("navlink"); nav.setDescription("Add current page to my favourites"); nav.setVisible(MateuUI.getApp().getUserData() != null); linkNuevoFavorito = nav; aux.addComponent(nav); } aux.setSpacing(false); aux.addStyleName("contenedoriconosnav"); menu.addComponent(aux); } menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); refreshMenu(null, null); return menu; }
From source file:lv.polarisit.demosidemenu.ValoThemeUI.java
License:Apache License
CssLayout buildMenu() { // Add items//from www .j av a2 s.c o m menuItems.put("MessageView", "First Message"); menuItems.put("MessageView1", "Second Message"); /* 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++; } if (label != null) label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>"); return menu; }
From source file:me.uni.emuseo.view.menu.MenuView.java
License:Open Source License
private CssLayout buildMenu() { // Add items/*from ww w. j av a 2 s . co m*/ if (authManager.isAuthorizedTo(Permissions.MENU_USERS_VIEW)) { menuItems.put(Permissions.MENU_USERS_VIEW, "Uytkownicy"); } if (authManager.isAuthorizedTo(Permissions.MENU_EXHIBIT_VIEW)) { menuItems.put(Permissions.MENU_EXHIBIT_VIEW, "Katalog eksponatw"); } if (authManager.isAuthorizedTo(Permissions.MENU_CATEGORIES_VIEW)) { menuItems.put(Permissions.MENU_CATEGORIES_VIEW, "Kategorie"); } if (authManager.isAuthorizedTo(Permissions.MENU_RESOURCES_VIEW)) { menuItems.put(Permissions.MENU_RESOURCES_VIEW, "Zasoby"); } final HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName("valo-menu-title"); menu.addComponent(top); final Button showMenu = new Button("Menu", new ClickListener() { private static final long serialVersionUID = -719702284721453362L; @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>e<strong>Museo</strong></h3>", ContentMode.HTML); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); settingsItem = settings.addItem("Jan Kowalski", defaultIcon, null); if (authManager.isAuthorizedTo(Permissions.MENU_MY_ACCOUNT_VIEW)) { settingsItem.addItem("Moje konto", new MenuBar.Command() { private static final long serialVersionUID = 7015035735144235104L; @Override public void menuSelected(MenuItem selectedItem) { navigator.navigateTo(Permissions.MENU_MY_ACCOUNT_VIEW); } }); } if (authManager.isAuthorizedTo(Permissions.MENU_SETTINGS_VIEW)) { settingsItem.addItem("Ustawienia", new MenuBar.Command() { private static final long serialVersionUID = 7015035735144235105L; @Override public void menuSelected(MenuItem selectedItem) { navigator.navigateTo(Permissions.MENU_SETTINGS_VIEW); } }); } settingsItem.addSeparator(); settingsItem.addItem("Wyloguj", new MenuBar.Command() { private static final long serialVersionUID = 1333473616079310225L; @Override public void menuSelected(MenuItem selectedItem) { final AuthManager authManager = EMuseoUtil.getAppContext().getBean(AuthManager.class); authManager.logout(); } }); menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); for (final Entry<String, String> item : menuItems.entrySet()) { FontIcon icon = null; if (item.getKey().equals(Permissions.MENU_USERS_VIEW)) { icon = FontAwesome.USERS; } else if (item.getKey().endsWith(Permissions.MENU_EXHIBIT_VIEW)) { icon = FontAwesome.UNIVERSITY; } else if (item.getKey().endsWith(Permissions.MENU_CATEGORIES_VIEW)) { icon = FontAwesome.ARCHIVE; } else if (item.getKey().endsWith(Permissions.MENU_RESOURCES_VIEW)) { icon = FontAwesome.IMAGE; } final Button b = new Button(item.getValue(), new ClickListener() { private static final long serialVersionUID = -7089398070311521853L; @Override public void buttonClick(final ClickEvent event) { navigator.navigateTo(item.getKey()); } }); b.setHtmlContentAllowed(true); b.setPrimaryStyleName("valo-menu-item"); if (icon != null) { b.setIcon(icon); } menuItemsLayout.addComponent(b); } return menu; }
From source file:my.vaadin.profile.Forms.java
public Forms() { setSpacing(true);/*from ww w . j a v a2s.co m*/ setMargin(true); Label title = new Label("Signup Form"); title.addStyleName("h1"); addComponent(title); final FormLayout form = new FormLayout(); form.setMargin(false); form.setWidth("900px"); form.addStyleName("light"); addComponent(form); Label section = new Label("Personal Info"); section.addStyleName("h2"); section.addStyleName("colored"); form.addComponent(section); //StringGenerator sg = new StringGenerator(); TextField zID = new TextField("zID"); zID.setValue("z123456"); zID.setRequired(true); form.addComponent(zID); TextField name = new TextField("Name"); name.setValue("loreum"); //name.setWidth("50%"); form.addComponent(name); PasswordField pw = new PasswordField("Set Password"); pw.setRequired(true); form.addComponent(pw); DateField birthday = new DateField("Birthday"); birthday.setDateFormat("dd-MM-yyyy"); birthday.setValue(new java.util.Date()); form.addComponent(birthday); OptionGroup gender = new OptionGroup("Gender"); gender.addItem("Male"); gender.addItem("Female"); //sex.select("Male"); gender.addStyleName("horizontal"); form.addComponent(gender); section = new Label("Class Info"); section.addStyleName("h2"); section.addStyleName("colored"); form.addComponent(section); TextField classID = new TextField("Class ID"); classID.setValue("INFS2605"); classID.setRequired(true); //classID.setWidth("50%"); form.addComponent(classID); TextField groupID = new TextField("Group ID"); groupID.setValue("1"); //groupID.setWidth("50%"); groupID.setRequired(true); form.addComponent(groupID); Button confirm = new Button("Confirm"); confirm.addStyleName("primary"); form.addComponent(confirm); HorizontalLayout footer = new HorizontalLayout(); footer.setMargin(new MarginInfo(true, false, true, false)); footer.setSpacing(true); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); form.addComponent(footer); footer.addComponent(confirm); }
From source file:org.apache.tamaya.ui.views.ConfigView.java
License:Apache License
private Component createFilters() { HorizontalLayout filters = new HorizontalLayout(); Button filterButton = new Button("Filter", new Button.ClickListener() { @Override//from ww w .ja v a 2s.c o m public void buttonClick(Button.ClickEvent clickEvent) { fillTree(); } }); filters.setDefaultComponentAlignment(Alignment.BOTTOM_LEFT); filters.addComponents(keyFilter, valueFilter, filterButton); filters.setSpacing(true); return filters; }
From source file:org.bubblecloud.ilves.site.view.valo.DefaultValoView.java
License:Apache License
private CssLayout buildMenu() { final HorizontalLayout topLayout = new HorizontalLayout(); topLayout.setWidth("100%"); topLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); topLayout.addStyleName("valo-menu-title"); menu.addComponent(topLayout);//from w w w .j a va 2s. c o m final Button showMenu = new Button("Menu", new Button.ClickListener() { @Override public void buttonClick(Button.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>" + Site.getCurrent().localize(getViewVersion().getTitle()) + "</h3>", ContentMode.HTML); title.setSizeUndefined(); topLayout.addComponent(title); topLayout.setExpandRatio(title, 1); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); final String user = Site.getCurrent().getSecurityProvider().getUser(); final String userMenuCaption; final Resource userMenuIcon; if (user == null) { userMenuCaption = Site.getCurrent().localize("page-link-login"); userMenuIcon = new ThemeResource("ilves_logo.png"); } else { final URL gravatarUrl = GravatarUtil.getGravatarUrl(user, 64); userMenuIcon = new ExternalResource(gravatarUrl); userMenuCaption = ((SecurityProviderSessionImpl) Site.getCurrent().getSecurityProvider()) .getUserFromSession().getFirstName(); } final MenuBar.MenuItem settingsItem = settings.addItem(userMenuCaption, userMenuIcon, null); if (user != null) { settingsItem.addItem(Site.getCurrent().localize("page-link-account"), new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { UI.getCurrent().getNavigator().navigateTo("account"); } }); settingsItem.addSeparator(); settingsItem.addItem(Site.getCurrent().localize("button-logout"), new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { LoginService.logout(Site.getCurrent().getSiteContext()); final Company company = Site.getCurrent().getSiteContext().getObject(Company.class); getUI().getPage().setLocation(company.getUrl()); getSession().getSession().invalidate(); getSession().close(); } }); } else { settingsItem.addItem(Site.getCurrent().localize("page-link-login"), new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { UI.getCurrent().getNavigator().navigateTo("login"); } }); } menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); final Site site = Site.getCurrent(); final NavigationVersion navigationVersion = site.getCurrentNavigationVersion(); for (final String pageName : navigationVersion.getRootPages()) { final ViewVersion pageVersion = site.getCurrentViewVersion(pageName); if (pageVersion == null) { throw new SiteException("Unknown page: " + pageName); } if (pageVersion.getViewerRoles().length > 0) { boolean roleMatch = false; for (final String role : pageVersion.getViewerRoles()) { if (site.getSecurityProvider().getRoles().contains(role)) { roleMatch = true; break; } } if (!roleMatch) { continue; } } if (navigationVersion.hasChildPages(pageName)) { final String localizedPageName = pageVersion.isDynamic() ? pageName : site.localize("page-link-" + pageName); final Label label = new Label(localizedPageName, ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); final List<String> childPages = navigationVersion.getChildPages(pageName); for (final String childPage : childPages) { addMenuLink(navigationVersion, childPage); } label.setValue( label.getValue() + " <span class=\"valo-menu-badge\">" + childPages.size() + "</span>"); } else { addMenuLink(navigationVersion, pageName); } } return menu; }
From source file:org.esn.esobase.view.tab.DirectTableEditTab.java
public DirectTableEditTab(DBService service_, SearchService searchService_) { this.service = service_; this.searchService = searchService_; this.setSizeFull(); this.setMargin(false); linkedItemClickListener = new LinkedItemClickListener(); searchTabs = new TabSheet(); searchTabs.setSizeFull();/*from www.j ava2s .c om*/ searchTabs.setHeight(250f, Unit.PIXELS); VerticalLayout searchInCatalogsLayout = new VerticalLayout(); searchInCatalogsLayout.setSizeFull(); searchInCatalogsLayout.setMargin(false); HorizontalLayout hl = new HorizontalLayout(); hl.setDefaultComponentAlignment(Alignment.BOTTOM_LEFT); searchField = new TextField(); searchField.setWidth(500, Unit.PIXELS); searchField .addShortcutListener(new ShortcutListener("Search shortcut", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { search(); } }); hl.addComponent(searchField); searchButton = new Button("?"); searchButton.setIcon(FontAwesome.SEARCH); searchButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { search(); } }); hl.addComponent(searchButton); hl.addComponent(new Label("")); tableNamesList.add("GSpreadSheetsNpcName"); tableNamesList.add("GSpreadSheetsNpcPhrase"); tableNamesList.add("GSpreadSheetsPlayerPhrase"); tableNamesList.add("GSpreadSheetsAbilityDescription"); tableNamesList.add("GSpreadSheetsAchievement"); tableNamesList.add("GSpreadSheetsAchievementDescription"); tableNamesList.add("GSpreadSheetsActivator"); tableNamesList.add("GSpreadSheetsCollectible"); tableNamesList.add("GSpreadSheetsCollectibleDescription"); tableNamesList.add("GSpreadSheetsItemDescription"); tableNamesList.add("GSpreadSheetsItemName"); tableNamesList.add("GSpreadSheetsJournalEntry"); tableNamesList.add("GSpreadSheetsLoadscreen"); tableNamesList.add("GSpreadSheetsLocationName"); tableNamesList.add("GSpreadSheetsNote"); tableNamesList.add("GSpreadSheetsQuestDescription"); tableNamesList.add("GSpreadSheetsQuestDirection"); tableNamesList.add("GSpreadSheetsQuestName"); tableNamesList.add("GSpreadSheetsQuestStartTip"); tableNamesList.add("GSpreadSheetsQuestEndTip"); tableNames = new ComboBoxMultiselect(null); tableNames.setSelectAllButtonCaption(" ?"); tableNames.setShowSelectAllButton(new ComboBoxMultiselect.ShowButton() { @Override public boolean isShow(String filter, int page) { return true; } }); tableNames.setClearButtonCaption("? "); tableNames.setPageLength(0); tableNames.addItems(tableNamesList); tableNames.selectAll(); tableNames.setItemCaption("GSpreadSheetsAbilityDescription", "?? ???"); tableNames.setItemCaption("GSpreadSheetsAchievement", "??"); tableNames.setItemCaption("GSpreadSheetsAchievementDescription", "?? ?"); tableNames.setItemCaption("GSpreadSheetsActivator", "?"); tableNames.setItemCaption("GSpreadSheetsCollectible", " "); tableNames.setItemCaption("GSpreadSheetsCollectibleDescription", "?? "); tableNames.setItemCaption("GSpreadSheetsItemDescription", "?? "); tableNames.setItemCaption("GSpreadSheetsItemName", "?? "); tableNames.setItemCaption("GSpreadSheetsJournalEntry", "? "); tableNames.setItemCaption("GSpreadSheetsLoadscreen", " ?"); tableNames.setItemCaption("GSpreadSheetsLocationName", ""); tableNames.setItemCaption("GSpreadSheetsNote", "?"); tableNames.setItemCaption("GSpreadSheetsNpcName", "NPC"); tableNames.setItemCaption("GSpreadSheetsNpcPhrase", " NPC"); tableNames.setItemCaption("GSpreadSheetsPlayerPhrase", " "); tableNames.setItemCaption("GSpreadSheetsQuestDescription", "?? ?"); tableNames.setItemCaption("GSpreadSheetsQuestDirection", " ?"); tableNames.setItemCaption("GSpreadSheetsQuestEndTip", " "); tableNames.setItemCaption("GSpreadSheetsQuestName", "?? ?"); tableNames.setItemCaption("GSpreadSheetsQuestStartTip", "? "); hl.addComponent(tableNames); regularExpression = new CheckBox("regexp", false); hl.addComponent(regularExpression); withTranslatedNeighbours = new CheckBox( "? ? ???", false); hl.addComponent(withTranslatedNeighbours); neighboursCount = new Slider(null, 1, 200); neighboursCount.setValue(20d); hl.addComponent(neighboursCount); searchInCatalogsLayout.addComponent(hl); translatedTextSpecification = new TranslatedTextSpecification(); resultTable = new Table(" ?"); resultTable.addStyleName(ValoTheme.TABLE_SMALL); resultTable.addStyleName(ValoTheme.TABLE_COMPACT); resultTable.setSizeFull(); resultTable.setPageLength(0); hc.addContainerProperty("textEn", String.class, null); hc.addContainerProperty("textRu", String.class, null); hc.addContainerProperty("catalogType", String.class, null); hc.addContainerProperty("translator", String.class, null); hc.addContainerProperty("weight", Integer.class, null); resultTable.setContainerDataSource(hc); resultTable.setVisibleColumns(new Object[] { "textEn", "textRu", "catalogType", "translator" }); resultTable.setColumnHeaders( new String[] { "?", "?? ?", "", "" }); resultTable.addItemClickListener(new SearchTableRowClickListener()); searchInCatalogsLayout.addComponent(resultTable); searchInCatalogsLayout.setExpandRatio(resultTable, 5f); searchTabs.addTab(searchInCatalogsLayout, "?"); VerticalLayout translationsLayout = new VerticalLayout(); translationsLayout.setMargin(false); translationsLayout.setSpacing(false); translationsLayout.setSizeFull(); HorizontalLayout traslationsFilterslayout = new HorizontalLayout(); statusFilter = new ComboBox("?", Arrays.asList(TRANSLATE_STATUS.values())); statusFilter.setNullSelectionAllowed(false); statusFilter.setValue(TRANSLATE_STATUS.NEW); traslationsFilterslayout.addComponent(statusFilter); translatorBox = new ComboBox(""); translatorBox.setPageLength(15); sysAccountContainer = service.loadBeanItems(sysAccountContainer); translatorBox.setContainerDataSource(sysAccountContainer); translatorBox.setFilteringMode(FilteringMode.CONTAINS); traslationsFilterslayout.addComponent(translatorBox); translateTypeBox = new ComboBox(""); translateTypeBox.setNullSelectionAllowed(true); translateTypeBox.setPageLength(15); translateTypeBox.addItem("spreadSheetsActivator"); translateTypeBox.setItemCaption("spreadSheetsActivator", "?"); translateTypeBox.addItem("spreadSheetsAchievement"); translateTypeBox.setItemCaption("spreadSheetsAchievement", "??"); translateTypeBox.addItem("spreadSheetsAchievementDescription"); translateTypeBox.setItemCaption("spreadSheetsAchievementDescription", "?? ?"); translateTypeBox.addItem("spreadSheetsNote"); translateTypeBox.setItemCaption("spreadSheetsNote", "?"); translateTypeBox.addItem("spreadSheetsItemDescription"); translateTypeBox.setItemCaption("spreadSheetsItemDescription", "?? "); translateTypeBox.addItem("spreadSheetsItemName"); translateTypeBox.setItemCaption("spreadSheetsItemName", "?? "); translateTypeBox.addItem("spreadSheetsJournalEntry"); translateTypeBox.setItemCaption("spreadSheetsJournalEntry", "? "); translateTypeBox.addItem("spreadSheetsLocationName"); translateTypeBox.setItemCaption("spreadSheetsLocationName", "?? "); translateTypeBox.addItem("spreadSheetsNpcName"); translateTypeBox.setItemCaption("spreadSheetsNpcName", " NPC"); translateTypeBox.addItem("spreadSheetsNpcPhrase"); translateTypeBox.setItemCaption("spreadSheetsNpcPhrase", " NPC"); translateTypeBox.addItem("spreadSheetsPlayerPhrase"); translateTypeBox.setItemCaption("spreadSheetsPlayerPhrase", " "); translateTypeBox.addItem("spreadSheetsQuestDescription"); translateTypeBox.setItemCaption("spreadSheetsQuestDescription", "?? ?"); translateTypeBox.addItem("spreadSheetsQuestDirection"); translateTypeBox.setItemCaption("spreadSheetsQuestDirection", " ?"); translateTypeBox.addItem("spreadSheetsQuestName"); translateTypeBox.setItemCaption("spreadSheetsQuestName", "?? ?"); translateTypeBox.addItem("spreadSheetsQuestStartTip"); translateTypeBox.setItemCaption("spreadSheetsQuestStartTip", "? "); translateTypeBox.addItem("spreadSheetsQuestEndTip"); translateTypeBox.setItemCaption("spreadSheetsQuestEndTip", " "); translateTypeBox.addItem("sheetsCollectible"); translateTypeBox.setItemCaption("sheetsCollectible", "?? "); translateTypeBox.addItem("sheetsCollectibleDescription"); translateTypeBox.setItemCaption("sheetsCollectibleDescription", "?? "); translateTypeBox.addItem("sheetsLoadscreen"); translateTypeBox.setItemCaption("sheetsLoadscreen", " ?"); translateTypeBox.setFilteringMode(FilteringMode.CONTAINS); traslationsFilterslayout.addComponent(translateTypeBox); filterTranslationButton = new Button("?"); filterTranslationButton.addClickListener(new ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { filterTranslations(); } }); traslationsFilterslayout.addComponent(filterTranslationButton); traslationsFilterslayout.setComponentAlignment(filterTranslationButton, Alignment.BOTTOM_LEFT); translationsLayout.addComponent(traslationsFilterslayout); newTranslationsTable = new MGrid(); newTranslationsTable.setSizeFull(); newTranslationsContainer = new GeneratedPropertyListContainer<>(TranslatedText.class); newTranslationsTable.setContainerDataSource(newTranslationsContainer); filterTranslations(); newTranslationsContainer.sort(new Object[] { "id" }, new boolean[] { true }); newTranslationsTable.setContainerDataSource(newTranslationsContainer); newTranslationsTable.setColumns("author", "createTime", "text"); newTranslationsTable.getColumn("author").setHeaderCaption("?").setMaximumWidth(200); newTranslationsTable.getColumn("createTime").setHeaderCaption("").setWidth(140); newTranslationsTable.getColumn("text").setHeaderCaption("").setMaximumWidth(800) .setMinimumWidth(600); newTranslationsTable.addItemClickListener(new TranslationsTableRowClickListener()); translationsLayout.addComponent(newTranslationsTable); translationsLayout.setExpandRatio(newTranslationsTable, 5f); searchTabs.addTab(translationsLayout, ""); this.addComponent(searchTabs); filterLayout = new HorizontalLayout(); Label itemTypeLabel = new Label(""); itemType = new ComboBox(); itemType.addItems(service.getTypes()); itemType.setNullSelectionAllowed(true); itemType.setFilteringMode(FilteringMode.CONTAINS); filterLayout.addComponent(itemTypeLabel); filterLayout.addComponent(itemType); Label itemSubTypeLabel = new Label(""); itemSubType = new ComboBox(); itemSubType.addItems(service.getSubTypes()); itemSubType.setNullSelectionAllowed(true); itemSubType.setFilteringMode(FilteringMode.CONTAINS); filterLayout.addComponent(itemSubTypeLabel); filterLayout.addComponent(itemSubType); notTranslated = new CheckBox("? "); notTranslated.setValue(Boolean.FALSE); filterLayout.addComponent(notTranslated); filterLayout.setComponentAlignment(notTranslated, Alignment.MIDDLE_LEFT); this.addComponent(filterLayout); tableTabs = new TabSheet(); tableTabs.setSizeFull(); gSpreadSheetsNpcNameContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsNpcName.class); npcNameTable = new GspreadSheetTable(gSpreadSheetsNpcNameContainer, PAGESIZE, service.getgSpreadSheetsNpcNameRepository(), specification); npcNameTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); npcNameTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(npcNameTable)); tableTabs.addTab(npcNameTable, "NPC"); npcNameTable.build(); npcNameTable.setVisibleColumns( new Object[] { "rowNum", "sex", "textEn", "textRu", "infoColumn", "translateColumn" }); npcNameTable.setColumnWidth("sex", 87); npcNameTable.setColumnHeader("sex", ""); locationNameContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsLocationName.class); locationNameTable = new GspreadSheetTable(locationNameContainer, PAGESIZE, service.getgSpreadSheetsLocationNameRepository(), specification); locationNameTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); locationNameTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(locationNameTable)); tableTabs.addTab(locationNameTable, ""); locationNameTable.build(); locationNameTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); activatorContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsActivator.class); activatorTable = new GspreadSheetTable(activatorContainer, PAGESIZE, service.getgSpreadSheetsActivatorRepository(), specification); activatorTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); activatorTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(activatorTable)); tableTabs.addTab(activatorTable, "?"); activatorTable.build(); activatorTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); playerPhraseContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsPlayerPhrase.class); playerPhraseTable = new GspreadSheetTable(playerPhraseContainer, PAGESIZE, service.getgSpreadSheetsPlayerPhraseRepository(), specification); playerPhraseTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); playerPhraseTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(playerPhraseTable)); tableTabs.addTab(playerPhraseTable, " "); playerPhraseTable.build(); playerPhraseTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); Page.Styles styles = Page.getCurrent().getStyles(); styles.add(".wrapped-text {\n" + " white-space: normal;\n" + " overflow: hidden;\n" + "}"); npcPhraseContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsNpcPhrase.class); npcPhraseTable = new GspreadSheetTable(npcPhraseContainer, PAGESIZE, service.getgSpreadSheetsNpcPhraseRepository(), specification); npcPhraseTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); npcPhraseTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(npcPhraseTable)); tableTabs.addTab(npcPhraseTable, " NPC"); npcPhraseTable.build(); npcPhraseTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); questNameContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsQuestName.class); questNameTable = new GspreadSheetTable(questNameContainer, PAGESIZE, service.getgSpreadSheetsQuestNameRepository(), specification); questNameTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); questNameTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(questNameTable)); tableTabs.addTab(questNameTable, "?? ?"); questNameTable.build(); questNameTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); questDescriptionContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsQuestDescription.class); questDescriptionTable = new GspreadSheetTable(questDescriptionContainer, PAGESIZE, service.getgSpreadSheetsQuestDescriptionRepository(), specification); questDescriptionTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); questDescriptionTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(questDescriptionTable)); tableTabs.addTab(questDescriptionTable, "?? ?"); questDescriptionTable.build(); questDescriptionTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); questDirectionContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsQuestDirection.class); questDirectionTable = new GspreadSheetTable(questDirectionContainer, PAGESIZE, service.getgSpreadSheetsQuestDirectionRepository(), specification); questDirectionTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); questDirectionTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(questDirectionTable)); tableTabs.addTab(questDirectionTable, " ?"); questDirectionTable.build(); questDirectionTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); questStartTipContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsQuestStartTip.class); questStartTipTable = new GspreadSheetTable(questStartTipContainer, PAGESIZE, service.getgSpreadSheetsQuestStartTipRepository(), specification); questStartTipTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); questStartTipTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(questStartTipTable)); tableTabs.addTab(questStartTipTable, "? "); questStartTipTable.build(); questStartTipTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); questEndTipContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsQuestEndTip.class); questEndTipTable = new GspreadSheetTable(questEndTipContainer, PAGESIZE, service.getgSpreadSheetsQuestEndTipRepository(), specification); questEndTipTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); questEndTipTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(questEndTipTable)); tableTabs.addTab(questEndTipTable, " "); questEndTipTable.build(); questEndTipTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); itemNameLayout = new VerticalLayout(); itemNameLayout.setMargin(false); itemNameLayout.setSpacing(false); itemNameLayout.setSizeFull(); Label itemNameLabel = new Label( "???! ? ?: ? ?, ? ? ? ? ."); itemNameLabel.setStyleName(ValoTheme.LABEL_COLORED); itemNameContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsItemName.class); itemNameTable = new GspreadSheetTable(itemNameContainer, PAGESIZE, service.getgSpreadSheetsItemNameRepository(), itemNameSpecification); itemNameTable.addGeneratedColumn("itemTypeColumn", new ItemInfoColumnGenerator()); itemNameTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); itemNameTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(itemNameTable)); itemNameLayout.addComponent(itemNameLabel); itemNameLayout.addComponent(itemNameTable); itemNameLayout.setExpandRatio(itemNameTable, 1f); tableTabs.addTab(itemNameLayout, "?? "); itemNameTable.build(); itemNameTable.setVisibleColumns( new Object[] { "rowNum", "textEn", "textRu", "itemTypeColumn", "infoColumn", "translateColumn" }); itemNameTable.setColumnHeader("itemTypeColumn", ""); itemNameTable.setColumnExpandRatio("itemTypeColumn", 0.5f); itemDescriptionContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsItemDescription.class); itemDescriptionTable = new GspreadSheetTable(itemDescriptionContainer, PAGESIZE, service.getgSpreadSheetsItemDescriptionRepository(), specification); itemDescriptionTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); itemDescriptionTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(itemDescriptionTable)); tableTabs.addTab(itemDescriptionTable, "?? "); itemDescriptionTable.build(); itemDescriptionTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); journalEntryContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsJournalEntry.class); journalEntryTable = new GspreadSheetTable(journalEntryContainer, PAGESIZE, service.getgSpreadSheetsJournalEntryRepository(), specification); journalEntryTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); journalEntryTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(journalEntryTable)); tableTabs.addTab(journalEntryTable, "? "); journalEntryTable.build(); journalEntryTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); achievementContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsAchievement.class); achievementTable = new GspreadSheetTable(achievementContainer, PAGESIZE, service.getgSpreadSheetsAchievementRepository(), specification); achievementTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); achievementTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(achievementTable)); tableTabs.addTab(achievementTable, "??"); achievementTable.build(); achievementTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); achievementDescriptionContainer = new GeneratedPropertyListContainer<>( GSpreadSheetsAchievementDescription.class); achievementDescriptionTable = new GspreadSheetTable(achievementDescriptionContainer, PAGESIZE, service.getgSpreadSheetsAchievementDescriptionRepository(), specification); achievementDescriptionTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); achievementDescriptionTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(achievementDescriptionTable)); tableTabs.addTab(achievementDescriptionTable, "?? ?"); achievementDescriptionTable.build(); achievementDescriptionTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); abilityDescriptionContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsAbilityDescription.class); abilityDescriptionTable = new GspreadSheetTable(abilityDescriptionContainer, PAGESIZE, service.getgSpreadSheetsAbilityDescriptionRepository(), specification); abilityDescriptionTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); abilityDescriptionTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(abilityDescriptionTable)); tableTabs.addTab(abilityDescriptionTable, "?? ???"); abilityDescriptionTable.build(); abilityDescriptionTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); noteContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsNote.class); noteTable = new GspreadSheetTable(noteContainer, PAGESIZE, service.getgSpreadSheetsNoteRepository(), specification); noteTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); noteTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(noteTable)); tableTabs.addTab(noteTable, "?"); noteTable.build(); noteTable.setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); collectibleContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsCollectible.class); collectibleTable = new GspreadSheetTable(collectibleContainer, PAGESIZE, service.getgSpreadSheetsCollectibleRepository(), specification); collectibleTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); collectibleTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(collectibleTable)); tableTabs.addTab(collectibleTable, " "); collectibleTable.build(); collectibleTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); collectibleDescriptionContainer = new GeneratedPropertyListContainer<>( GSpreadSheetsCollectibleDescription.class); collectibleDescriptionTable = new GspreadSheetTable(collectibleDescriptionContainer, PAGESIZE, service.getgSpreadSheetsCollectibleDescriptionRepository(), specification); collectibleDescriptionTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); collectibleDescriptionTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(collectibleDescriptionTable)); tableTabs.addTab(collectibleDescriptionTable, "?? "); collectibleDescriptionTable.build(); collectibleDescriptionTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); loadscreenContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsLoadscreen.class); loadscreenTable = new GspreadSheetTable(loadscreenContainer, PAGESIZE, service.getgSpreadSheetsLoadscreenRepository(), specification); loadscreenTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator()); loadscreenTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(loadscreenTable)); tableTabs.addTab(loadscreenTable, " ?"); loadscreenTable.build(); loadscreenTable .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" }); LoadTables(); itemType.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { LoadTables(); } }); itemSubType.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { LoadTables(); } }); notTranslated.addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() { @Override public void valueChange(HasValue.ValueChangeEvent<Boolean> event) { LoadTables(); } }); this.addComponent(tableTabs); this.setExpandRatio(tableTabs, 20f); }
From source file:org.investovator.ui.agentgaming.user.DashboardPlayingView.java
License:Open Source License
private void createUI() { //Setup Layout content = new VerticalLayout(); content.setDefaultComponentAlignment(Alignment.TOP_CENTER); content.setSpacing(true);// w w w . j a v a 2 s . c o m HorizontalLayout row1 = new HorizontalLayout(); HorizontalLayout row2 = new HorizontalLayout(); row1.setDefaultComponentAlignment(Alignment.TOP_CENTER); row2.setDefaultComponentAlignment(Alignment.TOP_CENTER); row1.setWidth("100%"); row2.setWidth("100%"); row1.setHeight("60%"); row1.setHeight("35%"); content.addComponent(row1); content.addComponent(row2); content.setExpandRatio(row1, 55); content.setExpandRatio(row2, 45); //Portfolio Summary portfolioSummary = new PortfolioSummary(); //QuoteUI quoteUI = new QuoteUI(companyData); watchListTable = getTable(); currentPriceChart = new MultiStockChart(); //Adding to main layout row1.addComponent(watchListTable); row1.addComponent(currentPriceChart); row2.addComponent(quoteUI); row2.addComponent(portfolioSummary); row2.setComponentAlignment(portfolioSummary, Alignment.TOP_CENTER); watchListTable.addStyleName("center-caption"); quoteUI.addStyleName("center-caption"); currentPriceChart.addStyleName("center-caption"); content.setSizeFull(); this.setSizeFull(); this.setContent(content); }
From source file:org.jumpmind.metl.ui.mapping.EditMappingPanel.java
License:Open Source License
protected void buildUI() { if (!readOnly) { ButtonBar buttonBar = new ButtonBar(); addComponent(buttonBar);//w w w .j av a 2 s . co m Button autoMapButton = buttonBar.addButton("Auto Map", FontAwesome.FLASH); removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O); removeButton.setEnabled(false); autoMapButton.addClickListener(new AutoMapListener()); removeButton.addClickListener(new RemoveListener()); } HorizontalLayout titleHeader = new HorizontalLayout(); titleHeader.setSpacing(true); titleHeader.setMargin(new MarginInfo(false, true, false, true)); titleHeader.setWidth(100f, Unit.PERCENTAGE); titleHeader.addComponent(new Label( "<b>Input Model:</b> " + (component.getInputModel() != null ? component.getInputModel().getName() : "?"), ContentMode.HTML)); titleHeader.addComponent(new Label( "<b>Output Model:</b> " + (component.getOutputModel() != null ? component.getOutputModel().getName() : "?"), ContentMode.HTML)); addComponent(titleHeader); HorizontalLayout filterHeader = new HorizontalLayout(); filterHeader.setSpacing(true); filterHeader.setMargin(new MarginInfo(true, true, true, true)); filterHeader.setWidth(100f, Unit.PERCENTAGE); HorizontalLayout srcFilterHeader = new HorizontalLayout(); srcFilterHeader.setSpacing(true); srcFilterHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); filterHeader.addComponent(srcFilterHeader); HorizontalLayout dstFilterHeader = new HorizontalLayout(); dstFilterHeader.setSpacing(true); dstFilterHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); filterHeader.addComponent(dstFilterHeader); addComponent(filterHeader); srcTextFilter = new TextField(); srcTextFilter.setInputPrompt("Filter"); srcTextFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); srcTextFilter.setIcon(FontAwesome.SEARCH); srcTextFilter.setImmediate(true); srcTextFilter.setTextChangeEventMode(TextChangeEventMode.LAZY); srcTextFilter.setTextChangeTimeout(200); srcTextFilter.addTextChangeListener(new FilterInputTextListener()); srcFilterHeader.addComponent(srcTextFilter); srcMapFilter = new CheckBox("Mapped Only"); srcMapFilter.addValueChangeListener(new FilterSrcMapListener()); srcFilterHeader.addComponent(srcMapFilter); dstTextFilter = new TextField(); dstTextFilter.setInputPrompt("Filter"); dstTextFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); dstTextFilter.setIcon(FontAwesome.SEARCH); dstTextFilter.setImmediate(true); dstTextFilter.setTextChangeEventMode(TextChangeEventMode.LAZY); dstTextFilter.setTextChangeTimeout(200); dstTextFilter.addTextChangeListener(new FilterOutputTextListener()); dstFilterHeader.addComponent(dstTextFilter); dstMapFilter = new CheckBox("Mapped Only"); dstMapFilter.addValueChangeListener(new FilterDstMapListener()); dstFilterHeader.addComponent(dstMapFilter); Panel panel = new Panel(); VerticalLayout vlay = new VerticalLayout(); vlay.setSizeFull(); diagram = new MappingDiagram(context, component, readOnly); diagram.setSizeFull(); vlay.addComponent(diagram); panel.setContent(vlay); panel.setSizeFull(); addComponent(panel); setExpandRatio(panel, 1.0f); diagram.addListener(new EventListener()); }