List of usage examples for com.vaadin.ui ProgressBar ProgressBar
public ProgressBar()
From source file:adminviews.MCCView.java
License:Open Source License
public MCCView(IOpenBisClient openbis, OpenbisCreationController creationController, String user) { this.openbis = openbis; this.creator = creationController; this.user = user; this.cases = new HashSet<String>(); this.patients = new ArrayList<String>(); mccProjects = new ComboBox("Source Project"); List<String> projects = new ArrayList<String>(); for (Project p : openbis.getProjectsOfSpace(mccSpace)) projects.add(p.getCode());//from w ww . jav a 2s. c o m mccProjects.addStyleName(Styles.boxTheme); mccProjects.addItems(projects); mccProjects.setImmediate(true); newProject = new StandardTextField("New Project"); newProject.setImmediate(true); newProject.setWidth("80px"); HorizontalLayout projectTab = new HorizontalLayout(); projectTab.setSpacing(true); projectTab.addComponent(mccProjects); projectTab.addComponent(newProject); treatment = new StandardTextField("Treatment"); timepoint = new StandardTextField("Timepoint"); timepoint.setWidth("40px"); patient = new StandardTextField("Patient #"); patient.setWidth("50px"); HorizontalLayout paramTab = new HorizontalLayout(); paramTab.setSpacing(true); paramTab.addComponent(treatment); paramTab.addComponent(patient); paramTab.addComponent(timepoint); existingPatients = new Table("Existing Patients"); existingPatients.setStyleName(Styles.tableTheme); existingPatients.setPageLength(1); editView = new TabSheet(); editView.addStyleName(ValoTheme.TABSHEET_FRAMED); samples = new Table("Samples"); samples.setStyleName(Styles.tableTheme); samples.setPageLength(1); metaData = new Table(); metaData.setEditable(true); metaData.setStyleName(Styles.tableTheme); editView.addTab(samples, "Overview"); editView.addTab(metaData, "Change Metadata"); editView.setVisible(false); registerInfo = new Label(); bar = new ProgressBar(); addSamples = new Button("Add Samples"); addSamples.setEnabled(false); initMCCListeners(); addComponent(Styles.questionize(projectTab, "Samples can only be added if Timepoint, Treatment, Project and Patient Number " + "are filled in and they don't already exist in the current project. E.g. you can add a new timepoint for the same patient and " + "treatment but not the same timepoint.", "Adding new Samples")); addComponent(paramTab); addComponent(existingPatients); addComponent(editView); addComponent(registerInfo); addComponent(bar); addComponent(addSamples); }
From source file:annis.gui.admin.GroupManagementPanel.java
License:Apache License
public GroupManagementPanel() { groupsContainer.setBeanIdProperty("name"); progress = new ProgressBar(); progress.setCaption("Loading group list"); progress.setIndeterminate(true);// w ww . java 2 s .c om progress.setVisible(false); GeneratedPropertyContainer generated = new GeneratedPropertyContainer(groupsContainer); generated.addGeneratedProperty("edit", new PropertyValueGenerator<String>() { @Override public String getValue(Item item, Object itemId, Object propertyId) { return "Edit"; } @Override public Class<String> getType() { return String.class; } }); groupsGrid.setContainerDataSource(generated); groupsGrid.setSelectionMode(Grid.SelectionMode.MULTI); groupsGrid.setSizeFull(); groupsGrid.setColumns("name", "edit", "corpora"); Grid.HeaderRow filterRow = groupsGrid.appendHeaderRow(); TextField groupFilterField = new TextField(); groupFilterField.setInputPrompt("Filter"); groupFilterField.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent event) { groupsContainer.removeContainerFilters("name"); if (!event.getText().isEmpty()) { groupsContainer .addContainerFilter(new SimpleStringFilter("name", event.getText(), true, false)); } } }); filterRow.getCell("name").setComponent(groupFilterField); TextField corpusFilterField = new TextField(); corpusFilterField.setInputPrompt("Filter by corpus"); corpusFilterField.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent event) { groupsContainer.removeContainerFilters("corpora"); if (!event.getText().isEmpty()) { groupsContainer.addContainerFilter(new StringPatternInSetFilter("corpora", event.getText())); } } }); filterRow.getCell("corpora").setComponent(corpusFilterField); Grid.Column editColumn = groupsGrid.getColumn("edit"); editColumn.setRenderer(new ButtonRenderer(new ClickableRenderer.RendererClickListener() { @Override public void click(ClickableRenderer.RendererClickEvent event) { Group g = groupsContainer.getItem(event.getItemId()).getBean(); FieldGroup fields = new FieldGroup(groupsContainer.getItem(event.getItemId())); fields.addCommitHandler(new GroupCommitHandler(g.getName())); EditSingleGroup edit = new EditSingleGroup(fields, corpusContainer); Window w = new Window("Edit group \"" + g.getName() + "\""); w.setContent(edit); w.setModal(true); w.setWidth("500px"); w.setHeight("250px"); UI.getCurrent().addWindow(w); } })); Grid.Column corporaColumn = groupsGrid.getColumn("corpora"); ; corporaColumn.setConverter(new CommaSeperatedStringConverterSet()); txtGroupName = new TextField(); txtGroupName.setInputPrompt("New group name"); Button btAddNewGroup = new Button("Add new group"); btAddNewGroup.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { handleAdd(); } }); btAddNewGroup.addStyleName(ChameleonTheme.BUTTON_DEFAULT); Button btDeleteGroup = new Button("Delete selected group(s)"); btDeleteGroup.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { // get selected groups Set<String> selectedGroups = new TreeSet<>(); for (Object id : groupsGrid.getSelectedRows()) { selectedGroups.add((String) id); } groupsGrid.getSelectionModel().reset(); for (GroupListView.Listener l : listeners) { l.deleteGroups(selectedGroups); } } }); actionLayout = new HorizontalLayout(txtGroupName, btAddNewGroup, btDeleteGroup); VerticalLayout layout = new VerticalLayout(actionLayout, progress, groupsGrid); layout.setSizeFull(); layout.setExpandRatio(groupsGrid, 1.0f); layout.setExpandRatio(progress, 1.0f); layout.setSpacing(true); layout.setMargin(new MarginInfo(true, false, false, false)); layout.setComponentAlignment(actionLayout, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(progress, Alignment.TOP_CENTER); setContent(layout); setSizeFull(); addActionHandler(new AddGroupHandler(txtGroupName)); }
From source file:annis.gui.admin.ImportPanel.java
License:Apache License
public ImportPanel() { setSizeFull();// www . j a v a 2 s . c om layout = new VerticalLayout(); layout.setWidth("100%"); layout.setHeight("100%"); layout.setMargin(true); setContent(layout); FormLayout form = new FormLayout(); layout.addComponent(form); cbOverwrite = new CheckBox("Overwrite existing corpus"); form.addComponent(cbOverwrite); txtMail = new TextField("e-mail address for status updates"); txtMail.addValidator(new EmailValidator("Must be a valid e-mail address")); form.addComponent(txtMail); txtAlias = new TextField("alias name"); form.addComponent(txtAlias); HorizontalLayout actionBar = new HorizontalLayout(); actionBar.setSpacing(true); actionBar.setWidth("100%"); upload = new Upload("", this); upload.setButtonCaption("Upload ZIP file with relANNIS corpus and start import"); upload.setImmediate(true); upload.addStartedListener(this); upload.addFinishedListener(this); upload.setEnabled(true); actionBar.addComponent(upload); progress = new ProgressBar(); progress.setIndeterminate(true); progress.setVisible(false); actionBar.addComponent(progress); lblProgress = new Label(); lblProgress.setWidth("100%"); actionBar.addComponent(lblProgress); actionBar.setExpandRatio(lblProgress, 1.0f); actionBar.setComponentAlignment(lblProgress, Alignment.MIDDLE_LEFT); actionBar.setComponentAlignment(upload, Alignment.MIDDLE_LEFT); actionBar.setComponentAlignment(progress, Alignment.MIDDLE_LEFT); layout.addComponent(actionBar); btDetailedLog = new Button(); btDetailedLog.setStyleName(BaseTheme.BUTTON_LINK); btDetailedLog.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { setLogVisible(!isLogVisible()); } }); layout.addComponent(btDetailedLog); txtMessages = new TextArea(); txtMessages.setSizeFull(); txtMessages.setValue(""); txtMessages.setReadOnly(true); layout.addComponent(txtMessages); layout.setExpandRatio(txtMessages, 1.0f); setLogVisible(false); appendMessage("Ready."); }
From source file:annis.gui.admin.UserManagementPanel.java
License:Apache License
public UserManagementPanel() { userContainer = new BeanContainer<>(User.class); userContainer.setBeanIdProperty("name"); progress = new ProgressBar(); progress.setCaption("Loading user list"); progress.setIndeterminate(true);/* w ww . ja v a 2s . c om*/ progress.setVisible(false); GeneratedPropertyContainer generated = new GeneratedPropertyContainer(userContainer); generated.addGeneratedProperty("edit", new PropertyValueGenerator<String>() { @Override public String getValue(Item item, Object itemId, Object propertyId) { return "Edit"; } @Override public Class<String> getType() { return String.class; } }); generated.addGeneratedProperty("changePassword", new PropertyValueGenerator<String>() { @Override public String getValue(Item item, Object itemId, Object propertyId) { return "Change password"; } @Override public Class<String> getType() { return String.class; } }); userList = new Grid(generated); userList.setSizeFull(); userList.setSelectionMode(Grid.SelectionMode.MULTI); userList.setColumns("name", "edit", "changePassword", "expires", "groups", "permissions"); HeaderRow filterRow = userList.appendHeaderRow(); TextField userFilterField = new TextField(); userFilterField.setInputPrompt("Filter"); userFilterField.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent event) { userContainer.removeContainerFilters("name"); if (!event.getText().isEmpty()) { userContainer.addContainerFilter(new SimpleStringFilter("name", event.getText(), true, false)); } } }); filterRow.getCell("name").setComponent(userFilterField); CheckBox expiredFilterField = new CheckBox("has expired"); expiredFilterField.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { userContainer.removeContainerFilters("expires"); if ((Boolean) event.getProperty().getValue() == true) { userContainer.addContainerFilter(new ExpiredUserFilter("expires")); } } }); filterRow.getCell("expires").setComponent(expiredFilterField); TextField groupFilterField = new TextField(); groupFilterField.setInputPrompt("Filter by groups"); groupFilterField.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent event) { userContainer.removeContainerFilters("groups"); if (!event.getText().isEmpty()) { userContainer.addContainerFilter( new GroupManagementPanel.StringPatternInSetFilter("groups", event.getText())); } } }); filterRow.getCell("groups").setComponent(groupFilterField); Grid.Column editColum = userList.getColumn("edit"); editColum.setRenderer(new ButtonRenderer(new ClickableRenderer.RendererClickListener() { @Override public void click(ClickableRenderer.RendererClickEvent event) { User u = userContainer.getItem(event.getItemId()).getBean(); FieldGroup group = new FieldGroup(userContainer.getItem(event.getItemId())); group.addCommitHandler(new UserCommitHandler(u.getName())); EditSingleUser edit = new EditSingleUser(group, groupsContainer, permissionsContainer); Window w = new Window("Edit user \"" + u.getName() + "\""); w.setContent(edit); w.setModal(true); w.setWidth("500px"); w.setHeight("400px"); UI.getCurrent().addWindow(w); } })); editColum.setHeaderCaption(""); editColum.setExpandRatio(0); Grid.Column passwordColumn = userList.getColumn("changePassword"); passwordColumn.setRenderer(new ButtonRenderer(new ClickableRenderer.RendererClickListener() { @Override public void click(ClickableRenderer.RendererClickEvent event) { UserManagementPanel.this.askForPasswordChange((String) event.getItemId()); } })); passwordColumn.setHeaderCaption(""); passwordColumn.setExpandRatio(0); userList.getColumn("name").setHeaderCaption("Username"); Grid.Column groupsColumm = userList.getColumn("groups"); groupsColumm.setHeaderCaption("Groups"); groupsColumm.setConverter(new CommaSeperatedStringConverterSet()); groupsColumm.setExpandRatio(1); Grid.Column permissionsColumn = userList.getColumn("permissions"); permissionsColumn.setHeaderCaption("Additional permissions"); permissionsColumn.setConverter(new CommaSeperatedStringConverterSet()); Grid.Column expiresColumn = userList.getColumn("expires"); expiresColumn.setHeaderCaption("Expiration Date"); expiresColumn.setConverter(new DateTimeStringConverter()); txtUserName = new TextField(); txtUserName.setInputPrompt("New user name"); Button btAddNewUser = new Button("Add new user"); btAddNewUser.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { handleAdd(); } }); btAddNewUser.addStyleName(ChameleonTheme.BUTTON_DEFAULT); Button btDeleteUser = new Button("Delete selected user(s)"); btDeleteUser.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { // get selected users Set<String> selectedUsers = new TreeSet<>(); for (Object id : userList.getSelectedRows()) { selectedUsers.add((String) id); } userList.getSelectionModel().reset(); for (UserListView.Listener l : listeners) { l.deleteUsers(selectedUsers); } } }); actionLayout = new HorizontalLayout(txtUserName, btAddNewUser, btDeleteUser); layout = new VerticalLayout(actionLayout, progress, userList); layout.setSizeFull(); layout.setExpandRatio(userList, 1.0f); layout.setExpandRatio(progress, 1.0f); layout.setSpacing(true); layout.setMargin(new MarginInfo(true, false, false, false)); layout.setComponentAlignment(actionLayout, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(progress, Alignment.TOP_CENTER); setContent(layout); setSizeFull(); addActionHandler(new AddUserHandler(txtUserName)); }
From source file:annis.gui.controlpanel.CorpusListPanel.java
License:Apache License
public CorpusListPanel(InstanceConfig instanceConfig, ExampleQueriesPanel autoGenQueries, final AnnisUI ui) { this.instanceConfig = instanceConfig; this.autoGenQueries = autoGenQueries; this.ui = ui; final CorpusListPanel finalThis = this; setSizeFull();/*from w w w . j a v a 2s .c o m*/ selectionLayout = new HorizontalLayout(); selectionLayout.setWidth("100%"); selectionLayout.setHeight("-1px"); selectionLayout.setVisible(false); Label lblVisible = new Label("Visible: "); lblVisible.setSizeUndefined(); selectionLayout.addComponent(lblVisible); cbSelection = new ComboBox(); cbSelection.setDescription("Choose corpus selection set"); cbSelection.setWidth("100%"); cbSelection.setHeight("-1px"); cbSelection.addStyleName(ValoTheme.COMBOBOX_SMALL); cbSelection.setInputPrompt("Add new corpus selection set"); cbSelection.setNullSelectionAllowed(false); cbSelection.setNewItemsAllowed(true); cbSelection.setNewItemHandler((AbstractSelect.NewItemHandler) this); cbSelection.setImmediate(true); cbSelection.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { updateCorpusTable(); updateAutoGeneratedQueriesPanel(); } }); selectionLayout.addComponent(cbSelection); selectionLayout.setExpandRatio(cbSelection, 1.0f); selectionLayout.setSpacing(true); selectionLayout.setComponentAlignment(cbSelection, Alignment.MIDDLE_RIGHT); selectionLayout.setComponentAlignment(lblVisible, Alignment.MIDDLE_LEFT); addComponent(selectionLayout); txtFilter = new TextField(); txtFilter.setVisible(false); txtFilter.setInputPrompt("Filter"); txtFilter.setImmediate(true); txtFilter.setTextChangeTimeout(500); txtFilter.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent event) { BeanContainer<String, AnnisCorpus> availableCorpora = ui.getQueryState().getAvailableCorpora(); if (textFilter != null) { // remove the old filter availableCorpora.removeContainerFilter(textFilter); textFilter = null; } if (event.getText() != null && !event.getText().isEmpty()) { Set<String> selectedIDs = ui.getQueryState().getSelectedCorpora().getValue(); textFilter = new SimpleStringFilter("name", event.getText(), true, false); availableCorpora.addContainerFilter(textFilter); // select the first item List<String> filteredIDs = availableCorpora.getItemIds(); Set<String> selectedAndFiltered = new HashSet<>(selectedIDs); selectedAndFiltered.retainAll(filteredIDs); Set<String> selectedAndOutsideFilter = new HashSet<>(selectedIDs); selectedAndOutsideFilter.removeAll(filteredIDs); for (String id : selectedAndOutsideFilter) { tblCorpora.unselect(id); } if (selectedAndFiltered.isEmpty() && !filteredIDs.isEmpty()) { for (String id : selectedIDs) { tblCorpora.unselect(id); } tblCorpora.select(filteredIDs.get(0)); } } } }); txtFilter.setWidth("100%"); txtFilter.setHeight("-1px"); txtFilter.addStyleName(ValoTheme.TEXTFIELD_SMALL); addComponent(txtFilter); pbLoadCorpora = new ProgressBar(); pbLoadCorpora.setCaption("Loading corpus list..."); pbLoadCorpora.setIndeterminate(true); addComponent(pbLoadCorpora); tblCorpora = new Table(); addComponent(tblCorpora); tblCorpora.setVisible(false); // don't show list before it was not loaded tblCorpora.setContainerDataSource(ui.getQueryState().getAvailableCorpora()); tblCorpora.setMultiSelect(true); tblCorpora.setPropertyDataSource(ui.getQueryState().getSelectedCorpora()); tblCorpora.addGeneratedColumn("info", new InfoGenerator()); tblCorpora.addGeneratedColumn("docs", new DocLinkGenerator()); tblCorpora.setVisibleColumns("name", "textCount", "tokenCount", "info", "docs"); tblCorpora.setColumnHeaders("Name", "Texts", "Tokens", "", ""); tblCorpora.setHeight("100%"); tblCorpora.setWidth("100%"); tblCorpora.setSelectable(true); tblCorpora.setNullSelectionAllowed(false); tblCorpora.setColumnExpandRatio("name", 0.6f); tblCorpora.setColumnExpandRatio("textCount", 0.15f); tblCorpora.setColumnExpandRatio("tokenCount", 0.25f); tblCorpora.addStyleName(ValoTheme.TABLE_SMALL); tblCorpora.addActionHandler((Action.Handler) this); tblCorpora.setImmediate(true); tblCorpora.addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { Set selections = (Set) tblCorpora.getValue(); if (selections.size() == 1 && event.isCtrlKey() && tblCorpora.isSelected(event.getItemId())) { tblCorpora.setValue(null); } } }); tblCorpora.setItemDescriptionGenerator(new TooltipGenerator()); tblCorpora.addValueChangeListener(new CorpusTableChangedListener(finalThis)); Button btReload = new Button(); btReload.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { updateCorpusSetList(false, false); Notification.show("Reloaded corpus list", Notification.Type.HUMANIZED_MESSAGE); } }); btReload.setIcon(FontAwesome.REFRESH); btReload.setDescription("Reload corpus list"); btReload.addStyleName(ValoTheme.BUTTON_ICON_ONLY); selectionLayout.addComponent(btReload); selectionLayout.setComponentAlignment(btReload, Alignment.MIDDLE_RIGHT); tblCorpora.setSortContainerPropertyId("name"); setExpandRatio(tblCorpora, 1.0f); updateCorpusSetList(true, true); }
From source file:annis.gui.controlpanel.QueryPanel.java
License:Apache License
public QueryPanel(final AnnisUI ui) { super(4, 5);// w w w .j a v a 2 s . co m this.ui = ui; this.lastPublicStatus = "Welcome to ANNIS! " + "A tutorial is available on the right side."; this.state = ui.getQueryState(); setSpacing(true); setMargin(false); setRowExpandRatio(0, 1.0f); setColumnExpandRatio(0, 0.0f); setColumnExpandRatio(1, 0.1f); setColumnExpandRatio(2, 0.0f); setColumnExpandRatio(3, 0.0f); txtQuery = new AqlCodeEditor(); txtQuery.setPropertyDataSource(state.getAql()); txtQuery.setInputPrompt("Please enter AQL query"); txtQuery.addStyleName("query"); if (ui.getInstanceFont() == null) { txtQuery.addStyleName("default-query-font"); txtQuery.setTextareaStyle("default-query-font"); } else { txtQuery.addStyleName(Helper.CORPUS_FONT); txtQuery.setTextareaStyle(Helper.CORPUS_FONT); } txtQuery.addStyleName("keyboardInput"); txtQuery.setWidth("100%"); txtQuery.setHeight(15f, Unit.EM); txtQuery.setTextChangeTimeout(500); final VirtualKeyboardCodeEditor virtualKeyboard; if (ui.getInstanceConfig().getKeyboardLayout() == null) { virtualKeyboard = null; } else { virtualKeyboard = new VirtualKeyboardCodeEditor(); virtualKeyboard.setKeyboardLayout(ui.getInstanceConfig().getKeyboardLayout()); virtualKeyboard.extend(txtQuery); } txtStatus = new TextArea(); txtStatus.setValue(this.lastPublicStatus); txtStatus.setWidth("100%"); txtStatus.setHeight(4.0f, Unit.EM); txtStatus.addStyleName("border-layout"); txtStatus.setReadOnly(true); piCount = new ProgressBar(); piCount.setIndeterminate(true); piCount.setEnabled(false); piCount.setVisible(false); btShowResult = new Button("Search"); btShowResult.setIcon(FontAwesome.SEARCH); btShowResult.setWidth("100%"); btShowResult.addClickListener(new ShowResultClickListener()); btShowResult.setDescription("<strong>Show Result</strong><br />Ctrl + Enter"); btShowResult.setClickShortcut(KeyCode.ENTER, ModifierKey.CTRL); btShowResult.setDisableOnClick(true); VerticalLayout historyListLayout = new VerticalLayout(); historyListLayout.setSizeUndefined(); lstHistory = new ListSelect(); lstHistory.setWidth("200px"); lstHistory.setNullSelectionAllowed(false); lstHistory.setValue(null); lstHistory.addValueChangeListener((ValueChangeListener) this); lstHistory.setImmediate(true); lstHistory.setContainerDataSource(historyContainer); lstHistory.setItemCaptionPropertyId("query"); lstHistory.addStyleName(Helper.CORPUS_FONT); Button btShowMoreHistory = new Button("Show more details", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (historyWindow == null) { historyWindow = new Window("History"); historyWindow.setModal(false); historyWindow.setWidth("400px"); historyWindow.setHeight("250px"); } historyWindow.setContent(new HistoryPanel(state.getHistory(), ui.getQueryController())); if (UI.getCurrent().getWindows().contains(historyWindow)) { historyWindow.bringToFront(); } else { UI.getCurrent().addWindow(historyWindow); } } }); btShowMoreHistory.setWidth("100%"); historyListLayout.addComponent(lstHistory); historyListLayout.addComponent(btShowMoreHistory); historyListLayout.setExpandRatio(lstHistory, 1.0f); historyListLayout.setExpandRatio(btShowMoreHistory, 0.0f); btHistory = new PopupButton("History"); btHistory.setContent(historyListLayout); btHistory.setDescription("<strong>Show History</strong><br />" + "Either use the short overview (arrow down) or click on the button " + "for the extended view."); Button btShowKeyboard = null; if (virtualKeyboard != null) { btShowKeyboard = new Button(); btShowKeyboard.setWidth("100%"); btShowKeyboard.setDescription("Click to show a virtual keyboard"); btShowKeyboard.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btShowKeyboard.addStyleName(ValoTheme.BUTTON_SMALL); btShowKeyboard.setIcon(new ClassResource(VirtualKeyboardCodeEditor.class, "keyboard.png")); btShowKeyboard.addClickListener(new ShowKeyboardClickListener(virtualKeyboard)); } Button btShowQueryBuilder = new Button("Query<br />Builder"); btShowQueryBuilder.setHtmlContentAllowed(true); btShowQueryBuilder.addStyleName(ValoTheme.BUTTON_SMALL); btShowQueryBuilder.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); btShowQueryBuilder.setIcon(new ThemeResource("images/tango-icons/32x32/document-properties.png")); btShowQueryBuilder.addClickListener(new ShowQueryBuilderClickListener(ui)); VerticalLayout moreActionsLayout = new VerticalLayout(); moreActionsLayout.setWidth("250px"); btMoreActions = new PopupButton("More"); btMoreActions.setContent(moreActionsLayout); // btShowResultNewTab = new Button("Search (open in new tab)"); // btShowResultNewTab.setWidth("100%"); // btShowResultNewTab.addClickListener(new ShowResultInNewTabClickListener()); // btShowResultNewTab.setDescription("<strong>Show Result and open result in new tab</strong><br />Ctrl + Shift + Enter"); // btShowResultNewTab.setDisableOnClick(true); // btShowResultNewTab.setClickShortcut(KeyCode.ENTER, ModifierKey.CTRL, ModifierKey.SHIFT); // moreActionsLayout.addComponent(btShowResultNewTab); Button btShowExport = new Button("Export", new ShowExportClickListener(ui)); btShowExport.setIcon(FontAwesome.DOWNLOAD); btShowExport.setWidth("100%"); moreActionsLayout.addComponent(btShowExport); Button btShowFrequency = new Button("Frequency Analysis", new ShowFrequencyClickListener(ui)); btShowFrequency.setIcon(FontAwesome.BAR_CHART_O); btShowFrequency.setWidth("100%"); moreActionsLayout.addComponent(btShowFrequency); /* * We use the grid layout for a better rendering efficiency, but this comes * with the cost of some complexity when defining the positions of the * elements in the layout. * * This grid hopefully helps a little bit in understanding the "magic" * numbers better. * * Q: Query text field * QB: Button to toggle query builder // TODO * KEY: Button to show virtual keyboard * SEA: "Search" button * MOR: "More actions" button * HIST: "History" button * STAT: Text field with the real status * PROG: indefinite progress bar (spinning circle) * * \ 0 | 1 | 2 | 3 * --+-----+---+---+---+----- * 0 | Q | Q | Q | QB * --+-----+-----+-----+----- * 1 | Q | Q | Q | KEY * --+-----+-----+-----+----- * 2 | SEA | MOR | HIST| * --+-----+-----+-----+----- * 3 | STAT| STAT| STAT| PROG */ addComponent(txtQuery, 0, 0, 2, 1); addComponent(txtStatus, 0, 3, 2, 3); addComponent(btShowResult, 0, 2); addComponent(btMoreActions, 1, 2); addComponent(btHistory, 2, 2); addComponent(piCount, 3, 3); addComponent(btShowQueryBuilder, 3, 0); if (btShowKeyboard != null) { addComponent(btShowKeyboard, 3, 1); } // alignment setRowExpandRatio(0, 0.0f); setRowExpandRatio(1, 1.0f); setColumnExpandRatio(0, 1.0f); setColumnExpandRatio(1, 0.0f); setColumnExpandRatio(2, 0.0f); setColumnExpandRatio(3, 0.0f); //setComponentAlignment(btShowQueryBuilder, Alignment.BOTTOM_CENTER); }
From source file:annis.gui.controlpanel.SearchOptionsPanel.java
License:Apache License
public SearchOptionsPanel() { setWidth("100%"); setHeight("-1px"); pbLoadConfig = new ProgressBar(); pbLoadConfig.setIndeterminate(true); pbLoadConfig.setCaption("Loading search options..."); addComponent(pbLoadConfig);/*w ww . ja v a 2 s . c om*/ cbLeftContext = new ComboBox("Left Context", contextContainerLeft); cbRightContext = new ComboBox("Right Context", contextContainerRight); cbResultsPerPage = new ComboBox("Results Per Page", resultsPerPageContainer); cbLeftContext.setNullSelectionAllowed(false); cbRightContext.setNullSelectionAllowed(false); cbResultsPerPage.setNullSelectionAllowed(false); cbLeftContext.setNewItemsAllowed(true); cbRightContext.setNewItemsAllowed(true); cbResultsPerPage.setNewItemsAllowed(true); cbLeftContext.setTextInputAllowed(true); cbRightContext.setTextInputAllowed(true); cbResultsPerPage.setTextInputAllowed(true); cbLeftContext.setImmediate(true); cbRightContext.setImmediate(true); cbResultsPerPage.setImmediate(true); cbSegmentation = new ComboBox("Show context in", segmentationContainer); cbSegmentation.setTextInputAllowed(false); cbSegmentation.setNullSelectionAllowed(true); cbSegmentation.setNewItemsAllowed(true); cbSegmentation.setNullSelectionItemId(NULL_SEGMENTATION_VALUE); cbSegmentation.addItem(NULL_SEGMENTATION_VALUE); cbSegmentation.setDescription("If corpora with multiple " + "context definitions are selected, a list of available context units will be " + "displayed. By default context is calculated in tokens " + "(e.g. 5 minimal units to the left and right of a search result). " + "Some corpora might offer further context definitions, e.g. in " + "syllables, word forms belonging to different speakers, normalized or " + "diplomatic segmentations of a manuscript, etc."); segmentationHelp = new HelpButton(cbSegmentation); cbOrder = new ComboBox("Order", orderContainer); cbOrder.setNewItemsAllowed(false); cbOrder.setNullSelectionAllowed(false); cbOrder.setImmediate(true); cbLeftContext.setVisible(false); cbRightContext.setVisible(false); cbResultsPerPage.setVisible(false); cbOrder.setVisible(false); segmentationHelp.setVisible(false); addComponent(cbLeftContext); addComponent(cbRightContext); addComponent(segmentationHelp); addComponent(cbResultsPerPage); addComponent(cbOrder); }
From source file:annis.gui.docbrowser.DocBrowserPanel.java
License:Apache License
private DocBrowserPanel(AnnisUI ui, String corpus) { this.ui = ui; this.corpus = corpus; // init layout layout = new VerticalLayout(); setContent(layout);/*from w w w . j a v a 2 s . c o m*/ layout.setSizeFull(); layout.addStyleName(ChameleonTheme.PANEL_BORDERLESS); setSizeFull(); progress = new ProgressBar(); progress.setIndeterminate(true); progress.setSizeFull(); }
From source file:annis.gui.ExampleQueriesPanel.java
License:Apache License
public ExampleQueriesPanel(AnnisUI ui, HelpPanel parentTab) { super();//from w ww .ja v a2 s . c o m this.ui = ui; this.parentTab = parentTab; loadingIndicator = new ProgressBar(); loadingIndicator.setIndeterminate(true); loadingIndicator.setCaption("Loading example queries..."); loadingIndicator.setVisible(false); addComponent(loadingIndicator); table = new Table(); table.setVisible(true); // egContainer = new BeanItemContainer<>(ExampleQuery.class); table.setContainerDataSource(egContainer); addComponent(table); setUpTable(); }
From source file:annis.gui.ExportPanel.java
License:Apache License
public ExportPanel(QueryPanel queryPanel, QueryController controller, QueryUIState state) { super(2, 3);// w ww. j av a2s .c o m this.queryPanel = queryPanel; this.controller = controller; this.state = state; this.eventBus = new EventBus(); this.eventBus.register(ExportPanel.this); this.formLayout = new FormLayout(); formLayout.setWidth("-1px"); setWidth("99%"); setHeight("-1px"); initHelpMessages(); setColumnExpandRatio(0, 0.0f); setColumnExpandRatio(1, 1.0f); cbExporter = new ComboBox("Exporter"); cbExporter.setNewItemsAllowed(false); cbExporter.setNullSelectionAllowed(false); cbExporter.setImmediate(true); for (Exporter e : SearchView.EXPORTER) { cbExporter.addItem(e.getClass().getSimpleName()); } cbExporter.setValue(SearchView.EXPORTER[0].getClass().getSimpleName()); cbExporter.addValueChangeListener(new ExporterSelectionHelpListener()); formLayout.addComponent(cbExporter); addComponent(formLayout, 0, 0); lblHelp = new Label(help4Exporter.get((String) cbExporter.getValue())); lblHelp.setContentMode(ContentMode.HTML); addComponent(lblHelp, 1, 0); cbLeftContext = new ComboBox("Left Context"); cbRightContext = new ComboBox("Right Context"); cbLeftContext.setNullSelectionAllowed(false); cbRightContext.setNullSelectionAllowed(false); cbLeftContext.setNewItemsAllowed(true); cbRightContext.setNewItemsAllowed(true); cbLeftContext .addValidator(new IntegerRangeValidator("must be a number", Integer.MIN_VALUE, Integer.MAX_VALUE)); cbRightContext .addValidator(new IntegerRangeValidator("must be a number", Integer.MIN_VALUE, Integer.MAX_VALUE)); for (Integer i : SearchOptionsPanel.PREDEFINED_CONTEXTS) { cbLeftContext.addItem(i); cbRightContext.addItem(i); } cbLeftContext.setValue(5); cbRightContext.setValue(5); formLayout.addComponent(cbLeftContext); formLayout.addComponent(cbRightContext); txtAnnotationKeys = new TextField("Annotation Keys"); txtAnnotationKeys.setDescription("Some exporters will use this comma " + "seperated list of annotation keys to limit the exported data to these " + "annotations."); formLayout.addComponent(new HelpButton(txtAnnotationKeys)); txtParameters = new TextField("Parameters"); txtParameters.setDescription( "You can input special parameters " + "for certain exporters. See the description of each exporter " + "(? button above) for specific parameter settings."); formLayout.addComponent(new HelpButton(txtParameters)); btExport = new Button("Perform Export"); btExport.setIcon(FontAwesome.PLAY); btExport.setDisableOnClick(true); btExport.addClickListener(new ExportButtonListener()); btCancel = new Button("Cancel Export"); btCancel.setIcon(FontAwesome.TIMES_CIRCLE); btCancel.setEnabled(false); btCancel.addClickListener(new CancelButtonListener()); btCancel.setVisible(SearchView.EXPORTER[0].isCancelable()); btDownload = new Button("Download"); btDownload.setDescription("Click here to start the actual download."); btDownload.setIcon(FontAwesome.DOWNLOAD); btDownload.setDisableOnClick(true); btDownload.setEnabled(false); HorizontalLayout layoutExportButtons = new HorizontalLayout(btExport, btCancel, btDownload); addComponent(layoutExportButtons, 0, 1, 1, 1); VerticalLayout vLayout = new VerticalLayout(); addComponent(vLayout, 0, 2, 1, 2); progressBar = new ProgressBar(); progressBar.setVisible(false); progressBar.setIndeterminate(true); vLayout.addComponent(progressBar); progressLabel = new Label(); vLayout.addComponent(progressLabel); if (state != null) { cbLeftContext.setPropertyDataSource(state.getLeftContext()); cbRightContext.setPropertyDataSource(state.getRightContext()); cbExporter.setPropertyDataSource(state.getExporterName()); state.getExporterName().setValue(SearchView.EXPORTER[0].getClass().getSimpleName()); txtAnnotationKeys.setConverter(new CommaSeperatedStringConverterList()); txtAnnotationKeys.setPropertyDataSource(state.getExportAnnotationKeys()); txtParameters.setPropertyDataSource(state.getExportParameters()); } }