protected void onSelectEntity() { if (selectWindow == null) { selectWindow = new com.gwtext.client.widgets.Window(); selectWindow.setTitle(getFieldLabel()); selectWindow.setWidth(600); selectWindow.setHeight(480); selectWindow.setMinWidth(300); selectWindow.setMinHeight(350); selectWindow.setLayout(new FitLayout()); selectWindow.setPaddings(5); selectWindow.setButtonAlign(Position.CENTER); // window.setCloseAction(Window.HIDE); selectWindow.setPlain(true); com.gwtext.client.widgets.Button cancelButton = new com.gwtext.client.widgets.Button("Cancel"); cancelButton.addListener( new ButtonListenerAdapter() { @Override public void onClick(Button button, EventObject e) { selectWindow.hide(); } }); com.gwtext.client.widgets.Button selectButton = new com.gwtext.client.widgets.Button("Select"); selectButton.addListener( new ButtonListenerAdapter() { @Override public void onClick(Button button, EventObject e) { Collection<EntityData> selection = getSelectable().getSelection(); if (selection == null || selection.size() == 0) { MessageBox.alert( "No selection", "No class selected. Please select a class from the tree."); return; } setClsValues(selection); selectWindow.hide(); } }); selectWindow.add(getSelectable()); selectWindow.addButton(selectButton); selectWindow.addButton(cancelButton); } if (!selectWindow.isVisible()) { selectWindow.show(); selectWindow.center(); } }
/** * Default constructor. * * @param resultsListView the instance of the results list view to use */ public SearchForm(SearchResultsListView resultsListView) { super(); setBorder(false); setHideLabels(true); // using an inner panel to customize the layout Panel innerPanel = new Panel(); innerPanel.setBorder(false); innerPanel.setLayout(new HorizontalLayout(5)); searchInput = new TextField(); searchInput.setName(SearchLookupConfiguration.IN_QUERY); searchInput.setWidth(200); // width of search input box setFieldListeners(searchInput); innerPanel.add(searchInput); Button submitButton = makeStandardSubmitButton(UtilUi.MSG.search()); innerPanel.add(submitButton); add(innerPanel); win = new Window(UtilUi.MSG.searchResults()); win.setModal(false); win.setResizable(true); win.setMinHeight(RESULT_HEIGHT); win.setLayout(new FitLayout()); win.setCloseAction(Window.HIDE); results = resultsListView; results.setFrame(false); results.setAutoHeight(false); results.setCollapsible(false); results.setHeader(false); results.setBorder(false); results.setWidth(RESULT_WIDTH); win.add(results); }