private void selectEntity() { Optional<OWLEntity> selectedEntity = searchPanel.getSelectedEntity(); if (selectedEntity.isPresent()) { editorKit.getOWLWorkspace().getOWLSelectionModel().setSelectedEntity(selectedEntity.get()); editorKit.getOWLWorkspace().displayOWLEntity(selectedEntity.get()); } }
protected WebMarkupContainer initialiseSearchPanel() { searchComponentPanel = new SearchPanel( "searchComponentPanel", arkCrudContainerVO, feedBackPanel, containerForm, pageableListView); searchComponentPanel.initialisePanel(cpModel); arkCrudContainerVO.getSearchPanelContainer().add(searchComponentPanel); return arkCrudContainerVO.getSearchPanelContainer(); }
public SearchDialogPanel(OWLEditorKit editorKit) { this.editorKit = editorKit; setLayout(new BorderLayout()); searchField = new AugmentedJTextField("Enter search string"); searchPanel = new SearchPanel(editorKit); add(searchField, BorderLayout.NORTH); add(searchPanel, BorderLayout.CENTER); searchField.addKeyListener( new KeyAdapter() { public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { selectEntity(); } } public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP) { searchPanel.moveSelectionUp(); e.consume(); } if (e.getKeyCode() == KeyEvent.VK_DOWN) { searchPanel.moveSelectionDown(); e.consume(); } } }); searchField .getDocument() .addDocumentListener( new DocumentListener() { public void changedUpdate(DocumentEvent e) {} public void insertUpdate(DocumentEvent e) { performSearch(); } public void removeUpdate(DocumentEvent e) { performSearch(); } }); searchPanel.setSearchResultClickedListener( new SearchResultClickedListener() { @Override public void handleSearchResultClicked(SearchResult searchResult, MouseEvent e) { if (e.getClickCount() == 2) { selectEntity(); } } }); }
/** * Default constructor. * * @param man view manager */ public EditorView(final ViewNotifier man) { super(EDITORVIEW, man); if (Prop.langright) applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); border(6, 6, 6, 6).layout(new BorderLayout(0, 2)).setFocusable(false); header = new BaseXLabel(EDITOR, true, false); final BaseXButton srch = new BaseXButton(gui, "search", H_REPLACE); final BaseXButton openB = BaseXButton.command(GUICommands.C_EDITOPEN, gui); final BaseXButton saveB = new BaseXButton(gui, "save", H_SAVE); hist = new BaseXButton(gui, "hist", H_RECENTLY_OPEN); final BaseXBack buttons = new BaseXBack(Fill.NONE); buttons.layout(new TableLayout(1, 4, 1, 0)); buttons.add(srch); buttons.add(openB); buttons.add(saveB); buttons.add(hist); final BaseXBack b = new BaseXBack(Fill.NONE).layout(new BorderLayout(8, 0)); if (Prop.langright) { b.add(header, BorderLayout.EAST); b.add(buttons, BorderLayout.WEST); } else { b.add(header, BorderLayout.CENTER); b.add(buttons, BorderLayout.EAST); } add(b, BorderLayout.NORTH); tabs = new BaseXTabs(gui); tabs.setFocusable(false); final SearchEditor se = new SearchEditor(gui, tabs, null).button(srch); search = se.panel(); addCreateTab(); add(se, BorderLayout.CENTER); // status and query pane search.editor(addTab(), false); info = new BaseXLabel().setText(OK, Msg.SUCCESS); pos = new BaseXLabel(" "); posCode.invokeLater(); stop = new BaseXButton(gui, "stop", H_STOP_PROCESS); stop.addKeyListener(this); stop.setEnabled(false); go = new BaseXButton(gui, "go", H_EXECUTE_QUERY); go.addKeyListener(this); filter = BaseXButton.command(GUICommands.C_FILTER, gui); filter.addKeyListener(this); filter.setEnabled(false); final BaseXBack status = new BaseXBack(Fill.NONE).layout(new BorderLayout(4, 0)); status.add(info, BorderLayout.CENTER); status.add(pos, BorderLayout.EAST); final BaseXBack query = new BaseXBack(Fill.NONE).layout(new TableLayout(1, 3, 1, 0)); query.add(stop); query.add(go); query.add(filter); final BaseXBack south = new BaseXBack(Fill.NONE).border(4, 0, 0, 0); south.layout(new BorderLayout(8, 0)); south.add(status, BorderLayout.CENTER); south.add(query, BorderLayout.EAST); add(south, BorderLayout.SOUTH); refreshLayout(); // add listeners saveB.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final JPopupMenu pop = new JPopupMenu(); final StringBuilder mnem = new StringBuilder(); final JMenuItem sa = GUIMenu.newItem(GUICommands.C_EDITSAVE, gui, mnem); final JMenuItem sas = GUIMenu.newItem(GUICommands.C_EDITSAVEAS, gui, mnem); GUICommands.C_EDITSAVE.refresh(gui, sa); GUICommands.C_EDITSAVEAS.refresh(gui, sas); pop.add(sa); pop.add(sas); pop.show(saveB, 0, saveB.getHeight()); } }); hist.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final JPopupMenu pm = new JPopupMenu(); final ActionListener al = new ActionListener() { @Override public void actionPerformed(final ActionEvent ac) { open(new IOFile(ac.getActionCommand())); } }; final StringList sl = new StringList(); for (final EditorArea ea : editors()) sl.add(ea.file.path()); for (final String en : new StringList().add(gui.gprop.strings(GUIProp.EDITOR)).sort(!Prop.WIN, true)) { final JMenuItem it = new JMenuItem(en); it.setEnabled(!sl.contains(en)); pm.add(it).addActionListener(al); } pm.show(hist, 0, hist.getHeight()); } }); refreshHistory(null); info.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(final MouseEvent e) { EditorArea ea = getEditor(); if (errFile != null) { ea = find(IO.get(errFile), false); if (ea == null) ea = open(new IOFile(errFile)); tabs.setSelectedComponent(ea); } if (errPos == -1) return; ea.jumpError(errPos); posCode.invokeLater(); } }); stop.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { stop.setEnabled(false); go.setEnabled(false); gui.stop(); } }); go.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { getEditor().release(Action.EXECUTE); } }); tabs.addChangeListener( new ChangeListener() { @Override public void stateChanged(final ChangeEvent e) { final EditorArea ea = getEditor(); if (ea == null) return; search.editor(ea, true); gui.refreshControls(); posCode.invokeLater(); } }); BaseXLayout.addDrop( this, new DropHandler() { @Override public void drop(final Object file) { if (file instanceof File) open(new IOFile((File) file)); } }); }
@Override public void refreshLayout() { header.setFont(GUIConstants.lfont); for (final EditorArea edit : editors()) edit.setFont(GUIConstants.mfont); search.refreshLayout(); }
public void setListenerForPanels(PatientSelectedListener listener) { notificationPanel.setPatientSelectedListener(listener); searchPanel.setPatientSelectedListener(listener); }
public void refreshPanels() { searchPanel.refreshList(); notificationPanel.refreshList(); }
public void setDbForPanels(List<Patient> db) { searchPanel.setDb(db); notificationPanel.setDb(db); }
private void performSearch() { searchPanel.setSearchString(searchField.getText().trim()); }
void clearSearch() { mSearchPanel.clear(); }