/** Delete a panel from Show Panel sub menu */ public void deletePanel(Editor panel) { if (log.isDebugEnabled()) { log.debug("deletePanel"); } if (panelsList.size() == 0) { return; } for (int i = 0; i < panelsList.size(); i++) { Object o = panelsList.get(i); if (o == panel) { // Editors that are their own TargetFrame dispose themselves if (!panel.equals(panel.getTargetFrame())) { panel.getTargetFrame().dispose(); } panelsList.remove(panel); panelsSubMenu.remove(i); // If there are no panels on the list, // replace the 'No Panels' menu item if (panelsList.size() == 0) { panelsSubMenu.add(noPanelsItem); } return; } } }
/** Update an Editor type panel in Show Panels sub menu */ public void updateEditorPanel(Editor panel) { if (panelsList.size() == 0) { return; } for (int i = 0; i < panelsList.size(); i++) { Object o = panelsList.get(i); if (o == panel) { JCheckBoxMenuItem r = (JCheckBoxMenuItem) panelsSubMenu.getItem(i); if (panel instanceof LayoutEditor) { if (panel.isVisible()) { r.setSelected(true); } else { r.setSelected(false); } } else { if (panel.getTargetFrame().isVisible()) { r.setSelected(true); } else { r.setSelected(false); } } return; } } }
public Editor getEditorByName(String name) { if (panelsList.size() == 0) { return null; } for (int i = 0; (i < panelsList.size()); i++) { try { Editor editor = panelsList.get(i); if (editor.getTargetFrame().getTitle().equals(name)) { return editor; } } catch (Exception e) { } } return null; }
/** Determine if named panel already exists returns true if named panel already loaded */ public boolean isPanelNameUsed(String name) { if (panelsList.size() == 0) { return false; } for (int i = 0; i < panelsList.size(); i++) { try { Editor editor = panelsList.get(i); if (editor.getTargetFrame().getTitle().equals(name)) { return true; } } catch (Exception e) { } } return false; }