private View createView(ViewComponentPlugin plugin) { View sv = new View(plugin, workspace); sv.pinned = true; return sv; }
/** * Creates a <code>View</code> that will display the * <code>ViewComponent</code> instantiated by the specified * tab view plugin. * @param plugin The <code>ViewComponentPlugin</code> that will * be reponsible for instantiating the content of this <code>View</code> * in the form of a <code>ViewComponent</code>. * @param workspace The parent <code>Workspace</code>. */ public View(ViewComponentPlugin plugin, Workspace workspace) { this.plugin = plugin; this.workspace = workspace; // Use a hierarchy listener so that we know when the view is // shown. When the view is shown, initialised it and remove // the hierarchy listener addHierarchyListener(new HierarchyListener() { public void hierarchyChanged(HierarchyEvent e) { if (initialisedContent == false && isShowing()) { createUI(); initialisedContent = true; removeHierarchyListener(this); } } }); additionalViewActionPlugins = new HashSet<>(); }
public void hierarchyChanged(HierarchyEvent e) { if (initialisedContent == false && isShowing()) { createUI(); initialisedContent = true; removeHierarchyListener(this); } } });
public void actionPerformed(ActionEvent e) { view.setSyncronizing(cb.isSelected()); view.setPinned(!cb.isSelected()); } });
public void windowClosing(WindowEvent e) { try { view.dispose(); view.getViewComponent().dispose(); } catch (Exception e1) { logger.warn("BAD VIEW: (" + view.getViewComponent().getClass().getSimpleName() + ") - exception on dispose: " + e1.getMessage()); } } });
protected void createUI() { setLayout(new BorderLayout()); ViewComponentPlugin plugin = getViewComponentPlugin(); view = new View(plugin, editorKit.getWorkspace()); view.setPinned(true); view.setSyncronizing(false); view.createUI(); view.setShowViewBanner(false); add(view); setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY), BorderFactory.createEmptyBorder(2, 2, 2, 2))); // only attach change listeners once the component is shown // (as those that use a view component are lazilly created) view.addHierarchyListener(new HierarchyListener(){ public void hierarchyChanged(HierarchyEvent event) { if (!registeredListener){ addSelectionListener(new ChangeListener(){ public void stateChanged(ChangeEvent event) { boolean valid = getSelectedObjects() != null && !getSelectedObjects().isEmpty(); for (InputVerificationStatusChangedListener l : validateListeners){ l.verifiedStatusChanged(valid); } isValid = valid; } }); registeredListener = true; } } }); }
protected void transmitSelection() { deletableChangeListenerMediator.fireStateChanged(this); E selEntity = getSelectedEntity(); if (selEntity != null) { final View view = getView(); if (view != null && !view.isPinned()){ view.setPinned(true); // so that we don't follow the selection setGlobalSelection(selEntity); view.setPinned(false); } else{ setGlobalSelection(selEntity); } } updateHeader(selEntity); }
public Map<String, String> getProperties(JComponent component) { if (component instanceof View == false) { logger.debug("Component is not a View - ignoring"); return Collections.EMPTY_MAP; } View view = (View) component; Map<String, String> map = new HashMap<String, String>(); map.put("pluginId", view.getId()); return map; } }
protected void setHeaderText(String text) { if (view != null) { view.setHeaderText(text); } }
public void visit(OWLAnnotationProperty owlAnnotationProperty) { View view = getOWLWorkspace().showResultsView("OWLAnnotationPropertyUsageView", true, OWLWorkspace.BOTTOM_RESULTS_VIEW); view.setPinned(true); }
private boolean canDisplay(OWLEntity owlEntity) { String entityCat = new NavFinder().getNav(owlEntity); // search the contained views to see if there is one that can show the entity for (View view : getViewsPane().getViews()){ ViewComponent vc = view.getViewComponent(); if (vc != null){ // if the view is on a tab that has been initialised ask it directly if (vc instanceof AbstractOWLSelectionViewComponent && vc instanceof SelectionDriver){ final AbstractOWLSelectionViewComponent owlEntityViewComponent = (AbstractOWLSelectionViewComponent)vc; if (owlEntityViewComponent.canShowEntity(owlEntity)){ lastEntityDisplayCandidate = Optional.of(view); return true; } } } else { // otherwise, ask its plugin ViewComponentPlugin plugin = getWorkspace().getViewManager().getViewComponentPlugin(view.getId()); if (plugin != null) { for (String nav : plugin.getNavigates()){ if (entityCat.equals(nav)){ lastEntityDisplayCandidate = Optional.of(view); return true; } } } } } return false; }
public void dispose() { if (view != null) { view.dispose(); } } }
protected boolean isSynchronizing() { if (view != null) { return view.isSyncronizing(); } return false; }
public AbstractOWLViewComponent getOWLViewComponent() { return (AbstractOWLViewComponent) getView().getViewComponent(); } }
public void closeView() { // Just remove from parent NodePanel nodePanel = (NodePanel) SwingUtilities.getAncestorOfClass(NodePanel.class, this); if (nodePanel != null) { getParent().remove(this); dispose(); nodePanel.rebuild(); nodePanel.repaint(); } else { if (getParent() instanceof ViewContainer) { ((ViewContainer) getParent()).closeView(this); dispose(); } } }
protected boolean isPinned() { if (view != null) { return view.isPinned(); } return false; }
public void addView(View view, String label) { view.createUI(); dynamicConfigPanel.setCurrentComponent(view, label); dynamicConfigPanel.activate(); }
public View showResultsView(ViewComponentPlugin plugin, boolean replace, int location) { try { ViewHolder viewHolder; if (location == BOTTOM_RESULTS_VIEW) { viewHolder = bottomResultsViewHolder; } else { viewHolder = leftResultsViewHolder; } if (replace) { View v = viewHolder.getView(plugin.getId()); if (v != null) { v.closeView(); } } View view = new View(plugin, this); ViewComponent viewComponent = plugin.newInstance(); viewComponent.setup(plugin); viewHolder.addView(view); return view; } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) { logger.error("An error occurred whilst instantiating the results view: {}", e); } return null; }
protected void createUI() { setLayout(new BorderLayout()); ViewComponentPlugin plugin = getViewComponentPlugin(); view = new View(plugin, editorKit.getWorkspace()); view.setPinned(true); view.setSyncronizing(false); view.createUI(); view.setShowViewBanner(false); add(view); setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY), BorderFactory.createEmptyBorder(2, 2, 2, 2))); // only attach change listeners once the component is shown // (as those that use a view component are lazilly created) view.addHierarchyListener(new HierarchyListener(){ public void hierarchyChanged(HierarchyEvent event) { if (!registeredListener){ addSelectionListener(new ChangeListener(){ public void stateChanged(ChangeEvent event) { boolean valid = getSelectedObjects() != null && !getSelectedObjects().isEmpty(); for (InputVerificationStatusChangedListener l : validateListeners){ l.verifiedStatusChanged(valid); } isValid = valid; } }); registeredListener = true; } } }); }
protected void transmitSelection() { deletableChangeListenerMediator.fireStateChanged(this); E selEntity = getSelectedEntity(); if (selEntity != null) { final View view = getView(); if (view != null && !view.isPinned()){ view.setPinned(true); // so that we don't follow the selection setGlobalSelection(selEntity); view.setPinned(false); } else{ setGlobalSelection(selEntity); } } updateHeader(selEntity); }