/** * 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<>(); }
/** * 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<ViewActionPlugin>(); addedViewActions = new HashSet<ViewAction>(); }
/** * 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<ViewActionPlugin>(); addedViewActions = new HashSet<ViewAction>(); }
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 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 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(event -> { if (!registeredListener){ addSelectionListener(e -> { boolean valid = getSelectedObjects() != null && !getSelectedObjects().isEmpty(); for (InputVerificationStatusChangedListener l : validateListeners){ l.verifiedStatusChanged(valid); } isValid = valid; }); registeredListener = true; } }); }
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(event -> { if (!registeredListener){ addSelectionListener(e -> { boolean valid = getSelectedObjects() != null && !getSelectedObjects().isEmpty(); for (InputVerificationStatusChangedListener l : validateListeners){ l.verifiedStatusChanged(valid); } isValid = valid; }); registeredListener = true; } }); }