/** * Inserts a page after the page with the specified full title. If we cannot find the page with the specified title, * the page will be added to the end as append(page). * * @param page page to be inserted. * @param title the title of the page after when the new page will be inserted. */ public void insertAfter(AbstractDialogPage page, String title) { int index = getPageIndexByFullTitle(title); if (index == -1 || index == getPageCount() - 1) { append(page); } else { insertElementAt(page, index + 1); } }
/** * Gets the all page titles as vector. * * @return the vector which has all the page titles. */ public List<String> getPageTitlesAsList() { List<String> list = new ArrayList<String>(); for (int i = 0; i < getPageCount(); i++) { AbstractDialogPage page = getPage(i); list.add(page.getTitle()); } return list; }
/** * Appends a page to the end of the list. * * @param page the page to be appended. */ public void append(AbstractDialogPage page) { addElement(page); }
/** * If you know the full title of any page, use this method to get the actual page from the list. * * @param title the full title. * @return the page with the title. */ public AbstractDialogPage getPageByFullTitle(String title) { for (int i = 0; i < getSize(); i++) { AbstractDialogPage page = (AbstractDialogPage) getElementAt(i); if (page.getFullTitle().equals(title)) { return page; } } return null; }
private JComponent createTreePanel() { final DefaultMutableTreeNode root = new DefaultMutableTreeNode("", true); _titleNodeMap = new HashMap<String, MutableTreeNode>((int) (_pageList.getPageCount() * 0.75)); for (int i = 0; i < _pageList.getPageCount(); i++) { AbstractDialogPage dialogPage = _pageList.getPage(i); addPage(dialogPage, root, false); _pageList.addListDataListener(new ListDataListener() { public void intervalAdded(ListDataEvent e) { for (int i = e.getIndex0(); i <= e.getIndex1(); i++) {
public ImportVariantsWizardWithAnnotation() { setTitle("Import Variants Wizard"); WizardStyle.setStyle(WizardStyle.MACOSX_STYLE); variantTags = new ArrayList<VariantTag>(); //add pages PageList model = new PageList(); model.append(getWelcomePage()); model.append(getVCFSourcePage()); model.append(getChooseFilesPage()); model.append(getAddTagsPage()); model.append(getNotificationsPage()); model.append(getQueuePage()); //model.append(getSetLivePage()); model.append(getCompletePage()); setPageList(model); pack(); setResizable(true); setLocationRelativeTo(null); }
public SettingsDialog(Window parent, String title, Section... sections) throws HeadlessException { super((Frame)parent, title); setStyle(MultiplePageDialog.LIST_STYLE); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); PageList model = new PageList(); for (Section s: sections) { model.append(s); } setPageList(model); pack(); for(int i = 0; i < model.getPageCount(); i++){ ((Section)model.getPage(i)).populate(); } getOkButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (getApplyButton().isEnabled()){ applySectionChanges(); } } }); getApplyButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { applySectionChanges(); } }); setLocationRelativeTo(parent); }
public void intervalAdded(ListDataEvent e) { for (int i = e.getIndex0(); i <= e.getIndex1(); i++) { AbstractDialogPage dialogPage = _pageList.getPage(i); addPage(dialogPage, (DefaultMutableTreeNode) _tree.getModel().getRoot(), true); } }
public void contentsChanged(ListDataEvent e) { if (e.getIndex0() == -1 && e.getIndex1() == -1 && e.getType() == ListDataEvent.CONTENTS_CHANGED) { if (_pageList.getCurrentPage() != null) { int index = _pageList.getPageIndexByFullTitle(_pageList.getCurrentPage().getFullTitle()); list.setSelectedIndex(index); } } } });
/** * Gets the current selected page. * * @return the current selected page. */ public AbstractDialogPage getCurrentPage() { return _pageList.getCurrentPage(); }
protected void setCurrentPage(String pageTitle) { if (_pageList != null) { setCurrentPage(_pageList.getPageByFullTitle(pageTitle)); } }
protected boolean setCurrentPage(AbstractDialogPage page, Object source) { AbstractDialogPage oldPage = getCurrentPage(); if (oldPage != null && !oldPage.equals(page)) { oldPage.setAllowClosing(true); oldPage.firePageEvent(source, PageEvent.PAGE_CLOSING); if (!oldPage.allowClosing()) { return false; } oldPage.firePageEvent(source, PageEvent.PAGE_CLOSED); } if (!JideSwingUtilities.equals(oldPage, page)) { setSelectedItem(page); AbstractDialogPage newPage = getCurrentPage(); if (newPage != null) { newPage.firePageEvent(source, PageEvent.PAGE_OPENED); } } return true; } }
@Override public JComponent createIndexPanel() { if (getPageList().getPageCount() > 1) { return super.createIndexPanel(); } return null; }
/** * Gets the page at position. * * @param i the index * @return the page. */ public AbstractDialogPage getPage(int i) { return (AbstractDialogPage) getElementAt(i); }
private JComponent createTreePanel() { final DefaultMutableTreeNode root = new DefaultMutableTreeNode("", true); _titleNodeMap = new HashMap<String, MutableTreeNode>((int) (_pageList.getPageCount() * 0.75)); for (int i = 0; i < _pageList.getPageCount(); i++) { AbstractDialogPage dialogPage = _pageList.getPage(i); addPage(dialogPage, root, false); _pageList.addListDataListener(new ListDataListener() { public void intervalAdded(ListDataEvent e) { for (int i = e.getIndex0(); i <= e.getIndex1(); i++) {
public ExportVCFWizard() throws InterruptedException, SQLException, RemoteException { setTitle("Export VCF Wizard"); WizardStyle.setStyle(WizardStyle.MACOSX_STYLE); //add pages PageList model = new PageList(); model.append(getWelcomePage()); model.append(getFilePage()); model.append(getExportPage()); model.append(getCompletionPage()); setPageList(model); pack(); setResizable(true); setLocationRelativeTo(null); }
public void intervalAdded(ListDataEvent e) { for (int i = e.getIndex0(); i <= e.getIndex1(); i++) { AbstractDialogPage dialogPage = _pageList.getPage(i); addPage(dialogPage, (DefaultMutableTreeNode) _tree.getModel().getRoot(), true); } }
public void contentsChanged(ListDataEvent e) { if (e.getIndex0() == -1 && e.getIndex1() == -1 && e.getType() == ListDataEvent.CONTENTS_CHANGED) { int index = _pageList.getPageIndexByFullTitle(_pageList.getCurrentPage().getFullTitle()); list.setSelectedIndex(index); } } });
/** * Gets the page index if you know the full title of the page. * * @param title the full title. * @return the page index. */ public int getPageIndexByFullTitle(String title) { for (int i = 0; i < getSize(); i++) { AbstractDialogPage page = (AbstractDialogPage) getElementAt(i); if (page.getFullTitle().equals(title)) { return i; } } return -1; }
/** * Gets the current selected page. * * @return the current selected page. */ public AbstractDialogPage getCurrentPage() { return _pageList.getCurrentPage(); }