/** * Gets the <code>ViewComponentPlugin</code> Id. This * is typically used to configure actions (toolbar buttons) * for this view. * @return A <code>String</code> representation of the Id * for the <code>ViewComponentPlugin</code>. */ public String getId() { return plugin.getId(); }
public String getViewName() { return plugin.getLabel(); }
public void setup(ViewComponentPlugin plugin) { this.workspace = plugin.getWorkspace(); }
private void showHelpIfPresent() { plugin.getHelpLink().ifPresent(l -> { try { Desktop.getDesktop().browse(l); } catch (IOException e1) { logger.warn("An error occurred whilst navigating to the help for the {} view. URL: {}", plugin.getLabel(), l); } }); }
private void createContent() { try { viewComponent = plugin.newInstance(); viewComponentHolder.add(viewComponent); viewComponent.setView(this); viewComponent.initialise(); } catch (Exception e) { logger.error("An error occurred whilst creating the view content for the '{}' view: {}", plugin.getLabel(), e); viewComponentHolder.add(ComponentFactory.createExceptionComponent( "An error occurred whilst creating the view", e, null)); } }
Set<String> categories = plugin.getCategorisations(); if (!categories.isEmpty()) { for (String category : categories) { Action action = new AbstractAction(plugin.getLabel()) { action.putValue(Action.SHORT_DESCRIPTION, plugin.getDocumentation()); subMenu.add(action);
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; }
/** * Shows the view that is identified by the specified id. * @param viewId The id of the view to be shown. * @return The <code>View</code> that was shown. If the * <code>View</code> could not be shown then the return * value is <code>null</code>. */ public View showView(String viewId) { ViewComponentPlugin plugin = pluginMap.get(viewId); if (plugin == null) { return null; } // We need to get hold of the views tab Workspace ws = plugin.getWorkspace(); if (ws instanceof TabbedWorkspace) { WorkspaceTab tab = ((TabbedWorkspace) ws).getSelectedTab(); // if (tab instanceof WorkspaceViewsTab) { View view = new View(plugin, plugin.getWorkspace()); DynamicConfigPanel pan = new DynamicConfigPanel(tab); pan.setCurrentComponent(view, plugin.getLabel()); pan.activate(); // ((WorkspaceViewsTab) tab).getViewsPane().addView(view, plugin.getLabel()); // } } return null; } }
private boolean canNavigate(String type){ ViewComponentPlugin plugin = getWorkspace().getViewManager().getViewComponentPlugin(getView().getId()); return plugin != null && plugin.getNavigates().contains(ProtegeProperties.getInstance().getProperty(type)); }
public void createUI() { initialisedContent = true; logger.debug("Creating the UI for the '{}' view", this.getViewName()); setLayout(new BorderLayout(0, 0)); viewComponentHolder = new JPanel(new BorderLayout()); viewBarComponent = new ViewBarComponent(getViewName(), plugin.getBackgroundColor(), viewComponentHolder); add(viewBarComponent); addViewManipulationActions(); createContent(); createViewToolBar(); viewBarComponent.getViewBar().getViewBanner().setPinned(pinned); }
private void createContent() { try { viewComponent = plugin.newInstance(); viewComponentHolder.add(viewComponent); viewComponent.setView(this); viewComponent.initialise(); } catch (Exception e) { ProtegeApplication.getErrorLog().logError(e); viewComponentHolder.add(ComponentFactory.createExceptionComponent( "An error occurred whilst creating the view", e, null)); } }
private void addViewManipulationActions() { // View manipulation toolbar ViewBanner viewBanner = viewBarComponent.getViewBar().getViewBanner(); plugin.getHelpLink().ifPresent(u -> viewBanner.addAction("Help", HelpIcon.get(), this::showHelpIfPresent)); viewBanner.addAction("Split vertically", SplitVerticallyIcon.get(), this::splitVertically); viewBanner.addAction("Split horizontally", SplitHorizontallyIcon.get(), this::splitHorizontally); viewBanner.addAction("Float", FloatIcon.get(), this::copyAndFloatView); viewBanner.addAction("Close", CloseIcon.get(), this::closeView); }
Set<String> categories = plugin.getCategorisations(); if (!categories.isEmpty()) { for (String category : categories) { Action action = new AbstractAction(plugin.getLabel()) { action.putValue(AbstractAction.SHORT_DESCRIPTION, plugin.getDocumentation()); subMenu.add(action);
View v = viewHolder.getView(plugin.getId()); if (v != null) { v.closeView(); ViewComponent viewComponent = plugin.newInstance(); viewComponent.setup(plugin); viewHolder.addView(view);
/** * Shows the view that is identified by the specified id. * @param viewId The id of the view to be shown. * @return The <code>View</code> that was shown. If the * <code>View</code> could not be shown then the return * value is <code>null</code>. */ public View showView(String viewId) { ViewComponentPlugin plugin = pluginMap.get(viewId); if (plugin == null) { return null; } // We need to get hold of the views tab Workspace ws = plugin.getWorkspace(); if (ws instanceof TabbedWorkspace) { WorkspaceTab tab = ((TabbedWorkspace) ws).getSelectedTab(); // if (tab instanceof WorkspaceViewsTab) { View view = new View(plugin, plugin.getWorkspace()); DynamicConfigPanel pan = new DynamicConfigPanel(tab); pan.setCurrentComponent(view, plugin.getLabel()); pan.activate(); // ((WorkspaceViewsTab) tab).getViewsPane().addView(view, plugin.getLabel()); // } } return null; } }
private boolean canNavigate(String type){ ViewComponentPlugin plugin = getWorkspace().getViewManager().getViewComponentPlugin(getView().getId()); return plugin != null && plugin.getNavigates().contains(ProtegeProperties.getInstance().getProperty(type)); }
public void createUI() { initialisedContent = true; logger.debug("Creating UI for " + this.getViewName()); setLayout(new BorderLayout(3, 3)); viewComponentHolder = new JPanel(new BorderLayout()); viewBarComponent = new ViewBarComponent(getViewName(), plugin.getBackgroundColor(), viewComponentHolder); add(viewBarComponent); addViewManipulationActions(); createContent(); createViewToolBar(); viewBarComponent.getViewBar().getViewBanner().setPinned(pinned); }
private void createContent() { try { viewComponent = plugin.newInstance(); viewComponentHolder.add(viewComponent); viewComponent.setView(this); viewComponent.initialise(); } catch (Exception e) { ProtegeApplication.getErrorLog().logError(e); viewComponentHolder.add(ComponentFactory.createExceptionComponent( "An error occurred whilst creating the view", e, null)); } }
Set<String> categories = plugin.getCategorisations(); if (!categories.isEmpty()) { for (String category : categories) { Action action = new AbstractAction(plugin.getLabel()) { action.putValue(AbstractAction.SHORT_DESCRIPTION, plugin.getDocumentation()); subMenu.add(action);
/** * Gets the <code>ViewComponentPlugin</code> Id. This * is typically used to configure actions (toolbar buttons) * for this view. * @return A <code>String</code> representation of the Id * for the <code>ViewComponentPlugin</code>. */ public String getId() { return plugin.getId(); }