/** * @param viewSetMgrName * @param dir */ protected void processDir(final String viewSetMgrName, final File dir) { ViewSetMgr viewSetMgr = new ViewSetMgr(viewSetMgrName, dir); pw.println("<br><h2>" + viewSetMgrName + "</h2>"); // $NON-NLS-1$ //$NON-NLS-2$ if (viewSetMgr.getViewSets().size() > 0) { for (ViewSetIFace vs : viewSetMgr.getViewSets()) { if (!vs.getName().equals("Editor")) // $NON-NLS-1$ { System.out.println(vs.getName()); if (vs.getViews().keySet().size() > 0) { pw.println("<h3>" + vs.getName() + "</h3>"); // $NON-NLS-1$ //$NON-NLS-2$ pw.println("<table border=\"1\" width=\"50%\">"); // $NON-NLS-1$ pw.println( "<tr><th>View Name</th><th>Is Internal</th><th>Types</th></tr>"); //$NON-NLS-1$ Vector<String> vNames = new Vector<String>(vs.getViews().keySet()); Collections.sort(vNames); for (String vName : vNames) { ViewIFace view = vs.getViews().get(vName); pw.println("<tr><td>" + view.getName() + "</td>"); // $NON-NLS-1$ //$NON-NLS-2$ StringBuilder sb = new StringBuilder(); for (AltViewIFace av : view.getAltViews()) { if (sb.length() > 0) sb.append(", "); // $NON-NLS-1$ if (av.getViewDef() != null) { sb.append( av.getViewDef().getType().toString() + " (" + av.getMode().toString().toLowerCase() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ } } pw.println( "<td><center>" + view.isInternal() + "</center></td>"); //$NON-NLS-1$ //$NON-NLS-2$ pw.println("<td>" + sb.toString() + "</td></tr>"); // $NON-NLS-1$ //$NON-NLS-2$ } pw.println("</table><br>"); // $NON-NLS-1$ } else { pw.println( "<i>" + getResourceString("FormDisplayer.NO_VIEWS_DEFINED") + "</i><br>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } } } else { pw.println("<i>No viewset_registry.xml</i><br>"); // $NON-NLS-1$ } if (dir != null && dir.isDirectory()) { System.out.println(dir.getAbsolutePath()); for (File file : dir.listFiles()) { if (file.isDirectory() && !file.getName().startsWith(".")) // $NON-NLS-1$ { processDir(viewSetMgrName + "/" + file.getName(), file); // $NON-NLS-1$ } } } }
protected void showView() { boolean done = false; synchronized (okToProc) { if (okToProc.get()) { if (frame != null) { generateViewImage(viewList.get(viewInx)); frame.dispose(); } viewInx++; ViewIFace view = viewList.get(viewInx); System.out.println(view.getName()); if (!view.getViewSetName().equals("Editor")) // $NON-NLS-1$ { Object data = null; try { ViewDefIFace viewDef = view.getAltViews().get(0).getViewDef(); if (!(viewDef.getDataGettable() instanceof edu.ku.brc.af.ui.forms.DataGetterForHashMap)) { Class<?> dataCls = Class.forName(viewDef.getClassName()); if (dataCls != null) { System.err.println(dataCls); data = dataCls.newInstance(); if (data instanceof FormDataObjIFace) { ((FormDataObjIFace) data).initialize(); } } } } catch (Exception ex) { } if (data instanceof Discipline) { ((Discipline) data).setType("fish"); } FormPane formPane = new FormPane( view.getName(), null, null, view.getName(), "edit", data, MultiView.IS_NEW_OBJECT | MultiView.HIDE_SAVE_BTN, true); //$NON-NLS-1$ frame = new JFrame(); frame.setFocusable(false); frame.setContentPane(formPane); frame.setSize(1024, 768); frame.setVisible(true); frame.setLocation(0, 0); Dimension size = frame.getContentPane().getPreferredSize(); size.height += 40; size.width += 30; frame.setSize(size); String str = String.format("%d of %d", viewInx + 1, viewList.size()); System.out.println(str); // $NON-NLS-1$ getStatusBar().setText(str); // $NON-NLS-1$ } else if (frame != null) { frame.setVisible(false); frame.dispose(); frame = null; } if (viewInx < viewList.size() - 1) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { try { Thread.sleep(500); } catch (Exception ex) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance() .capture(FormDisplayer.class, ex); } showView(); } }); } else { done = true; } } else { done = true; } } if (done) { if (cancelDlg != null) cancelDlg.setVisible(false); if (frame != null) { frame.setVisible(false); frame.dispose(); } createIndexFile(); getStatusBar().setText("Done"); // $NON-NLS-1$ } }