List of usage examples for com.vaadin.ui HorizontalLayout setMargin
@Override public void setMargin(boolean enabled)
From source file:org.escidoc.browser.ui.maincontent.ContainerView.java
License:Open Source License
private HorizontalLayout buildHlMetaViews() throws EscidocClientException { // common part: create layout HorizontalLayout hlMetaViews = new HorizontalLayout(); hlMetaViews.setImmediate(false);/* www . j a va 2 s . co m*/ hlMetaViews.setWidth("100.0%"); hlMetaViews.setHeight("100.0%"); hlMetaViews.setMargin(false); // leftPanel Panel leftPanel = buildLeftPanel(); hlMetaViews.addComponent(leftPanel); hlMetaViews.setExpandRatio(leftPanel, 4.5f); // rightPanel Panel rightPanel = buildRightPanel(); hlMetaViews.addComponent(rightPanel); hlMetaViews.setExpandRatio(rightPanel, 5.5f); return hlMetaViews; }
From source file:org.escidoc.browser.ui.maincontent.ItemView.java
License:Open Source License
private HorizontalLayout buildHlMetaViews() { // common part: create layout HorizontalLayout hlMetaViews = new HorizontalLayout(); hlMetaViews.setImmediate(false);/*from w ww. j av a 2 s . com*/ hlMetaViews.setWidth("100.0%"); hlMetaViews.setHeight("100.0%"); hlMetaViews.setMargin(false); // leftPanel Panel leftPanel = buildLeftPanel(); hlMetaViews.addComponent(leftPanel); hlMetaViews.setExpandRatio(leftPanel, 0.7f); // rightPanel Panel rightPanel = buildRightPanel(); hlMetaViews.addComponent(rightPanel); hlMetaViews.setExpandRatio(rightPanel, 0.3f); return hlMetaViews; }
From source file:org.escidoc.browser.ui.mainpage.Footer.java
License:Open Source License
private void buildView(final EscidocServiceLocation serviceLocation) { Label lblBaseUrl = new Label(ViewConstants.PRODUCT_NAME + ViewConstants.VERSION + " on " + serviceLocation.getEscidocUri().toString() + "", Label.CONTENT_RAW); footerLayout.addComponent(lblBaseUrl); footerLayout.setExpandRatio(lblBaseUrl, 1f); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("150px"); hl.setStyleName("floatright"); hl.setMargin(false); final Button btnChange = new Button(ViewConstants.CHANGE, new Button.ClickListener() { @Override// www.j a v a2s. c o m public void buttonClick(final ClickEvent event) { footerLayout.getApplication().close(); } }); btnChange.setStyleName(Reindeer.BUTTON_LINK); hl.addComponent(btnChange); footerLayout.addComponent(hl); // footerLayout.setExpandRatio(hl, 0.1f); }
From source file:org.escidoc.browser.ui.tools.BulkTasksView.java
License:Open Source License
private void addFilterView() { final HorizontalLayout filterLayout = new HorizontalLayout(); filterLayout.setMargin(true); filterLayout.setSpacing(true);// w ww . j a v a 2s . c o m addResult(); }
From source file:org.esn.esobase.view.tab.QuestTranslateTab.java
public QuestTranslateTab(DBService service_) { this.setSizeFull(); this.setSpacing(false); this.setMargin(false); this.service = service_; QuestChangeListener questChangeListener = new QuestChangeListener(); FilterChangeListener filterChangeListener = new FilterChangeListener(); questListlayout = new HorizontalLayout(); questListlayout.setWidth(100f, Unit.PERCENTAGE); questListlayout.setSpacing(false);/*from w ww.j av a2 s . c o m*/ questListlayout.setMargin(false); locationTable = new ComboBox("?"); locationTable.setPageLength(30); locationTable.setScrollToSelectedItem(true); locationTable.setWidth(100f, Unit.PERCENTAGE); locationTable.addValueChangeListener(filterChangeListener); locationTable.setDataProvider(new ListDataProvider<>(locations)); questTable = new ComboBox("?"); questTable.setWidth(100f, Unit.PERCENTAGE); questTable.setPageLength(15); questTable.setScrollToSelectedItem(true); questTable.setWidth(100f, Unit.PERCENTAGE); questTable.addValueChangeListener(questChangeListener); questTable.setDataProvider(new ListDataProvider<>(questList)); questListlayout.addComponent(questTable); FormLayout locationAndQuestLayout = new FormLayout(locationTable, questTable); locationAndQuestLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); locationAndQuestLayout.setSizeFull(); questListlayout.addComponent(locationAndQuestLayout); translateStatus = new ComboBoxMultiselect("? ", Arrays.asList(TRANSLATE_STATUS.values())); translateStatus.setClearButtonCaption("?"); translateStatus.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { LoadFilters(); LoadContent(); } }); noTranslations = new CheckBox("? ?"); noTranslations.setValue(Boolean.FALSE); noTranslations.addValueChangeListener(filterChangeListener); emptyTranslations = new CheckBox("? "); emptyTranslations.setValue(Boolean.FALSE); emptyTranslations.addValueChangeListener(filterChangeListener); HorizontalLayout checkBoxlayout = new HorizontalLayout(noTranslations, emptyTranslations); checkBoxlayout.setSpacing(false); checkBoxlayout.setMargin(false); translatorBox = new ComboBox(""); translatorBox.setPageLength(15); translatorBox.setScrollToSelectedItem(true); translatorBox.setDataProvider(new ListDataProvider<SysAccount>(service.getSysAccounts())); translatorBox.addValueChangeListener(filterChangeListener); refreshButton = new Button(""); refreshButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { LoadFilters(); LoadContent(); } }); countLabel = new Label(); searchField = new TextField("?? ?"); searchField.setSizeFull(); searchField.addValueChangeListener(filterChangeListener); FormLayout filtersLayout = new FormLayout(translateStatus, translatorBox, checkBoxlayout, searchField); filtersLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); filtersLayout.setSizeFull(); questListlayout.addComponent(filtersLayout); questListlayout.addComponent(refreshButton); questListlayout.addComponent(countLabel); questListlayout.setExpandRatio(locationAndQuestLayout, 0.4f); questListlayout.setExpandRatio(filtersLayout, 0.4f); questListlayout.setExpandRatio(refreshButton, 0.1f); questListlayout.setExpandRatio(countLabel, 0.1f); questListlayout.setHeight(105f, Unit.PIXELS); this.addComponent(questListlayout); infoLayout = new VerticalLayout(); infoLayout.setSizeFull(); infoLayout.setSpacing(false); infoLayout.setMargin(false); tabSheet = new TabSheet(); tabSheet.setSizeFull(); nameLayout = new VerticalLayout(); nameLayout.setSizeFull(); nameHLayout = new HorizontalLayout(); nameHLayout.setSizeFull(); nameHLayout.setSpacing(false); nameHLayout.setMargin(false); nameLayout = new VerticalLayout(); nameLayout.setSizeFull(); nameLayout.setSpacing(false); nameLayout.setMargin(false); questNameEnArea = new TextArea("?"); questNameEnArea.setSizeFull(); questNameEnArea.setRows(1); questNameEnArea.setReadOnly(true); questNameRuArea = new TextArea("? Ru"); questNameRuArea.setSizeFull(); questNameRuArea.setRows(1); questNameRuArea.setReadOnly(true); questNameRawEnArea = new TextArea("? "); questNameRawEnArea.setSizeFull(); questNameRawEnArea.setRows(1); questNameRawEnArea.setReadOnly(true); questNameRawRuArea = new TextArea("? Ru"); questNameRawRuArea.setSizeFull(); questNameRawRuArea.setRows(1); questNameRawRuArea.setReadOnly(true); nameLayout.addComponents(questNameEnArea, questNameRuArea, questNameRawEnArea, questNameRawRuArea); nameHLayout.addComponent(nameLayout); nameTranslateLayout = new VerticalLayout(); nameTranslateLayout.setSizeFull(); nameTranslateLayout.setSpacing(false); nameTranslateLayout.setMargin(false); nameHLayout.addComponent(nameTranslateLayout); infoLayout.addComponent(nameHLayout); descriptionLayout = new VerticalLayout(); descriptionLayout.setSizeFull(); descriptionHLayout = new HorizontalLayout(); descriptionHLayout.setSizeFull(); descriptionHLayout.setSpacing(false); descriptionHLayout.setMargin(false); descriptionLayout = new VerticalLayout(); descriptionLayout.setSizeFull(); descriptionLayout.setSpacing(false); descriptionLayout.setMargin(false); questDescriptionEnArea = new TextArea("?"); questDescriptionEnArea.setSizeFull(); questDescriptionEnArea.setRows(4); questDescriptionEnArea.setReadOnly(true); questDescriptionRuArea = new TextArea("? Ru"); questDescriptionRuArea.setSizeFull(); questDescriptionRuArea.setRows(4); questDescriptionRuArea.setReadOnly(true); questDescriptionRawEnArea = new TextArea("? "); questDescriptionRawEnArea.setSizeFull(); questDescriptionRawEnArea.setRows(4); questDescriptionRawEnArea.setReadOnly(true); questDescriptionRawRuArea = new TextArea("? Ru"); questDescriptionRawRuArea.setSizeFull(); questDescriptionRawRuArea.setRows(4); questDescriptionRawRuArea.setReadOnly(true); descriptionLayout.addComponents(questDescriptionEnArea, questDescriptionRuArea, questDescriptionRawEnArea, questDescriptionRawRuArea); descriptionHLayout.addComponent(descriptionLayout); descriptionTranslateLayout = new VerticalLayout(); descriptionTranslateLayout.setSizeFull(); descriptionTranslateLayout.setSpacing(false); descriptionTranslateLayout.setMargin(false); descriptionHLayout.addComponent(descriptionTranslateLayout); infoLayout.addComponent(descriptionHLayout); tabSheet.addTab(infoLayout, "?"); stepsLayout = new VerticalLayout(); stepsLayout.setSizeFull(); stepsLayout.setSpacing(false); stepsLayout.setMargin(false); stepsData = new TreeData(); stepsGrid = new TreeGrid(new TreeDataProvider(stepsData)); stepsGrid.setSelectionMode(Grid.SelectionMode.NONE); stepsGrid.setRowHeight(250); stepsGrid.setHeaderVisible(false); stepsGrid.setSizeFull(); stepsGrid.setItemCollapseAllowedProvider(new ItemCollapseAllowedProvider() { @Override public boolean test(Object item) { return false; } }); stepsGrid.addColumn(new ValueProvider() { @Override public Object apply(Object source) { if (source instanceof QuestStep) { return "?"; } if (source instanceof QuestDirection) { return " - " + ((QuestDirection) source).getDirectionType().name(); } return null; } }).setId("rowType").setCaption("").setWidth(132).setStyleGenerator(rowStyleGenerator); stepsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestStep) { QuestStep step = (QuestStep) source; if (step.getTextEn() != null && !step.getTextEn().isEmpty()) { TextArea textEnArea = new TextArea("? "); textEnArea.setValue(step.getTextEn()); textEnArea.setReadOnly(true); textEnArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnArea); } if (step.getTextRu() != null && !step.getTextRu().isEmpty()) { TextArea textRuArea = new TextArea(" "); textRuArea.setValue(step.getTextRu()); textRuArea.setReadOnly(true); textRuArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuArea); } } else if (source instanceof QuestDirection) { QuestDirection d = (QuestDirection) source; if (d.getTextEn() != null && !d.getTextEn().isEmpty()) { TextArea textEnArea = new TextArea("? "); textEnArea.setValue(d.getTextEn()); textEnArea.setRows(2); textEnArea.setReadOnly(true); textEnArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnArea); } if (d.getTextRu() != null && !d.getTextRu().isEmpty()) { TextArea textRuArea = new TextArea(" "); textRuArea.setValue(d.getTextRu()); textRuArea.setRows(2); textRuArea.setReadOnly(true); textRuArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuArea); } } return result; } }).setId("ingameText").setStyleGenerator(rowStyleGenerator); stepsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestStep) { QuestStep step = (QuestStep) source; if (step.getSheetsJournalEntry() != null) { TextArea textEnRawArea = new TextArea("? "); textEnRawArea.setValue(step.getSheetsJournalEntry().getTextEn()); textEnRawArea.setReadOnly(true); textEnRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnRawArea); if (step.getSheetsJournalEntry().getTextRu() != null && !step.getSheetsJournalEntry() .getTextRu().equals(step.getSheetsJournalEntry().getTextEn())) { TextArea textRuRawArea = new TextArea(" " + step.getSheetsJournalEntry().getTranslator()); textRuRawArea.setValue(step.getSheetsJournalEntry().getTextRu()); textRuRawArea.setReadOnly(true); textRuRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuRawArea);//, " " } } } else if (source instanceof QuestDirection) { QuestDirection d = (QuestDirection) source; if (d.getSheetsQuestDirection() != null) { TextArea textEnRawArea = new TextArea("? "); textEnRawArea.setValue(d.getSheetsQuestDirection().getTextEn()); textEnRawArea.setRows(2); textEnRawArea.setReadOnly(true); textEnRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnRawArea); if (d.getSheetsQuestDirection().getTextRu() != null && !d.getSheetsQuestDirection() .getTextRu().equals(d.getSheetsQuestDirection().getTextEn())) { TextArea textRuRawArea = new TextArea(" " + d.getSheetsQuestDirection().getTranslator()); textRuRawArea.setValue(d.getSheetsQuestDirection().getTextRu()); textRuRawArea.setRows(2); textRuRawArea.setReadOnly(true); textRuRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuRawArea); } } } return result; } }).setId("rawText").setStyleGenerator(rowStyleGenerator); stepsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { Panel panel = new Panel(); panel.addStyleName(ValoTheme.PANEL_BORDERLESS); panel.setWidth(100f, Unit.PERCENTAGE); panel.setHeight(245f, Unit.PIXELS); final VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestStep) { Set<TranslatedText> list = new HashSet<>(); List<SysAccount> accounts = new ArrayList<>(); QuestStep step = (QuestStep) source; list.addAll(step.getSheetsJournalEntry().getTranslatedTexts()); if (list != null) { for (TranslatedText t : list) { result.addComponent(new TranslationCell(t)); accounts.add(t.getAuthor()); } } if (!accounts.contains(SpringSecurityHelper.getSysAccount()) && step.getSheetsJournalEntry() != null && SpringSecurityHelper.hasRole("ROLE_TRANSLATE")) { final TranslatedText translatedText = new TranslatedText(); translatedText.setAuthor(SpringSecurityHelper.getSysAccount()); translatedText.setSpreadSheetsJournalEntry(step.getSheetsJournalEntry()); Button addTranslation = new Button(" ", FontAwesome.PLUS_SQUARE); addTranslation.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (translatedText.getSpreadSheetsJournalEntry() != null) { translatedText.getSpreadSheetsJournalEntry().getTranslatedTexts() .add(translatedText); } result.addComponent(new TranslationCell(translatedText)); event.getButton().setVisible(false); } }); result.addComponent(addTranslation); } } else if (source instanceof QuestDirection) { Set<TranslatedText> list = new HashSet<>(); List<SysAccount> accounts = new ArrayList<>(); QuestDirection d = (QuestDirection) source; list.addAll(d.getSheetsQuestDirection().getTranslatedTexts()); if (list != null) { for (TranslatedText t : list) { result.addComponent(new TranslationCell(t)); accounts.add(t.getAuthor()); } } if (!accounts.contains(SpringSecurityHelper.getSysAccount()) && d.getSheetsQuestDirection() != null && SpringSecurityHelper.hasRole("ROLE_TRANSLATE")) { final TranslatedText translatedText = new TranslatedText(); translatedText.setAuthor(SpringSecurityHelper.getSysAccount()); translatedText.setSpreadSheetsQuestDirection(d.getSheetsQuestDirection()); Button addTranslation = new Button(" "); addTranslation.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (translatedText.getSpreadSheetsQuestDirection() != null) { translatedText.getSpreadSheetsQuestDirection().getTranslatedTexts() .add(translatedText); } result.addComponent(new TranslationCell(translatedText)); event.getButton().setVisible(false); } }); result.addComponent(addTranslation); } } panel.setContent(result); return panel; } }).setId("translation").setStyleGenerator(rowStyleGenerator); stepsGrid.setColumns("rowType", "ingameText", "rawText", "translation"); stepsLayout.addComponent(stepsGrid); tabSheet.addTab(stepsLayout, ""); itemsGrid = new Grid(new ListDataProvider(itemList)); itemsGrid.setSelectionMode(Grid.SelectionMode.NONE); itemsGrid.setRowHeight(250); itemsGrid.setHeaderVisible(false); itemsGrid.setSizeFull(); itemsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestItem) { QuestItem item = (QuestItem) source; if (item.getName() != null) { TextArea textEnRawArea = new TextArea("? "); textEnRawArea.setValue(item.getName().getTextEn()); textEnRawArea.setReadOnly(true); textEnRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnRawArea); if (item.getName().getTextRu() != null && !item.getName().getTextRu().equals(item.getName().getTextEn())) { TextArea textRuRawArea = new TextArea( " ? " + item.getName().getTranslator()); textRuRawArea.setValue(item.getName().getTextRu()); textRuRawArea.setReadOnly(true); textRuRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuRawArea);//, " " } } } return result; } }).setId("rawName"); itemsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestItem) { QuestItem item = (QuestItem) source; if (item.getDescription() != null) { TextArea textEnRawArea = new TextArea("? "); textEnRawArea.setValue(item.getDescription().getTextEn()); textEnRawArea.setReadOnly(true); textEnRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnRawArea); if (item.getDescription().getTextRu() != null && !item.getDescription().getTextRu().equals(item.getDescription().getTextEn())) { TextArea textRuRawArea = new TextArea( " ?? " + item.getDescription().getTranslator()); textRuRawArea.setValue(item.getDescription().getTextRu()); textRuRawArea.setReadOnly(true); textRuRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuRawArea);//, " " } } } return result; } }).setId("rawDescription"); itemsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { Panel panel = new Panel(); panel.addStyleName(ValoTheme.PANEL_BORDERLESS); panel.setWidth(100f, Unit.PERCENTAGE); panel.setHeight(245f, Unit.PIXELS); final VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestItem) { Set<TranslatedText> list = new HashSet<>(); List<SysAccount> accounts = new ArrayList<>(); QuestItem item = (QuestItem) source; if (item.getName() != null) { String text = item.getName().getTextEn(); list.addAll(item.getName().getTranslatedTexts()); if (list != null) { for (TranslatedText t : list) { result.addComponent(new TranslationCell(t)); accounts.add(t.getAuthor()); } } if (!accounts.contains(SpringSecurityHelper.getSysAccount()) && text != null && !text.isEmpty() && SpringSecurityHelper.hasRole("ROLE_TRANSLATE")) { final TranslatedText translatedText = new TranslatedText(); translatedText.setAuthor(SpringSecurityHelper.getSysAccount()); translatedText.setSpreadSheetsItemName(item.getName()); Button addTranslation = new Button(" ", FontAwesome.PLUS_SQUARE); addTranslation.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (translatedText.getSpreadSheetsItemName() != null) { translatedText.getSpreadSheetsItemName().getTranslatedTexts() .add(translatedText); } result.addComponent(new TranslationCell(translatedText)); event.getButton().setVisible(false); } }); result.addComponent(addTranslation); } } } panel.setContent(result); return panel; } }).setId("nameTranslation"); itemsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { Panel panel = new Panel(); panel.addStyleName(ValoTheme.PANEL_BORDERLESS); panel.setWidth(100f, Unit.PERCENTAGE); panel.setHeight(245f, Unit.PIXELS); final VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestItem) { Set<TranslatedText> list = new HashSet<>(); List<SysAccount> accounts = new ArrayList<>(); QuestItem item = (QuestItem) source; if (item.getDescription() != null) { String text = item.getDescription().getTextEn(); list.addAll(item.getDescription().getTranslatedTexts()); if (list != null) { for (TranslatedText t : list) { result.addComponent(new TranslationCell(t)); accounts.add(t.getAuthor()); } } if (!accounts.contains(SpringSecurityHelper.getSysAccount()) && text != null && !text.isEmpty() && SpringSecurityHelper.hasRole("ROLE_TRANSLATE")) { final TranslatedText translatedText = new TranslatedText(); translatedText.setAuthor(SpringSecurityHelper.getSysAccount()); translatedText.setSpreadSheetsItemDescription(item.getDescription()); Button addTranslation = new Button(" ", FontAwesome.PLUS_SQUARE); addTranslation.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (translatedText.getSpreadSheetsItemDescription() != null) { translatedText.getSpreadSheetsItemDescription().getTranslatedTexts() .add(translatedText); } result.addComponent(new TranslationCell(translatedText)); event.getButton().setVisible(false); } }); result.addComponent(addTranslation); } } } panel.setContent(result); return panel; } }).setId("descriptionTranslation"); itemsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { VerticalLayout result = new VerticalLayout(); result.setMargin(new MarginInfo(true, false, false, false)); result.setSpacing(false); if (source instanceof QuestItem) { GSpreadSheetsItemName name = ((QuestItem) source).getName(); if (name.getIcon() != null) { Image image = new Image(null, new ExternalResource( "https://elderscrolls.net" + name.getIcon().replaceAll(".dds", ".png"))); result.addComponent(image); return result; } } return result; } }).setId("icon").setWidth(95); itemsGrid.setColumns("icon", "rawName", "nameTranslation", "rawDescription", "descriptionTranslation"); tabSheet.addTab(itemsGrid, ""); this.addComponent(tabSheet); this.setExpandRatio(tabSheet, 1f); GridScrollExtension stepsScrollExtension = new GridScrollExtension(stepsGrid); GridScrollExtension itemsScrollExtension = new GridScrollExtension(itemsGrid); new NoAutcompleteComboBoxExtension(locationTable); new NoAutcompleteComboBoxExtension(questTable); new NoAutcompleteComboBoxExtension(translatorBox); LoadFilters(); }
From source file:org.generationcp.breeding.manager.crossingmanager.EmbeddedGermplasmListDetailComponent.java
License:Open Source License
@Override public void afterPropertiesSet() throws Exception { setMargin(false);// www .ja va 2 s . com setSpacing(true); setWidth("800px"); Tool tool = null; try { tool = workbenchDataManager.getToolWithName(ToolName.germplasm_list_browser.toString()); } catch (MiddlewareQueryException qe) { LOG.error("QueryException", qe); } ExternalResource listBrowserLink = null; if (tool == null) { listBrowserLink = new ExternalResource( "http://localhost:18080/GermplasmStudyBrowser/main/germplasmlist-" + listId); } else { listBrowserLink = new ExternalResource( tool.getPath().replace("germplasmlist/", "germplasmlist-") + listId); } VerticalLayout layoutForList = new VerticalLayout(); layoutForList.setMargin(false); layoutForList.setSpacing(false); Embedded listInfoPage = new Embedded("", listBrowserLink); listInfoPage.setType(Embedded.TYPE_BROWSER); listInfoPage.setSizeFull(); layoutForList.setHeight("550px"); layoutForList.addComponent(listInfoPage); CrossingManagerImportButtonClickListener listener = new CrossingManagerImportButtonClickListener(this); exportButton = new Button(); exportButton.setData(EXPORT_BUTTON_ID); exportButton.addListener(listener); makeCrossesButton = new Button(); makeCrossesButton.setData(MAKE_CROSSES_BUTTON_ID); makeCrossesButton.addListener(listener); HorizontalLayout buttonArea = new HorizontalLayout(); buttonArea.setMargin(true); buttonArea.setSpacing(true); buttonArea.addComponent(exportButton); buttonArea.addComponent(makeCrossesButton); addComponent(layoutForList); addComponent(buttonArea); setComponentAlignment(buttonArea, Alignment.BOTTOM_RIGHT); }
From source file:org.generationcp.breeding.manager.listimport.EmbeddedGermplasmListDetailComponent.java
License:Open Source License
@Override public void afterPropertiesSet() throws Exception { setMargin(false);/* w ww . j av a 2 s .c o m*/ setSpacing(true); setWidth("800px"); Tool tool = null; try { tool = workbenchDataManager.getToolWithName(ToolName.germplasm_list_browser.toString()); } catch (MiddlewareQueryException qe) { LOG.error("QueryException", qe); } ExternalResource listBrowserLink = null; if (tool == null) { listBrowserLink = new ExternalResource( "http://localhost:18080/GermplasmStudyBrowser/main/germplasmlist-" + listId); } else { listBrowserLink = new ExternalResource( tool.getPath().replace("germplasmlist/", "germplasmlist-") + listId); } VerticalLayout layoutForList = new VerticalLayout(); layoutForList.setMargin(false); layoutForList.setSpacing(false); BrowserFrame listInfoPage = new BrowserFrame("", listBrowserLink); listInfoPage.setSizeFull(); layoutForList.setHeight("550px"); layoutForList.addComponent(listInfoPage); GermplasmImportButtonClickListener listener = new GermplasmImportButtonClickListener(this); /* exportButton = new Button(); exportButton.setData(EXPORT_BUTTON_ID); exportButton.addListener(listener); */ makeImportButton = new Button(); makeImportButton.setData(NEW_IMPORT_BUTTON_ID); makeImportButton.addListener(listener); HorizontalLayout buttonArea = new HorizontalLayout(); buttonArea.setMargin(true); buttonArea.setSpacing(true); buttonArea.addComponent(makeImportButton); addComponent(layoutForList); addComponent(buttonArea); setComponentAlignment(buttonArea, Alignment.BOTTOM_RIGHT); }
From source file:org.hip.vif.forum.search.ui.SearchContentView.java
License:Open Source License
/** View constructor. * * @param inHelpContent URL/*from w w w .j a v a2s . c o m*/ * @param inTask {@link SearchContentTask} */ public SearchContentView(final URL inHelpContent, final SearchContentTask inTask) { final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout); final IMessages lMessages = Activator.getMessages(); lLayout.setStyleName("vif-view"); //$NON-NLS-1$ lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", //$NON-NLS-1$ lMessages.getMessage("ui.search.view.title.page")), ContentMode.HTML)); //$NON-NLS-1$ final HorizontalLayout lInput = new HorizontalLayout(); lInput.setMargin(new MarginInfo(true, true, true, false)); final Label lLabel = new Label( String.format("%s: ", lMessages.getMessage("ui.search.view.label.input")), ContentMode.HTML); //$NON-NLS-1$ //$NON-NLS-2$ lInput.addComponent(RiplaViewHelper.makeUndefinedWidth(lLabel)); lInput.setComponentAlignment(lLabel, Alignment.MIDDLE_LEFT); final TextField lSearch = new TextField(); lSearch.setColumns(50); lSearch.focus(); lInput.addComponent(lSearch); lInput.addComponent( new HelpButton(lMessages.getMessage("ui.search.view.button.help"), inHelpContent, 700, 620)); //$NON-NLS-1$ lLayout.addComponent(lInput); final Table lSearchResult = new Table(); final Button lButton = new Button(lMessages.getMessage("ui.search.view.button.search")); //$NON-NLS-1$ lButton.setClickShortcut(KeyCode.ENTER); lButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { final String lQuery = lSearch.getValue().toString().trim(); if (lQuery.length() <= MIN_INPUT) { Notification.show(lMessages.getMessage("errmsg.search.noInput"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } else { try { initTable(inTask.search(lQuery), lSearchResult); lSearchResult.setVisible(true); } catch (final NoHitsException exc) { lSearchResult.setVisible(false); Notification.show( lMessages.getFormattedMessage("errmsg.search.noHits", exc.getQueryString()), //$NON-NLS-1$ Type.WARNING_MESSAGE); } catch (final Exception exc) { lSearchResult.setVisible(false); Notification.show(lMessages.getMessage("errmsg.search.wrongInput"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } } }); lLayout.addComponent(lButton); lLayout.addComponent(RiplaViewHelper.createSpacer()); lSearchResult.setVisible(false); lSearchResult.setWidth("100%"); //$NON-NLS-1$ lSearchResult.setColumnCollapsingAllowed(true); lSearchResult.setColumnReorderingAllowed(true); lSearchResult.setSelectable(true); lSearchResult.setImmediate(true); lSearchResult.addValueChangeListener(inTask); lLayout.addComponent(lSearchResult); }
From source file:org.hip.vif.skin.dflt.Skin.java
License:Open Source License
@Override public Component getHeader(final String inAppName) { final HorizontalLayout outLayout = new HorizontalLayout(); outLayout.setStyleName("vif-head"); outLayout.setMargin(false); outLayout.setWidth("100%"); outLayout.setHeight(80, Unit.PIXELS); final Embedded lImage = new Embedded(); lImage.setSource(new ThemeResource("images/vifLogo.gif")); outLayout.addComponent(lImage);//from w ww . j a v a 2 s . c om outLayout.setComponentAlignment(lImage, Alignment.TOP_LEFT); outLayout.setExpandRatio(lImage, 0.42f); final Label lTitle = LabelHelper.createLabel("VIF Forum", "vif-head-title"); lTitle.setSizeUndefined(); outLayout.addComponent(lTitle); outLayout.setComponentAlignment(lTitle, Alignment.MIDDLE_LEFT); outLayout.setExpandRatio(lTitle, 0.58f); return outLayout; }
From source file:org.iespuigcastellar.attendancemanager.screenlayouts.NewEditTeachersLayout.java
License:Open Source License
private void initLayout() { VerticalLayout left = new VerticalLayout(); left.setSizeFull();//from w w w.j av a 2s. c o m left.addComponent(teachersTable); teachersTable.setSizeFull(); left.setExpandRatio(teachersTable, 1); filterHorizontalLayout.setWidth("100%"); left.addComponent(filterHorizontalLayout); this.addComponent(left); VerticalLayout right = new VerticalLayout(); HorizontalLayout controlsHorizontalLayout = new HorizontalLayout(); newButton = new Button("New", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { // TODO Auto-generated method stub System.out.println("Nuevo profesor !!!"); Object id = teachersTable.addItem(); teachersTable.setValue(id); teachersData.getContainerProperty(id, "id").setValue(0); teachersData.getContainerProperty(id, "login").setValue(""); teachersData.getContainerProperty(id, "password").setValue(""); teachersData.getContainerProperty(id, "comment").setValue(""); teachersData.getContainerProperty(id, "admin").setValue(new Boolean(false)); // <- REVISAR !!! deleteButton.setEnabled(false); saveButton.setVisible(true); updateButton.setVisible(false); } }); controlsHorizontalLayout.addComponent(newButton); deleteButton = new Button("Delete", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { System.out.println("Delete teacher " + teachersTable.getValue() + " on " + new java.util.Date()); app.storage.deleteTeacher((Integer) teachersTable.getValue()); teachersTable.removeItem(teachersTable.getValue()); teachersTable.select(null); newButton.setEnabled(true); deleteButton.setEnabled(false); } }); deleteButton.setEnabled(false); controlsHorizontalLayout.addComponent(deleteButton); controlsHorizontalLayout.setSpacing(true); controlsHorizontalLayout.setMargin(true); right.addComponent(new Panel("Controls", controlsHorizontalLayout)); saveButton = new Button("save", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { System.out.println("Save Button !!!"); deleteButton.setEnabled(false); teacherForm.commit(); Teacher t = new Teacher(Integer.valueOf((String) teacherForm.getField("id").getValue()), (String) teacherForm.getField("login").getValue(), (String) teacherForm.getField("password").getValue(), (String) teacherForm.getField("comment").getValue(), (Boolean) teacherForm.getField("admin").getValue()); int id = app.storage.addTeacher(t); //teachersTable.removeAllItems(); //loadData(); //teacherForm.getField("id").setValue(id); System.out.println(t); teachersTable.select(null); saveButton.setVisible(false); } }); saveButton.setVisible(false); updateButton = new Button("update", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { System.out.println("Update Button "); Teacher t = new Teacher(Integer.valueOf((String) teacherForm.getField("id").getValue()), (String) teacherForm.getField("login").getValue(), (String) teacherForm.getField("password").getValue(), (String) teacherForm.getField("comment").getValue(), (Boolean) teacherForm.getField("admin").getValue()); app.storage.updateTeacher(t); teacherForm.commit(); } }); updateButton.setVisible(false); teacherForm.getLayout().addComponent(saveButton); teacherForm.getLayout().addComponent(updateButton); teacherForm.setSizeFull(); teacherForm.getLayout().setMargin(true); teacherForm.setImmediate(true); //teacherForm.setEnabled(false); // teacher = new Teacher(0, "", "", "", false); // teacherItem = new BeanItem<Teacher>(teacher); teacherForm.setCaption("Teacher details"); teacherForm.setWriteThrough(false); teacherForm.setInvalidCommitted(false); teacherForm.setFormFieldFactory(new TeacherFieldFactory()); // teacherForm.setData(teacherItem); teacherForm.setVisibleItemProperties( Arrays.asList(new String[] { "id", "login", "password", "comment", "admin" })); right.addComponent(teacherForm); this.addComponent(right); }