bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
public Object createObject(Attributes attributes) { try { SQLRelationship rel = (SQLRelationship) objectIdMap.get(attributes.getValue("relationship-ref")); Relationship r = new Relationship(playPen, rel); playPen.add(r); return r; } catch (ArchitectException e) { logger.error("Couldn't create relationship component", e); return null; } }
public Object createObject(Attributes attributes) { try { SQLRelationship rel = (SQLRelationship) objectIdMap.get(attributes.getValue("relationship-ref")); r = new Relationship(playPen, rel); playPen.add(r); return r; } catch (ArchitectException e) { logger.error("Couldn't create relationship component", e); return null; } }
1,111,646
public Object createObject(Attributes attributes) { try { SQLRelationship rel = (SQLRelationship) objectIdMap.get(attributes.getValue("relationship-ref")); Relationship r = new Relationship(playPen, rel); playPen.add(r); return r; } catch (ArchitectException e) { logger.error("Couldn't create relationship component", e); return null; } }
public Object createObject(Attributes attributes) { try { SQLRelationship rel = (SQLRelationship) objectIdMap.get(attributes.getValue("relationship-ref")); Relationship r = new Relationship(playPen, rel); playPen.add(r); int pkx = Integer.parseInt(attributes.getValue("pk-x")); int pky = Integer.parseInt(attributes.getValue("pk-y")); int fkx = Integer.parseInt(attributes.getValue("fk-x")); int fky = Integer.parseInt(attributes.getValue("fk-y")); r.setPkConnectionPoint(new Point(pkx, pky)); r.setFkConnectionPoint(new Point(fkx, fky)); } catch (ArchitectException e) { logger.error("Couldn't create relationship component", e); return null; } }
1,111,647
public Object createObject(Attributes attributes) { try { SQLRelationship rel = (SQLRelationship) objectIdMap.get(attributes.getValue("relationship-ref")); Relationship r = new Relationship(playPen, rel); playPen.add(r); return r; } catch (ArchitectException e) { logger.error("Couldn't create relationship component", e); return null; } }
public Object createObject(Attributes attributes) { try { SQLRelationship rel = (SQLRelationship) objectIdMap.get(attributes.getValue("relationship-ref")); Relationship r = new Relationship(playPen, rel); playPen.add(r); return r; } catch (ArchitectException e) { logger.error("Couldn't create relationship component", e); } catch (NumberFormatException e) { logger.warn("Didn't set connection points because of integer parse error"); } catch (NullPointerException e) { logger.debug("No pk/fk connection points specified in save file;" +" not setting custom connection points"); } }
1,111,648
public void save(ProgressMonitor pm) throws IOException, ArchitectException { out = new PrintWriter(new BufferedWriter(new FileWriter(file))); objectIdMap = new HashMap(); dbcsIdMap = new HashMap(); indent = 0; this.pm = pm; pm.setMinimum(0); int pmMax = countSourceTables((SQLObject) sourceDatabases.getModel().getRoot()) + playPen.getComponentCount() * 2; logger.debug("Setting progress monitor maximum to "+pmMax); pm.setMaximum(pmMax); progress = 0; pm.setProgress(progress); pm.setMillisToDecideToPopup(500); try { println("<?xml version=\"1.0\"?>"); println("<architect-project version=\"0.1\">"); indent++; println("<project-name>"+name+"</project-name>"); saveDBCS(); saveSourceDatabases(); saveTargetDatabase(); saveDDLGenerator(); savePlayPen(); indent--; println("</architect-project>"); } finally { out.close(); out = null; pm.close(); pm = null; } }
public void save(ProgressMonitor pm) throws IOException, ArchitectException { out = new PrintWriter(new BufferedWriter(new FileWriter(file))); objectIdMap = new HashMap(); dbcsIdMap = new HashMap(); indent = 0; this.pm = pm; pm.setMinimum(0); int pmMax = countSourceTables((SQLObject) sourceDatabases.getModel().getRoot()) + playPen.getPPComponentCount() * 2; logger.debug("Setting progress monitor maximum to "+pmMax); pm.setMaximum(pmMax); progress = 0; pm.setProgress(progress); pm.setMillisToDecideToPopup(500); try { println("<?xml version=\"1.0\"?>"); println("<architect-project version=\"0.1\">"); indent++; println("<project-name>"+name+"</project-name>"); saveDBCS(); saveSourceDatabases(); saveTargetDatabase(); saveDDLGenerator(); savePlayPen(); indent--; println("</architect-project>"); } finally { out.close(); out = null; pm.close(); pm = null; } }
1,111,650
protected void savePlayPen() throws IOException, ArchitectException { println("<play-pen>"); indent++; int n = playPen.getComponentCount(); for (int i = 0; i < n; i++) { if (playPen.getComponent(i) instanceof TablePane) { TablePane tp = (TablePane) playPen.getComponent(i); Point p = tp.getLocation(); println("<table-pane table-ref=\""+objectIdMap.get(tp.getModel())+"\"" +" x=\""+p.x+"\" y=\""+p.y+"\" />"); pm.setProgress(++progress); pm.setNote(tp.getModel().getShortDisplayName()); } } Iterator it = playPen.getRelationships().iterator(); while (it.hasNext()) { Relationship r = (Relationship) it.next(); println("<table-link relationship-ref=\""+objectIdMap.get(r.getModel())+"\" />"); } indent--; println("</play-pen>"); }
protected void savePlayPen() throws IOException, ArchitectException { println("<play-pen>"); indent++; int n = playPen.getComponentCount(); for (int i = 0; i < n; i++) { if (playPen.getComponent(i) instanceof TablePane) { TablePane tp = (TablePane) playPen.getComponent(i); Point p = tp.getLocation(); println("<table-pane table-ref=\""+objectIdMap.get(tp.getModel())+"\"" +" x=\""+p.x+"\" y=\""+p.y+"\" />"); pm.setProgress(++progress); pm.setNote(tp.getModel().getShortDisplayName()); } } Iterator it = playPen.getRelationships().iterator(); while (it.hasNext()) { Relationship r = (Relationship) it.next(); println("<table-link relationship-ref=\""+objectIdMap.get(r.getModel())+"\" />"); } indent--; println("</play-pen>"); }
1,111,651
protected void savePlayPen() throws IOException, ArchitectException { println("<play-pen>"); indent++; int n = playPen.getComponentCount(); for (int i = 0; i < n; i++) { if (playPen.getComponent(i) instanceof TablePane) { TablePane tp = (TablePane) playPen.getComponent(i); Point p = tp.getLocation(); println("<table-pane table-ref=\""+objectIdMap.get(tp.getModel())+"\"" +" x=\""+p.x+"\" y=\""+p.y+"\" />"); pm.setProgress(++progress); pm.setNote(tp.getModel().getShortDisplayName()); } } Iterator it = playPen.getRelationships().iterator(); while (it.hasNext()) { Relationship r = (Relationship) it.next(); println("<table-link relationship-ref=\""+objectIdMap.get(r.getModel())+"\" />"); } indent--; println("</play-pen>"); }
protected void savePlayPen() throws IOException, ArchitectException { println("<play-pen>"); indent++; int n = playPen.getComponentCount(); for (int i = 0; i < n; i++) { if (playPen.getComponent(i) instanceof TablePane) { TablePane tp = (TablePane) playPen.getComponent(i); Point p = tp.getLocation(); println("<table-pane table-ref=\""+objectIdMap.get(tp.getModel())+"\"" +" x=\""+p.x+"\" y=\""+p.y+"\" />"); pm.setProgress(++progress); pm.setNote(tp.getModel().getShortDisplayName()); } } it = playPen.getRelationships().iterator(); while (it.hasNext()) { Relationship r = (Relationship) it.next(); println("<table-link relationship-ref=\""+objectIdMap.get(r.getModel())+"\" />"); } indent--; println("</play-pen>"); }
1,111,652
protected void savePlayPen() throws IOException, ArchitectException { println("<play-pen>"); indent++; int n = playPen.getComponentCount(); for (int i = 0; i < n; i++) { if (playPen.getComponent(i) instanceof TablePane) { TablePane tp = (TablePane) playPen.getComponent(i); Point p = tp.getLocation(); println("<table-pane table-ref=\""+objectIdMap.get(tp.getModel())+"\"" +" x=\""+p.x+"\" y=\""+p.y+"\" />"); pm.setProgress(++progress); pm.setNote(tp.getModel().getShortDisplayName()); } } Iterator it = playPen.getRelationships().iterator(); while (it.hasNext()) { Relationship r = (Relationship) it.next(); println("<table-link relationship-ref=\""+objectIdMap.get(r.getModel())+"\" />"); } indent--; println("</play-pen>"); }
protected void savePlayPen() throws IOException, ArchitectException { println("<play-pen>"); indent++; int n = playPen.getComponentCount(); for (int i = 0; i < n; i++) { if (playPen.getComponent(i) instanceof TablePane) { TablePane tp = (TablePane) playPen.getComponent(i); Point p = tp.getLocation(); println("<table-pane table-ref=\""+objectIdMap.get(tp.getModel())+"\"" +" x=\""+p.x+"\" y=\""+p.y+"\" />"); pm.setProgress(++progress); pm.setNote(tp.getModel().getShortDisplayName()); } } Iterator it = playPen.getRelationships().iterator(); while (it.hasNext()) { Relationship r = (Relationship) it.next(); println("<table-link relationship-ref=\""+objectIdMap.get(r.getModel())+"\"" +" pk-x=\""+r.getPkConnectionPoint().x+"\"" +" pk-y=\""+r.getPkConnectionPoint().y+"\"" +" fk-x=\""+r.getFkConnectionPoint().x+"\"" +" fk-y=\""+r.getFkConnectionPoint().y+"\" />"); } indent--; println("</play-pen>"); }
1,111,653
public void testExample1() throws Exception { Document document = runScript( "src/test/org/apache/commons/jelly/jsl/example.jelly" ); Element small = (Element) document.selectSingleNode("/html/body/small"); new org.dom4j.io.XMLWriter(new java.io.FileOutputStream("file.xml")).write(document); //assertTrue( "<small> starts with 'James Elson'", small.getText().trim().startsWith("James Elson") ); assertEquals( "I am a title!", small.valueOf( "h2" ).trim() ); assertEquals( "Twas a dark, rainy night...", small.valueOf( "small" ).trim() ); assertEquals( "dfjsdfjsdf", small.valueOf( "p" ).trim() ); }
public void testExample1() throws Exception { Document document = runScript( "src/test/org/apache/commons/jelly/jsl/example.jelly" ); Element small = (Element) document.selectSingleNode("/html/body/small"); //assertTrue( "<small> starts with 'James Elson'", small.getText().trim().startsWith("James Elson") ); assertEquals( "I am a title!", small.valueOf( "h2" ).trim() ); assertEquals( "Twas a dark, rainy night...", small.valueOf( "small" ).trim() ); assertEquals( "dfjsdfjsdf", small.valueOf( "p" ).trim() ); }
1,111,655
public CommandLine parseCommandLineOptions(String[] args) throws ParseException { // create the expected options Options cmdLineOptions = new Options(); cmdLineOptions.addOption("o", true, "Output file"); cmdLineOptions.addOption("script", true, "Jelly script to run"); // -D options will be added to the system properties Properties sysProps = System.getProperties(); // filter the system property setting from the arg list // before passing it to the CLI parser ArrayList filteredArgList = new ArrayList(); for (int i=0;i<args.length;i++) { String arg = args[i]; // if this is a -D property parse it and add it to the system properties. // -D args will not be copied into the filteredArgList. if (arg.startsWith("-D") && (arg.length() > 2)) { arg = arg.substring(2); StringTokenizer toks = new StringTokenizer(arg, "="); if (toks.countTokens() == 2) { // add the tokens to the system properties sysProps.setProperty(toks.nextToken(), toks.nextToken()); } else { System.err.println("Invalid system property: " + arg); } } else { // add this to the filtered list of arguments filteredArgList.add(arg); // add additional "-?" options to the options object. if this is not done // the only options allowed would be "-o" and "-script". if (arg.startsWith("-") && arg.length() > 1) { if (!(arg.equals("-o") && arg.equals("-script"))) { cmdLineOptions.addOption(arg.substring(1, arg.length()), true, "dynamic option"); } } } } // make the filteredArgList into an array String[] filterArgs = new String[filteredArgList.size()]; filteredArgList.toArray(filterArgs); // parse the command line Parser parser = new GnuParser(); return parser.parse(cmdLineOptions, filterArgs); }
public CommandLine parseCommandLineOptions(String[] args) throws ParseException { // create the expected options Options cmdLineOptions = new Options(); cmdLineOptions.addOption("o", true, "Output file"); cmdLineOptions.addOption("script", true, "Jelly script to run"); // -D options will be added to the system properties Properties sysProps = System.getProperties(); // filter the system property setting from the arg list // before passing it to the CLI parser ArrayList filteredArgList = new ArrayList(); for (int i=0;i<args.length;i++) { String arg = args[i]; // if this is a -D property parse it and add it to the system properties. // -D args will not be copied into the filteredArgList. if (arg.startsWith("-D") && (arg.length() > 2)) { arg = arg.substring(2); StringTokenizer toks = new StringTokenizer(arg, "="); if (toks.countTokens() == 2) { // add the tokens to the system properties sysProps.setProperty(toks.nextToken(), toks.nextToken()); } else { System.err.println("Invalid system property: " + arg); } } else { // add this to the filtered list of arguments filteredArgList.add(arg); // add additional "-?" options to the options object. if this is not done // the only options allowed would be "-o" and "-script". if (arg.startsWith("-") && arg.length() > 1) { if (!(arg.equals("-o") && arg.equals("-script"))) { cmdLineOptions.addOption(arg.substring(1, arg.length()), true, "dynamic option"); } } } } // make the filteredArgList into an array String[] filterArgs = new String[filteredArgList.size()]; filteredArgList.toArray(filterArgs); // parse the command line Parser parser = new GnuParser(); return parser.parse(cmdLineOptions, filterArgs); }
1,111,656
void export(int tabNum, int format, int start, int stop){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = fc.getSelectedFile(); if (format == PNG_MODE){ BufferedImage image; if (tabNum == VIEW_D_NUM){ image = dPrimeDisplay.export(start, stop); }else if (tabNum == VIEW_HAP_NUM){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } try{ String filename = outfile.getPath(); if (! (filename.endsWith(".png") || filename.endsWith(".PNG"))){ filename += ".png"; } Jimi.putImage("image/png", image, filename); }catch(JimiException je){ JOptionPane.showMessageDialog(this, je.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } else if (format == TXT_MODE){ try{ if (tabNum == VIEW_D_NUM){ theData.saveDprimeToText(outfile, TABLE_TYPE, start, stop); }else if (tabNum == VIEW_HAP_NUM){ theData.saveHapsToText(hapDisplay.filteredHaplos,hapDisplay.multidprimeArray, outfile); }else if (tabNum == VIEW_CHECK_NUM){ JTable table = checkPanel.getTable(); FileWriter checkWriter = new FileWriter(outfile); int numCols = table.getColumnCount(); StringBuffer header = new StringBuffer(); for (int i = 0; i < numCols; i++){ header.append(table.getColumnName(i)).append("\t"); } header.append("\n"); checkWriter.write(header.toString()); for (int i = 0; i < table.getRowCount(); i++){ StringBuffer sb = new StringBuffer(); //don't print the true/false vals in last column for (int j = 0; j < numCols-1; j++){ sb.append(table.getValueAt(i,j)).append("\t"); } //print BAD if last column is false if (((Boolean)table.getValueAt(i, numCols-1)).booleanValue()){ sb.append("\n"); }else{ sb.append("BAD\n"); } checkWriter.write(sb.toString()); } checkWriter.close(); }else if (tabNum == VIEW_TDT_NUM){ JTable table = tdtPanel.getTable(); FileWriter checkWriter = new FileWriter(outfile); int numCols = table.getColumnCount(); StringBuffer header = new StringBuffer(); for (int i = 0; i < numCols; i++){ header.append(table.getColumnName(i)).append("\t"); } header.append("\n"); checkWriter.write(header.toString()); for (int i = 0; i < table.getRowCount(); i++){ StringBuffer sb = new StringBuffer(); for (int j = 0; j < numCols; j++){ sb.append(table.getValueAt(i,j)).append("\t"); } sb.append("\n"); checkWriter.write(sb.toString()); } checkWriter.close(); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }
void export(int tabNum, int format, int start, int stop){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = fc.getSelectedFile(); if (format == PNG_MODE){ BufferedImage image; if (tabNum == VIEW_D_NUM){ image = dPrimeDisplay.export(start, stop); }else if (tabNum == VIEW_HAP_NUM){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } try{ String filename = outfile.getPath(); if (! (filename.endsWith(".png") || filename.endsWith(".PNG"))){ filename += ".png"; } Jimi.putImage("image/png", image, filename); }catch(JimiException je){ JOptionPane.showMessageDialog(this, je.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } else if (format == TXT_MODE){ try{ if (tabNum == VIEW_D_NUM){ theData.saveDprimeToText(outfile, TABLE_TYPE, start, stop); }else if (tabNum == VIEW_HAP_NUM){ theData.saveHapsToText(hapDisplay.filteredHaplos,hapDisplay.multidprimeArray, outfile); }else if (tabNum == VIEW_CHECK_NUM){ JTable table = checkPanel.getTable(); FileWriter checkWriter = new FileWriter(outfile); int numCols = table.getColumnCount(); StringBuffer header = new StringBuffer(); for (int i = 0; i < numCols; i++){ header.append(table.getColumnName(i)).append("\t"); } header.append("\n"); checkWriter.write(header.toString()); for (int i = 0; i < table.getRowCount(); i++){ StringBuffer sb = new StringBuffer(); //don't print the true/false vals in last column for (int j = 0; j < numCols-1; j++){ sb.append(table.getValueAt(i,j)).append("\t"); } //print BAD if last column is false if (((Boolean)table.getValueAt(i, numCols-1)).booleanValue()){ sb.append("\n"); }else{ sb.append("BAD\n"); } checkWriter.write(sb.toString()); } checkWriter.close(); }else if (tabNum == VIEW_TDT_NUM){ JTable table = tdtPanel.getTable(); FileWriter checkWriter = new FileWriter(outfile); int numCols = table.getColumnCount(); StringBuffer header = new StringBuffer(); for (int i = 0; i < numCols; i++){ header.append(table.getColumnName(i)).append("\t"); } header.append("\n"); checkWriter.write(header.toString()); for (int i = 0; i < table.getRowCount(); i++){ StringBuffer sb = new StringBuffer(); for (int j = 0; j < numCols; j++){ sb.append(table.getValueAt(i,j)).append("\t"); } sb.append("\n"); checkWriter.write(sb.toString()); } checkWriter.close(); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }
1,111,657
public void messageLogged(BuildEvent event) { try { if ( this.taskStack.isEmpty() ) { out.write( event.getMessage() + "\n" ); } else { out.write( " [" + this.taskStack.peek() + "] " + event.getMessage() + "\n" ); } } catch (SAXException e) { // ignore } }
public void messageLogged(BuildEvent event) { try { if ( this.taskStack.isEmpty() ) { out.write( event.getMessage() + "\n" ); } else { out.write( " [" + this.taskStack.peek() + "] " + event.getMessage() + "\n" ); } } catch (SAXException e) { // ignore } }
1,111,658
public void messageLogged(BuildEvent event) { try { if ( this.taskStack.isEmpty() ) { out.write( event.getMessage() + "\n" ); } else { out.write( " [" + this.taskStack.peek() + "] " + event.getMessage() + "\n" ); } } catch (SAXException e) { // ignore } }
public void messageLogged(BuildEvent event) { try { if ( this.taskStack.isEmpty() ) { out.write( event.getMessage() + "\n" ); } else { out.write( " [" + this.taskStack.peek() + "] " + event.getMessage() + "\n" ); } } catch (SAXException e) { // ignore } }
1,111,659
public void messageLogged(BuildEvent event) { try { if ( this.taskStack.isEmpty() ) { out.write( event.getMessage() + "\n" ); } else { out.write( " [" + this.taskStack.peek() + "] " + event.getMessage() + "\n" ); } } catch (SAXException e) { // ignore } }
public void messageLogged(BuildEvent event) { try { if ( this.taskStack.isEmpty() ) { out.write( event.getMessage() + "\n" ); } else { out.write( " [" + this.taskStack.peek() + "] " + event.getMessage() + "\n" ); } } catch (SAXException e) { // ignore } }
1,111,660
public void paintComponent(Graphics g) { validateLayout(); Graphics2D g2 = (Graphics2D) g; g2.setColor(pp.getBackground()); g2.fill(new Rectangle(0, 0, getWidth(), getHeight())); double zoom = calculateZoom(); int scaledWidth = (int) (getWidth()/zoom); int scaledHeight = (int) (getHeight()/zoom); if (logger.isDebugEnabled()) { Dimension ppSize = pp.getPreferredSize(); logger.debug("PlayPen preferred size = "+ppSize.width+"x"+ppSize.height); logger.debug("After scaling, preview panel coordinate space is "+scaledWidth+"x"+scaledHeight); } // now draw the playpen g2.scale(zoom, zoom); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); //settings.pp.paint(g2); This is slow in win32 and x11 SwingUtilities.paintComponent(g2, pp, new Container(), 0, 0, scaledWidth, scaledHeight); ArchitectFrame.getMainInstance().splitPane.setRightComponent(pp); // and draw the lines where the page boundaries fall double iW = pageFormat.getImageableWidth(); double iH = pageFormat.getImageableHeight(); g2.scale(1/PrintPanel.this.zoom, 1/PrintPanel.this.zoom); g2.setColor(pp.getForeground()); for (int i = 0; i <= pagesAcross; i++) { g2.drawLine((int) (i * iW), 0, (int) (i * iW), (int) (scaledHeight*PrintPanel.this.zoom)); if (logger.isDebugEnabled()) logger.debug("Drew page separator at x="+(i*iW)); } for (int i = 0; i <= pagesDown; i++) { g2.drawLine(0, (int) (i * iH), (int) (scaledWidth*PrintPanel.this.zoom), (int) (i * iH)); if (logger.isDebugEnabled()) logger.debug("Drew page separator at y="+(i*iH)); } }
public void paintComponent(Graphics g) { validateLayout(); Graphics2D g2 = (Graphics2D) g; g2.setColor(pp.getBackground()); g2.fill(new Rectangle(0, 0, getWidth(), getHeight())); double zoom = calculateZoom(); int scaledWidth = (int) (getWidth()/zoom); int scaledHeight = (int) (getHeight()/zoom); if (logger.isDebugEnabled()) { Dimension ppSize = pp.getPreferredSize(); logger.debug("PlayPen preferred size = "+ppSize.width+"x"+ppSize.height); logger.debug("After scaling, preview panel coordinate space is "+scaledWidth+"x"+scaledHeight); } // now draw the playpen g2.scale(zoom, zoom); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); //settings.pp.paint(g2); This is slow in win32 and x11 SwingUtilities.paintComponent(g2, pp, new Container(), 0, 0, scaledWidth, scaledHeight); ArchitectFrame.getMainInstance().splitPane.setRightComponent(pp); // and draw the lines where the page boundaries fall double iW = pageFormat.getImageableWidth(); double iH = pageFormat.getImageableHeight(); g2.scale(1/PrintPanel.this.zoom, 1/PrintPanel.this.zoom); g2.setColor(pp.getForeground()); for (int i = 0; i <= pagesAcross; i++) { g2.drawLine((int) (i * iW), 0, (int) (i * iW), (int) (scaledHeight*PrintPanel.this.zoom)); if (logger.isDebugEnabled()) logger.debug("Drew page separator at x="+(i*iW)); } for (int i = 0; i <= pagesDown; i++) { g2.drawLine(0, (int) (i * iH), (int) (scaledWidth*PrintPanel.this.zoom), (int) (i * iH)); if (logger.isDebugEnabled()) logger.debug("Drew page separator at y="+(i*iH)); } }
1,111,661
public void setPageFormat(PageFormat pf) { PageFormat oldPF = pageFormat; pageFormat = pf; if (pf != oldPF) { validateLayout(); pageFormatLabel.setText(paperToPrintable(pageFormat)); firePropertyChange("pageFormat", oldPF, pageFormat); } }
public void setPageFormat(PageFormat pf) { PageFormat oldPF = pageFormat; pageFormat = pf; if (pf != oldPF) { validateLayout(); pageFormatLabel.setText(paperToPrintable(pageFormat)); firePropertyChange("pageFormat", oldPF, pageFormat); } }
1,111,662
public static void main(String args[]) throws ArchitectException { ArchitectUtils.startup(); System.setProperty("apple.laf.useScreenMenuBar", "true"); ArchitectUtils.configureLog4j(); getMainInstance(); SwingUtilities.invokeLater(new Runnable() { public void run() { // this doesn't appear to have any effect on the motion threshold // in the Playpen, but it does seem to work on the DBTree... logger.debug("current motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); System.setProperty("awt.dnd.drag.threshold","50"); logger.debug("new motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); getMainInstance().macOSXRegistration(); getMainInstance().setVisible(true); } }); }
public static void main(String args[]) throws ArchitectException { ArchitectUtils.startup(); System.setProperty("apple.laf.useScreenMenuBar", "true"); ArchitectUtils.configureLog4j(); getMainInstance(); SwingUtilities.invokeLater(new Runnable() { public void run() { // this doesn't appear to have any effect on the motion threshold // in the Playpen, but it does seem to work on the DBTree... logger.debug("current motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); System.setProperty("awt.dnd.drag.threshold","50"); logger.debug("new motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); getMainInstance().macOSXRegistration(); getMainInstance().setVisible(true); } }); }
1,111,663
public void run() { // this doesn't appear to have any effect on the motion threshold // in the Playpen, but it does seem to work on the DBTree... logger.debug("current motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); System.setProperty("awt.dnd.drag.threshold","50"); logger.debug("new motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); getMainInstance().macOSXRegistration(); getMainInstance().setVisible(true); }
public void run() { // this doesn't appear to have any effect on the motion threshold // in the Playpen, but it does seem to work on the DBTree... logger.debug("current motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); System.setProperty("awt.dnd.drag.threshold","50"); logger.debug("new motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); getMainInstance().macOSXRegistration(); getMainInstance().setVisible(true); }
1,111,664
public Point parse(String text) { StringTokenizer enum = new StringTokenizer( text, "," ); int x = 0; int y = 0; if ( enum.hasMoreTokens() ) { x = parseNumber( enum.nextToken() ); }
public Point parse(String text) { StringTokenizer items = new StringTokenizer( text, "," ); int x = 0; int y = 0; if ( enum.hasMoreTokens() ) { x = parseNumber( enum.nextToken() ); }
1,111,665
public Point parse(String text) { StringTokenizer enum = new StringTokenizer( text, "," ); int x = 0; int y = 0; if ( enum.hasMoreTokens() ) { x = parseNumber( enum.nextToken() ); }
public Point parse(String text) { StringTokenizer enum = new StringTokenizer( text, "," ); int x = 0; int y = 0; if ( enum.hasMoreTokens() ) { y = parseNumber( items.nextToken() ); }
1,111,666
public boolean maybeShowPopup(MouseEvent evt) { Point p = evt.getPoint(); unzoomPoint(p); PlayPenComponent c = contentPane.getComponentAt(p); if (c != null) p.translate(-c.getX(), -c.getY()); if ( c instanceof Relationship) { if (evt.isPopupTrigger() && !evt.isConsumed()) { Relationship r = (Relationship) c; PlayPen pp = (PlayPen) evt.getSource(); pp.selectNone(); r.setSelected(true); r.showPopup(r.popup, evt.getPoint()); return true; } } else if ( c instanceof TablePane ) { TablePane tp = (TablePane) c; if (evt.isPopupTrigger() && !evt.isConsumed()) { PlayPen pp = tp.getPlayPen(); // this allows the right-click menu to work on multiple tables simultaneously if (!tp.isSelected()) { pp.selectNone(); tp.setSelected(true); } try { // tp.selectNone(); // single column selection model for now int idx = tp.pointToColumnIndex(p); if (idx >= 0) { tp.selectColumn(idx); } } catch (ArchitectException e) { logger.error("Exception converting point to column", e); return false; } logger.debug("about to show playpen tablepane popup..."); tp.showPopup(pp.tablePanePopup, p); return true; } } else { PlayPen pp = (PlayPen) evt.getSource(); if (evt.isPopupTrigger()) { //pp.selectNone(); pp.playPenPopup.show(pp, evt.getX(), evt.getY()); return true; } } return false; }
public boolean maybeShowPopup(MouseEvent evt) { Point p = evt.getPoint(); unzoomPoint(p); PlayPenComponent c = contentPane.getComponentAt(p); if (c != null) p.translate(-c.getX(), -c.getY()); if ( c instanceof Relationship) { if (evt.isPopupTrigger() && !evt.isConsumed()) { Relationship r = (Relationship) c; PlayPen pp = (PlayPen) evt.getSource(); pp.selectNone(); r.setSelected(true); r.showPopup(r.popup, p); return true; } } else if ( c instanceof TablePane ) { TablePane tp = (TablePane) c; if (evt.isPopupTrigger() && !evt.isConsumed()) { PlayPen pp = tp.getPlayPen(); // this allows the right-click menu to work on multiple tables simultaneously if (!tp.isSelected()) { pp.selectNone(); tp.setSelected(true); } try { // tp.selectNone(); // single column selection model for now int idx = tp.pointToColumnIndex(p); if (idx >= 0) { tp.selectColumn(idx); } } catch (ArchitectException e) { logger.error("Exception converting point to column", e); return false; } logger.debug("about to show playpen tablepane popup..."); tp.showPopup(pp.tablePanePopup, p); return true; } } else { PlayPen pp = (PlayPen) evt.getSource(); if (evt.isPopupTrigger()) { //pp.selectNone(); pp.playPenPopup.show(pp, evt.getX(), evt.getY()); return true; } } return false; }
1,111,667
public void doTag(XMLOutput output) throws Exception { invokeBody(output); if (name == null) { throw new MissingAttributeException("name"); } if (className == null) { throw new MissingAttributeException("className"); } Class theClass = null; try { ClassLoader classLoader = getClassLoader(); theClass = classLoader.loadClass(className); } catch (ClassNotFoundException e) { try { theClass = getClass().getClassLoader().loadClass(className); } catch (ClassNotFoundException e2) { try { theClass = Class.forName(className); } catch (ClassNotFoundException e3) { log.error( "Could not load class: " + className + " exception: " + e, e ); throw new JellyException( "Could not find class: " + className + " using ClassLoader: " + classLoader); } } } Method invokeMethod = getInvokeMethod( theClass ); if ( attributes == null ) { attributes = EMPTY_MAP; } BeanTag tag = new BeanTag(theClass, attributes, varAttribute, invokeMethod); getTagLibrary().registerBeanTag(name, tag); // now lets clear the attributes for next invocation and help the GC attributes = null; }
public void doTag(XMLOutput output) throws Exception { invokeBody(output); if (name == null) { throw new MissingAttributeException("name"); } if (className == null) { throw new MissingAttributeException("className"); } Class theClass = null; try { ClassLoader classLoader = getClassLoader(); theClass = classLoader.loadClass(className); } catch (ClassNotFoundException e) { try { theClass = getClass().getClassLoader().loadClass(className); } catch (ClassNotFoundException e2) { try { theClass = Class.forName(className); } catch (ClassNotFoundException e3) { log.error( "Could not load class: " + className + " exception: " + e, e ); throw new JellyException( "Could not find class: " + className + " using ClassLoader: " + classLoader); } } } if ( attributes == null ) { attributes = EMPTY_MAP; } BeanTag tag = new BeanTag(theClass, attributes, varAttribute, invokeMethod); getTagLibrary().registerBeanTag(name, tag); // now lets clear the attributes for next invocation and help the GC attributes = null; }
1,111,668
public void doTag(XMLOutput output) throws Exception { invokeBody(output); if (name == null) { throw new MissingAttributeException("name"); } if (className == null) { throw new MissingAttributeException("className"); } Class theClass = null; try { ClassLoader classLoader = getClassLoader(); theClass = classLoader.loadClass(className); } catch (ClassNotFoundException e) { try { theClass = getClass().getClassLoader().loadClass(className); } catch (ClassNotFoundException e2) { try { theClass = Class.forName(className); } catch (ClassNotFoundException e3) { log.error( "Could not load class: " + className + " exception: " + e, e ); throw new JellyException( "Could not find class: " + className + " using ClassLoader: " + classLoader); } } } Method invokeMethod = getInvokeMethod( theClass ); if ( attributes == null ) { attributes = EMPTY_MAP; } BeanTag tag = new BeanTag(theClass, attributes, varAttribute, invokeMethod); getTagLibrary().registerBeanTag(name, tag); // now lets clear the attributes for next invocation and help the GC attributes = null; }
public void doTag(XMLOutput output) throws Exception { invokeBody(output); if (name == null) { throw new MissingAttributeException("name"); } if (className == null) { throw new MissingAttributeException("className"); } Class theClass = null; try { ClassLoader classLoader = getClassLoader(); theClass = classLoader.loadClass(className); } catch (ClassNotFoundException e) { try { theClass = getClass().getClassLoader().loadClass(className); } catch (ClassNotFoundException e2) { try { theClass = Class.forName(className); } catch (ClassNotFoundException e3) { log.error( "Could not load class: " + className + " exception: " + e, e ); throw new JellyException( "Could not find class: " + className + " using ClassLoader: " + classLoader); } } } Method invokeMethod = getInvokeMethod( theClass ); if ( attributes == null ) { attributes = EMPTY_MAP; } BeanTag tag = new BeanTag(theClass, attributes, varAttribute, invokeMethod); getTagLibrary().registerBeanTag(name, tag); // now lets clear the attributes for next invocation and help the GC attributes = null; }
1,111,669
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; if(!quietMode && fileName != null){ System.out.println("Using data file: " + fileName); } inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } textData = new HaploData(); Vector result = null; if(fileType == HAPS){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED) { //read in ped file result = textData.linkageToChrom(inputFile, PED); if(textData.getPedFile().isBogusParents()) { System.out.println("Error: One or more individuals in the file reference non-existent parents.\nThese references have been ignored."); } }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,HMP); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (result != null){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; if (result != null){ //once check has been run we can filter the markers for (int i = 0; i < result.size(); i++){ if ((((MarkerResult)result.get(i)).getRating() > 0 || skipCheck) && Chromosome.getUnfilteredMarker(i).getDupStatus() != 2){ markerResults[i] = true; }else{ markerResults[i] = false; } } }else{ //we haven't done the check (HAPS files) Arrays.fill(markerResults, true); } for (int i = 0; i < excludedMarkers.size(); i++){ int cur = ((Integer)excludedMarkers.elementAt(i)).intValue(); if (cur < 1 || cur > markerResults.length){ System.out.println("Excluded marker out of bounds has been ignored: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } Chromosome.doFilter(markerResults); if(!quietMode && infoFile != null){ System.out.println("Using marker information file: " + infoFile.getName()); } if(outputCheck && result != null){ CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(validateOutputFile(fileName + ".CHECK")); } Vector cust = new Vector(); if(blockOutputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; Haplotype[][] filtHaplos; switch(blockOutputType){ case BLOX_GABRIEL: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = validateOutputFile(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = validateOutputFile(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = validateOutputFile(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(blockFileName); cust = textData.readBlocks(blocksFile); break; case BLOX_ALL: //handled below, so we don't do anything here OutputFile = null; break; default: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; } //this handles output type ALL if(blockOutputType == BLOX_ALL) { OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); } if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC) { if (blockOutputType == BLOX_ALL){ System.out.println("Haplotype association results cannot be used with block output \"ALL\""); }else{ HaploData.saveHapAssocToText(haplos, validateOutputFile(fileName + ".HAPASSOC")); } } } if(outputDprime) { OutputFile = validateOutputFile(fileName + ".LD"); if (textData.dpTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getSize()); } } if (outputPNG || outputCompressedPNG){ OutputFile = validateOutputFile(fileName + ".LD.PNG"); if (textData.dpTable == null){ textData.generateDPrimeTable(); textData.guessBlocks(BLOX_CUSTOM, new Vector()); } if (trackFileName != null){ textData.readAnalysisTrack(new File(trackFileName)); } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getName()); }catch(JimiException je){ System.out.println(je.getMessage()); } } if(Options.getAssocTest() == ASSOC_TRIO){ Vector tdtResults = TDT.calcTrioTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(tdtResults, validateOutputFile(fileName + ".ASSOC")); } else if(Options.getAssocTest() == ASSOC_CC) { Vector ccResults = TDT.calcCCTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(ccResults, validateOutputFile(fileName + ".ASSOC")); } } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } }
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; if(!quietMode && fileName != null){ System.out.println("Using data file: " + fileName); } inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } textData = new HaploData(); if(fileType == HAPS){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED) { //read in ped file result = textData.linkageToChrom(inputFile, PED); if(textData.getPedFile().isBogusParents()) { System.out.println("Error: One or more individuals in the file reference non-existent parents.\nThese references have been ignored."); } }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,HMP); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (result != null){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; if (result != null){ //once check has been run we can filter the markers for (int i = 0; i < result.size(); i++){ if ((((MarkerResult)result.get(i)).getRating() > 0 || skipCheck) && Chromosome.getUnfilteredMarker(i).getDupStatus() != 2){ markerResults[i] = true; }else{ markerResults[i] = false; } } }else{ //we haven't done the check (HAPS files) Arrays.fill(markerResults, true); } for (int i = 0; i < excludedMarkers.size(); i++){ int cur = ((Integer)excludedMarkers.elementAt(i)).intValue(); if (cur < 1 || cur > markerResults.length){ System.out.println("Excluded marker out of bounds has been ignored: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } Chromosome.doFilter(markerResults); if(!quietMode && infoFile != null){ System.out.println("Using marker information file: " + infoFile.getName()); } if(outputCheck && result != null){ CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(validateOutputFile(fileName + ".CHECK")); } Vector cust = new Vector(); if(blockOutputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; Haplotype[][] filtHaplos; switch(blockOutputType){ case BLOX_GABRIEL: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = validateOutputFile(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = validateOutputFile(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = validateOutputFile(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(blockFileName); cust = textData.readBlocks(blocksFile); break; case BLOX_ALL: //handled below, so we don't do anything here OutputFile = null; break; default: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; } //this handles output type ALL if(blockOutputType == BLOX_ALL) { OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); } if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC) { if (blockOutputType == BLOX_ALL){ System.out.println("Haplotype association results cannot be used with block output \"ALL\""); }else{ HaploData.saveHapAssocToText(haplos, validateOutputFile(fileName + ".HAPASSOC")); } } } if(outputDprime) { OutputFile = validateOutputFile(fileName + ".LD"); if (textData.dpTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getSize()); } } if (outputPNG || outputCompressedPNG){ OutputFile = validateOutputFile(fileName + ".LD.PNG"); if (textData.dpTable == null){ textData.generateDPrimeTable(); textData.guessBlocks(BLOX_CUSTOM, new Vector()); } if (trackFileName != null){ textData.readAnalysisTrack(new File(trackFileName)); } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getName()); }catch(JimiException je){ System.out.println(je.getMessage()); } } if(Options.getAssocTest() == ASSOC_TRIO){ Vector tdtResults = TDT.calcTrioTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(tdtResults, validateOutputFile(fileName + ".ASSOC")); } else if(Options.getAssocTest() == ASSOC_CC) { Vector ccResults = TDT.calcCCTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(ccResults, validateOutputFile(fileName + ".ASSOC")); } } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } }
1,111,670
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; if(!quietMode && fileName != null){ System.out.println("Using data file: " + fileName); } inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } textData = new HaploData(); Vector result = null; if(fileType == HAPS){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED) { //read in ped file result = textData.linkageToChrom(inputFile, PED); if(textData.getPedFile().isBogusParents()) { System.out.println("Error: One or more individuals in the file reference non-existent parents.\nThese references have been ignored."); } }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,HMP); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (result != null){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; if (result != null){ //once check has been run we can filter the markers for (int i = 0; i < result.size(); i++){ if ((((MarkerResult)result.get(i)).getRating() > 0 || skipCheck) && Chromosome.getUnfilteredMarker(i).getDupStatus() != 2){ markerResults[i] = true; }else{ markerResults[i] = false; } } }else{ //we haven't done the check (HAPS files) Arrays.fill(markerResults, true); } for (int i = 0; i < excludedMarkers.size(); i++){ int cur = ((Integer)excludedMarkers.elementAt(i)).intValue(); if (cur < 1 || cur > markerResults.length){ System.out.println("Excluded marker out of bounds has been ignored: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } Chromosome.doFilter(markerResults); if(!quietMode && infoFile != null){ System.out.println("Using marker information file: " + infoFile.getName()); } if(outputCheck && result != null){ CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(validateOutputFile(fileName + ".CHECK")); } Vector cust = new Vector(); if(blockOutputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; Haplotype[][] filtHaplos; switch(blockOutputType){ case BLOX_GABRIEL: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = validateOutputFile(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = validateOutputFile(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = validateOutputFile(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(blockFileName); cust = textData.readBlocks(blocksFile); break; case BLOX_ALL: //handled below, so we don't do anything here OutputFile = null; break; default: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; } //this handles output type ALL if(blockOutputType == BLOX_ALL) { OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); } if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC) { if (blockOutputType == BLOX_ALL){ System.out.println("Haplotype association results cannot be used with block output \"ALL\""); }else{ HaploData.saveHapAssocToText(haplos, validateOutputFile(fileName + ".HAPASSOC")); } } } if(outputDprime) { OutputFile = validateOutputFile(fileName + ".LD"); if (textData.dpTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getSize()); } } if (outputPNG || outputCompressedPNG){ OutputFile = validateOutputFile(fileName + ".LD.PNG"); if (textData.dpTable == null){ textData.generateDPrimeTable(); textData.guessBlocks(BLOX_CUSTOM, new Vector()); } if (trackFileName != null){ textData.readAnalysisTrack(new File(trackFileName)); } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getName()); }catch(JimiException je){ System.out.println(je.getMessage()); } } if(Options.getAssocTest() == ASSOC_TRIO){ Vector tdtResults = TDT.calcTrioTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(tdtResults, validateOutputFile(fileName + ".ASSOC")); } else if(Options.getAssocTest() == ASSOC_CC) { Vector ccResults = TDT.calcCCTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(ccResults, validateOutputFile(fileName + ".ASSOC")); } } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } }
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; if(!quietMode && fileName != null){ System.out.println("Using data file: " + fileName); } inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } textData = new HaploData(); Vector result = null; if(fileType == HAPS){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED) { //read in ped file textData.linkageToChrom(inputFile, PED); if(textData.getPedFile().isBogusParents()) { System.out.println("Error: One or more individuals in the file reference non-existent parents.\nThese references have been ignored."); } }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,HMP); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (result != null){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; if (result != null){ //once check has been run we can filter the markers for (int i = 0; i < result.size(); i++){ if ((((MarkerResult)result.get(i)).getRating() > 0 || skipCheck) && Chromosome.getUnfilteredMarker(i).getDupStatus() != 2){ markerResults[i] = true; }else{ markerResults[i] = false; } } }else{ //we haven't done the check (HAPS files) Arrays.fill(markerResults, true); } for (int i = 0; i < excludedMarkers.size(); i++){ int cur = ((Integer)excludedMarkers.elementAt(i)).intValue(); if (cur < 1 || cur > markerResults.length){ System.out.println("Excluded marker out of bounds has been ignored: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } Chromosome.doFilter(markerResults); if(!quietMode && infoFile != null){ System.out.println("Using marker information file: " + infoFile.getName()); } if(outputCheck && result != null){ CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(validateOutputFile(fileName + ".CHECK")); } Vector cust = new Vector(); if(blockOutputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; Haplotype[][] filtHaplos; switch(blockOutputType){ case BLOX_GABRIEL: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = validateOutputFile(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = validateOutputFile(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = validateOutputFile(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(blockFileName); cust = textData.readBlocks(blocksFile); break; case BLOX_ALL: //handled below, so we don't do anything here OutputFile = null; break; default: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; } //this handles output type ALL if(blockOutputType == BLOX_ALL) { OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); } if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC) { if (blockOutputType == BLOX_ALL){ System.out.println("Haplotype association results cannot be used with block output \"ALL\""); }else{ HaploData.saveHapAssocToText(haplos, validateOutputFile(fileName + ".HAPASSOC")); } } } if(outputDprime) { OutputFile = validateOutputFile(fileName + ".LD"); if (textData.dpTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getSize()); } } if (outputPNG || outputCompressedPNG){ OutputFile = validateOutputFile(fileName + ".LD.PNG"); if (textData.dpTable == null){ textData.generateDPrimeTable(); textData.guessBlocks(BLOX_CUSTOM, new Vector()); } if (trackFileName != null){ textData.readAnalysisTrack(new File(trackFileName)); } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getName()); }catch(JimiException je){ System.out.println(je.getMessage()); } } if(Options.getAssocTest() == ASSOC_TRIO){ Vector tdtResults = TDT.calcTrioTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(tdtResults, validateOutputFile(fileName + ".ASSOC")); } else if(Options.getAssocTest() == ASSOC_CC) { Vector ccResults = TDT.calcCCTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(ccResults, validateOutputFile(fileName + ".ASSOC")); } } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } }
1,111,671
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; if(!quietMode && fileName != null){ System.out.println("Using data file: " + fileName); } inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } textData = new HaploData(); Vector result = null; if(fileType == HAPS){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED) { //read in ped file result = textData.linkageToChrom(inputFile, PED); if(textData.getPedFile().isBogusParents()) { System.out.println("Error: One or more individuals in the file reference non-existent parents.\nThese references have been ignored."); } }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,HMP); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (result != null){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; if (result != null){ //once check has been run we can filter the markers for (int i = 0; i < result.size(); i++){ if ((((MarkerResult)result.get(i)).getRating() > 0 || skipCheck) && Chromosome.getUnfilteredMarker(i).getDupStatus() != 2){ markerResults[i] = true; }else{ markerResults[i] = false; } } }else{ //we haven't done the check (HAPS files) Arrays.fill(markerResults, true); } for (int i = 0; i < excludedMarkers.size(); i++){ int cur = ((Integer)excludedMarkers.elementAt(i)).intValue(); if (cur < 1 || cur > markerResults.length){ System.out.println("Excluded marker out of bounds has been ignored: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } Chromosome.doFilter(markerResults); if(!quietMode && infoFile != null){ System.out.println("Using marker information file: " + infoFile.getName()); } if(outputCheck && result != null){ CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(validateOutputFile(fileName + ".CHECK")); } Vector cust = new Vector(); if(blockOutputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; Haplotype[][] filtHaplos; switch(blockOutputType){ case BLOX_GABRIEL: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = validateOutputFile(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = validateOutputFile(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = validateOutputFile(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(blockFileName); cust = textData.readBlocks(blocksFile); break; case BLOX_ALL: //handled below, so we don't do anything here OutputFile = null; break; default: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; } //this handles output type ALL if(blockOutputType == BLOX_ALL) { OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); } if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC) { if (blockOutputType == BLOX_ALL){ System.out.println("Haplotype association results cannot be used with block output \"ALL\""); }else{ HaploData.saveHapAssocToText(haplos, validateOutputFile(fileName + ".HAPASSOC")); } } } if(outputDprime) { OutputFile = validateOutputFile(fileName + ".LD"); if (textData.dpTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getSize()); } } if (outputPNG || outputCompressedPNG){ OutputFile = validateOutputFile(fileName + ".LD.PNG"); if (textData.dpTable == null){ textData.generateDPrimeTable(); textData.guessBlocks(BLOX_CUSTOM, new Vector()); } if (trackFileName != null){ textData.readAnalysisTrack(new File(trackFileName)); } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getName()); }catch(JimiException je){ System.out.println(je.getMessage()); } } if(Options.getAssocTest() == ASSOC_TRIO){ Vector tdtResults = TDT.calcTrioTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(tdtResults, validateOutputFile(fileName + ".ASSOC")); } else if(Options.getAssocTest() == ASSOC_CC) { Vector ccResults = TDT.calcCCTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(ccResults, validateOutputFile(fileName + ".ASSOC")); } } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } }
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; if(!quietMode && fileName != null){ System.out.println("Using data file: " + fileName); } inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } textData = new HaploData(); Vector result = null; if(fileType == HAPS){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED) { //read in ped file result = textData.linkageToChrom(inputFile, PED); if(textData.getPedFile().isBogusParents()) { System.out.println("Error: One or more individuals in the file reference non-existent parents.\nThese references have been ignored."); } }else{ //read in hapmapfile textData.linkageToChrom(inputFile,HMP); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (result != null){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; if (result != null){ //once check has been run we can filter the markers for (int i = 0; i < result.size(); i++){ if ((((MarkerResult)result.get(i)).getRating() > 0 || skipCheck) && Chromosome.getUnfilteredMarker(i).getDupStatus() != 2){ markerResults[i] = true; }else{ markerResults[i] = false; } } }else{ //we haven't done the check (HAPS files) Arrays.fill(markerResults, true); } for (int i = 0; i < excludedMarkers.size(); i++){ int cur = ((Integer)excludedMarkers.elementAt(i)).intValue(); if (cur < 1 || cur > markerResults.length){ System.out.println("Excluded marker out of bounds has been ignored: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } Chromosome.doFilter(markerResults); if(!quietMode && infoFile != null){ System.out.println("Using marker information file: " + infoFile.getName()); } if(outputCheck && result != null){ CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(validateOutputFile(fileName + ".CHECK")); } Vector cust = new Vector(); if(blockOutputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; Haplotype[][] filtHaplos; switch(blockOutputType){ case BLOX_GABRIEL: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = validateOutputFile(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = validateOutputFile(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = validateOutputFile(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(blockFileName); cust = textData.readBlocks(blocksFile); break; case BLOX_ALL: //handled below, so we don't do anything here OutputFile = null; break; default: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; } //this handles output type ALL if(blockOutputType == BLOX_ALL) { OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); } if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC) { if (blockOutputType == BLOX_ALL){ System.out.println("Haplotype association results cannot be used with block output \"ALL\""); }else{ HaploData.saveHapAssocToText(haplos, validateOutputFile(fileName + ".HAPASSOC")); } } } if(outputDprime) { OutputFile = validateOutputFile(fileName + ".LD"); if (textData.dpTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getSize()); } } if (outputPNG || outputCompressedPNG){ OutputFile = validateOutputFile(fileName + ".LD.PNG"); if (textData.dpTable == null){ textData.generateDPrimeTable(); textData.guessBlocks(BLOX_CUSTOM, new Vector()); } if (trackFileName != null){ textData.readAnalysisTrack(new File(trackFileName)); } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getName()); }catch(JimiException je){ System.out.println(je.getMessage()); } } if(Options.getAssocTest() == ASSOC_TRIO){ Vector tdtResults = TDT.calcTrioTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(tdtResults, validateOutputFile(fileName + ".ASSOC")); } else if(Options.getAssocTest() == ASSOC_CC) { Vector ccResults = TDT.calcCCTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(ccResults, validateOutputFile(fileName + ".ASSOC")); } } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } }
1,111,672
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; if(!quietMode && fileName != null){ System.out.println("Using data file: " + fileName); } inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } textData = new HaploData(); Vector result = null; if(fileType == HAPS){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED) { //read in ped file result = textData.linkageToChrom(inputFile, PED); if(textData.getPedFile().isBogusParents()) { System.out.println("Error: One or more individuals in the file reference non-existent parents.\nThese references have been ignored."); } }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,HMP); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (result != null){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; if (result != null){ //once check has been run we can filter the markers for (int i = 0; i < result.size(); i++){ if ((((MarkerResult)result.get(i)).getRating() > 0 || skipCheck) && Chromosome.getUnfilteredMarker(i).getDupStatus() != 2){ markerResults[i] = true; }else{ markerResults[i] = false; } } }else{ //we haven't done the check (HAPS files) Arrays.fill(markerResults, true); } for (int i = 0; i < excludedMarkers.size(); i++){ int cur = ((Integer)excludedMarkers.elementAt(i)).intValue(); if (cur < 1 || cur > markerResults.length){ System.out.println("Excluded marker out of bounds has been ignored: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } Chromosome.doFilter(markerResults); if(!quietMode && infoFile != null){ System.out.println("Using marker information file: " + infoFile.getName()); } if(outputCheck && result != null){ CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(validateOutputFile(fileName + ".CHECK")); } Vector cust = new Vector(); if(blockOutputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; Haplotype[][] filtHaplos; switch(blockOutputType){ case BLOX_GABRIEL: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = validateOutputFile(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = validateOutputFile(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = validateOutputFile(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(blockFileName); cust = textData.readBlocks(blocksFile); break; case BLOX_ALL: //handled below, so we don't do anything here OutputFile = null; break; default: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; } //this handles output type ALL if(blockOutputType == BLOX_ALL) { OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); } if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC) { if (blockOutputType == BLOX_ALL){ System.out.println("Haplotype association results cannot be used with block output \"ALL\""); }else{ HaploData.saveHapAssocToText(haplos, validateOutputFile(fileName + ".HAPASSOC")); } } } if(outputDprime) { OutputFile = validateOutputFile(fileName + ".LD"); if (textData.dpTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getSize()); } } if (outputPNG || outputCompressedPNG){ OutputFile = validateOutputFile(fileName + ".LD.PNG"); if (textData.dpTable == null){ textData.generateDPrimeTable(); textData.guessBlocks(BLOX_CUSTOM, new Vector()); } if (trackFileName != null){ textData.readAnalysisTrack(new File(trackFileName)); } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getName()); }catch(JimiException je){ System.out.println(je.getMessage()); } } if(Options.getAssocTest() == ASSOC_TRIO){ Vector tdtResults = TDT.calcTrioTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(tdtResults, validateOutputFile(fileName + ".ASSOC")); } else if(Options.getAssocTest() == ASSOC_CC) { Vector ccResults = TDT.calcCCTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(ccResults, validateOutputFile(fileName + ".ASSOC")); } } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } }
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; if(!quietMode && fileName != null){ System.out.println("Using data file: " + fileName); } inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } textData = new HaploData(); Vector result = null; if(fileType == HAPS){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED) { //read in ped file result = textData.linkageToChrom(inputFile, PED); if(textData.getPedFile().isBogusParents()) { System.out.println("Error: One or more individuals in the file reference non-existent parents.\nThese references have been ignored."); } }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,HMP); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (fileType != HAPS){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; if (fileType != HAPS){ //once check has been run we can filter the markers for (int i = 0; i < result.size(); i++){ if ((((MarkerResult)result.get(i)).getRating() > 0 || skipCheck) && Chromosome.getUnfilteredMarker(i).getDupStatus() != 2){ markerResults[i] = true; }else{ markerResults[i] = false; } } }else{ //we haven't done the check (HAPS files) Arrays.fill(markerResults, true); } for (int i = 0; i < excludedMarkers.size(); i++){ int cur = ((Integer)excludedMarkers.elementAt(i)).intValue(); if (cur < 1 || cur > markerResults.length){ System.out.println("Excluded marker out of bounds has been ignored: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } Chromosome.doFilter(markerResults); if(!quietMode && infoFile != null){ System.out.println("Using marker information file: " + infoFile.getName()); } if(outputCheck && result != null){ CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(validateOutputFile(fileName + ".CHECK")); } Vector cust = new Vector(); if(blockOutputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; Haplotype[][] filtHaplos; switch(blockOutputType){ case BLOX_GABRIEL: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = validateOutputFile(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = validateOutputFile(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = validateOutputFile(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(blockFileName); cust = textData.readBlocks(blocksFile); break; case BLOX_ALL: //handled below, so we don't do anything here OutputFile = null; break; default: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; } //this handles output type ALL if(blockOutputType == BLOX_ALL) { OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); } if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC) { if (blockOutputType == BLOX_ALL){ System.out.println("Haplotype association results cannot be used with block output \"ALL\""); }else{ HaploData.saveHapAssocToText(haplos, validateOutputFile(fileName + ".HAPASSOC")); } } } if(outputDprime) { OutputFile = validateOutputFile(fileName + ".LD"); if (textData.dpTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getSize()); } } if (outputPNG || outputCompressedPNG){ OutputFile = validateOutputFile(fileName + ".LD.PNG"); if (textData.dpTable == null){ textData.generateDPrimeTable(); textData.guessBlocks(BLOX_CUSTOM, new Vector()); } if (trackFileName != null){ textData.readAnalysisTrack(new File(trackFileName)); } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getName()); }catch(JimiException je){ System.out.println(je.getMessage()); } } if(Options.getAssocTest() == ASSOC_TRIO){ Vector tdtResults = TDT.calcTrioTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(tdtResults, validateOutputFile(fileName + ".ASSOC")); } else if(Options.getAssocTest() == ASSOC_CC) { Vector ccResults = TDT.calcCCTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(ccResults, validateOutputFile(fileName + ".ASSOC")); } } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } }
1,111,673
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; if(!quietMode && fileName != null){ System.out.println("Using data file: " + fileName); } inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } textData = new HaploData(); Vector result = null; if(fileType == HAPS){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED) { //read in ped file result = textData.linkageToChrom(inputFile, PED); if(textData.getPedFile().isBogusParents()) { System.out.println("Error: One or more individuals in the file reference non-existent parents.\nThese references have been ignored."); } }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,HMP); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (result != null){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; if (result != null){ //once check has been run we can filter the markers for (int i = 0; i < result.size(); i++){ if ((((MarkerResult)result.get(i)).getRating() > 0 || skipCheck) && Chromosome.getUnfilteredMarker(i).getDupStatus() != 2){ markerResults[i] = true; }else{ markerResults[i] = false; } } }else{ //we haven't done the check (HAPS files) Arrays.fill(markerResults, true); } for (int i = 0; i < excludedMarkers.size(); i++){ int cur = ((Integer)excludedMarkers.elementAt(i)).intValue(); if (cur < 1 || cur > markerResults.length){ System.out.println("Excluded marker out of bounds has been ignored: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } Chromosome.doFilter(markerResults); if(!quietMode && infoFile != null){ System.out.println("Using marker information file: " + infoFile.getName()); } if(outputCheck && result != null){ CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(validateOutputFile(fileName + ".CHECK")); } Vector cust = new Vector(); if(blockOutputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; Haplotype[][] filtHaplos; switch(blockOutputType){ case BLOX_GABRIEL: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = validateOutputFile(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = validateOutputFile(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = validateOutputFile(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(blockFileName); cust = textData.readBlocks(blocksFile); break; case BLOX_ALL: //handled below, so we don't do anything here OutputFile = null; break; default: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; } //this handles output type ALL if(blockOutputType == BLOX_ALL) { OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); } if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC) { if (blockOutputType == BLOX_ALL){ System.out.println("Haplotype association results cannot be used with block output \"ALL\""); }else{ HaploData.saveHapAssocToText(haplos, validateOutputFile(fileName + ".HAPASSOC")); } } } if(outputDprime) { OutputFile = validateOutputFile(fileName + ".LD"); if (textData.dpTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getSize()); } } if (outputPNG || outputCompressedPNG){ OutputFile = validateOutputFile(fileName + ".LD.PNG"); if (textData.dpTable == null){ textData.generateDPrimeTable(); textData.guessBlocks(BLOX_CUSTOM, new Vector()); } if (trackFileName != null){ textData.readAnalysisTrack(new File(trackFileName)); } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getName()); }catch(JimiException je){ System.out.println(je.getMessage()); } } if(Options.getAssocTest() == ASSOC_TRIO){ Vector tdtResults = TDT.calcTrioTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(tdtResults, validateOutputFile(fileName + ".ASSOC")); } else if(Options.getAssocTest() == ASSOC_CC) { Vector ccResults = TDT.calcCCTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(ccResults, validateOutputFile(fileName + ".ASSOC")); } } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } }
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; if(!quietMode && fileName != null){ System.out.println("Using data file: " + fileName); } inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } textData = new HaploData(); Vector result = null; if(fileType == HAPS){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED) { //read in ped file result = textData.linkageToChrom(inputFile, PED); if(textData.getPedFile().isBogusParents()) { System.out.println("Error: One or more individuals in the file reference non-existent parents.\nThese references have been ignored."); } }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,HMP); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } Vector result = null; if (fileType != HAPS){ result = textData.getPedFile().getResults(); textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; Vector result = null; if (fileType != HAPS){ result = textData.getPedFile().getResults(); //once check has been run we can filter the markers for (int i = 0; i < result.size(); i++){ if ((((MarkerResult)result.get(i)).getRating() > 0 || skipCheck) && Chromosome.getUnfilteredMarker(i).getDupStatus() != 2){ markerResults[i] = true; }else{ markerResults[i] = false; } } }else{ //we haven't done the check (HAPS files) Arrays.fill(markerResults, true); } for (int i = 0; i < excludedMarkers.size(); i++){ int cur = ((Integer)excludedMarkers.elementAt(i)).intValue(); if (cur < 1 || cur > markerResults.length){ System.out.println("Excluded marker out of bounds has been ignored: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } Chromosome.doFilter(markerResults); if(!quietMode && infoFile != null){ System.out.println("Using marker information file: " + infoFile.getName()); } if(outputCheck && result != null){ CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(validateOutputFile(fileName + ".CHECK")); } Vector cust = new Vector(); if(blockOutputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; Haplotype[][] filtHaplos; switch(blockOutputType){ case BLOX_GABRIEL: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = validateOutputFile(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = validateOutputFile(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = validateOutputFile(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(blockFileName); cust = textData.readBlocks(blocksFile); break; case BLOX_ALL: //handled below, so we don't do anything here OutputFile = null; break; default: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; } //this handles output type ALL if(blockOutputType == BLOX_ALL) { OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); } if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC) { if (blockOutputType == BLOX_ALL){ System.out.println("Haplotype association results cannot be used with block output \"ALL\""); }else{ HaploData.saveHapAssocToText(haplos, validateOutputFile(fileName + ".HAPASSOC")); } } } if(outputDprime) { OutputFile = validateOutputFile(fileName + ".LD"); if (textData.dpTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getSize()); } } if (outputPNG || outputCompressedPNG){ OutputFile = validateOutputFile(fileName + ".LD.PNG"); if (textData.dpTable == null){ textData.generateDPrimeTable(); textData.guessBlocks(BLOX_CUSTOM, new Vector()); } if (trackFileName != null){ textData.readAnalysisTrack(new File(trackFileName)); } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getName()); }catch(JimiException je){ System.out.println(je.getMessage()); } } if(Options.getAssocTest() == ASSOC_TRIO){ Vector tdtResults = TDT.calcTrioTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(tdtResults, validateOutputFile(fileName + ".ASSOC")); } else if(Options.getAssocTest() == ASSOC_CC) { Vector ccResults = TDT.calcCCTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(ccResults, validateOutputFile(fileName + ".ASSOC")); } } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } }
1,111,674
public TDTPanel(PedFile pf, int t){ type = t; if (type == 1){ result = TDT.calcTrioTDT(pf); }else{ result = TDT.calcCCTDT(pf); } tableColumnNames.add("#"); tableColumnNames.add("Name"); if (type == 1){ tableColumnNames.add("Overtransmitted"); tableColumnNames.add("T:U"); }else{ tableColumnNames.add("Major Alleles"); tableColumnNames.add("Case, Control Ratios"); } tableColumnNames.add("Chi Squared"); tableColumnNames.add("p value"); refreshTable(); }
public TDTPanel(PedFile pf, int t) throws PedFileException{ type = t; if (type == 1){ result = TDT.calcTrioTDT(pf); }else{ result = TDT.calcCCTDT(pf); } tableColumnNames.add("#"); tableColumnNames.add("Name"); if (type == 1){ tableColumnNames.add("Overtransmitted"); tableColumnNames.add("T:U"); }else{ tableColumnNames.add("Major Alleles"); tableColumnNames.add("Case, Control Ratios"); } tableColumnNames.add("Chi Squared"); tableColumnNames.add("p value"); refreshTable(); }
1,111,675
private OpenProjectAction() { super("Open Project...", ASUtils.createJLFIcon("general/Open", "Open Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))); putValue(AbstractAction.SHORT_DESCRIPTION, "Open"); putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); }
private OpenProjectAction(RecentMenu recent) { super("Open Project...", ASUtils.createJLFIcon("general/Open", "Open Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))); putValue(AbstractAction.SHORT_DESCRIPTION, "Open"); putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); }
1,111,676
protected void closeProject(SwingUIProject project) { // close connections Iterator it = project.getSourceDatabases().getDatabaseList().iterator();; while (it.hasNext()) { SQLDatabase db = (SQLDatabase) it.next(); logger.debug ("closing connection: " + db.getName()); db.disconnect(); } }
protected void closeProject(SwingUIProject project) { // close connections Iterator it = project.getSourceDatabases().getDatabaseList().iterator(); while (it.hasNext()) { SQLDatabase db = (SQLDatabase) it.next(); logger.debug ("closing connection: " + db.getName()); db.disconnect(); } }
1,111,679
protected void init() throws ArchitectException { int accelMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); UserSettings us; // must be done right away, because a static // initializer in this class effects BeanUtils // behaviour which the XML Digester relies // upon heavily //TypeMap.getInstance(); contentPane = (JComponent)getContentPane(); try { ConfigFile cf = ConfigFile.getDefaultInstance(); us = cf.read(); architectSession.setUserSettings(us); sprefs = architectSession.getUserSettings().getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } while (us.getPlDotIni() == null) { String message; String[] options = new String[] {"Browse", "Create"}; if (us.getPlDotIniPath() == null) { message = "location is not set"; } else if (new File(us.getPlDotIniPath()).isFile()) { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n could not be read"; } else { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n does not exist"; } int choice = JOptionPane.showOptionDialog(null, "The Architect keeps its list of database connections" + "\nin a file called PL.INI. Your PL.INI "+message+"." + "\n\nYou can browse for an existing PL.INI file on your system" + "\nor allow the Architect to create a new one in your home directory." + "\n\nHint: If you are a Power*Loader Suite user, you should browse for" + "\nan existing PL.INI in your Power*Loader installation directory.", "Missing PL.INI", 0, JOptionPane.INFORMATION_MESSAGE, null, options, null); File newPlIniFile; if (choice == 0) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(ASUtils.INI_FILE_FILTER); fc.setDialogTitle("Locate your PL.INI file"); int fcChoice = fc.showOpenDialog(null); if (fcChoice == JFileChooser.APPROVE_OPTION) { newPlIniFile = fc.getSelectedFile(); } else { newPlIniFile = null; } } else { newPlIniFile = new File(System.getProperty("user.home"), "pl.ini"); } if (newPlIniFile != null) try { newPlIniFile.createNewFile(); us.setPlDotIniPath(newPlIniFile.getPath()); } catch (IOException e1) { logger.error("Caught IO exception while creating empty PL.INI at \"" +newPlIniFile.getPath()+"\"", e1); JOptionPane.showMessageDialog(null, "Failed to create file \""+newPlIniFile.getPath()+"\":\n"+e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } // Create actions aboutAction = new AboutAction(); newProjectAction = new AbstractAction("New Project", ASUtils.createJLFIcon("general/New","New Project",sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } } }; newProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "New"); newProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, accelMask)); openProjectAction = new OpenProjectAction(); saveProjectAction = new AbstractAction("Save Project", ASUtils.createJLFIcon("general/Save", "Save Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); } }; saveProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save"); saveProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, accelMask)); saveProjectAsAction = new AbstractAction("Save Project As...", ASUtils.createJLFIcon("general/SaveAs", "Save Project As...", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); } }; saveProjectAsAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save As"); prefAction = new PreferencesAction(); projectSettingsAction = new ProjectSettingsAction(); projectSettingsAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, accelMask)); printAction = new PrintAction(); printAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, accelMask)); zoomInAction = new ZoomAction(ZOOM_STEP); zoomOutAction = new ZoomAction(ZOOM_STEP * -1.0); zoomNormalAction = new AbstractAction("Reset Zoom", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); } }; zoomNormalAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Reset Zoom"); undoAction = new UndoAction(); redoAction = new RedoAction(); autoLayoutAction = new AutoLayoutAction(); autoLayout = new FruchtermanReingoldForceLayout(); autoLayoutAction.setLayout(autoLayout); exportDDLAction = new ExportDDLAction(); compareDMAction = new CompareDMAction(); exportPLTransAction = new ExportPLTransAction(); quickStartAction = new QuickStartAction(); deleteSelectedAction = new DeleteSelectedAction(); createIdentifyingRelationshipAction = new CreateRelationshipAction(true); createNonIdentifyingRelationshipAction = new CreateRelationshipAction(false); editRelationshipAction = new EditRelationshipAction(); createTableAction = new CreateTableAction(); editColumnAction = new EditColumnAction(); insertColumnAction = new InsertColumnAction(); editTableAction = new EditTableAction(); searchReplaceAction = new SearchReplaceAction(); searchReplaceAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, accelMask)); selectAllAction = new SelectAllAction(); selectAllAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, accelMask)); menuBar = new JMenuBar(); //Settingup JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); fileMenu.add(newProjectAction); fileMenu.add(openProjectAction); fileMenu.add(saveProjectAction); fileMenu.add(saveProjectAsAction); fileMenu.add(printAction); fileMenu.add(prefAction); fileMenu.add(projectSettingsAction); fileMenu.add(saveSettingsAction); fileMenu.add(exitAction); menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic('e'); editMenu.add(undoAction); editMenu.add(redoAction); editMenu.addSeparator(); editMenu.add(selectAllAction); editMenu.addSeparator(); editMenu.add(searchReplaceAction); menuBar.add(editMenu); // the connections menu is set up when a new project is created (because it depends on the current DBTree) connectionsMenu = new JMenu("Connections"); connectionsMenu.setMnemonic('c'); menuBar.add(connectionsMenu); JMenu etlMenu = new JMenu("ETL"); etlMenu.setMnemonic('l'); JMenu etlSubmenuOne = new JMenu("Power*Loader"); etlSubmenuOne.add(exportPLTransAction); etlSubmenuOne.add(new JMenuItem("PL Transaction File Export")); etlSubmenuOne.add(new JMenuItem("Run Power*Loader")); etlSubmenuOne.add(quickStartAction); etlMenu.add(etlSubmenuOne); menuBar.add(etlMenu); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('t'); toolsMenu.add(exportDDLAction); toolsMenu.add(compareDMAction); menuBar.add(toolsMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('h'); helpMenu.add(aboutAction); menuBar.add(helpMenu); setJMenuBar(menuBar); projectBar = new JToolBar(JToolBar.HORIZONTAL); ppBar = new JToolBar(JToolBar.VERTICAL); projectBar.add(newProjectAction); projectBar.add(openProjectAction); projectBar.add(saveProjectAction); projectBar.addSeparator(); projectBar.add(printAction); projectBar.addSeparator(); projectBar.add(undoAction); projectBar.add(redoAction); projectBar.addSeparator(); projectBar.add(exportDDLAction); projectBar.addSeparator(); projectBar.add(compareDMAction); projectBar.addSeparator(); projectBar.add(autoLayoutAction); projectBar.setToolTipText("Project Toolbar"); projectBar.setName("Project Toolbar"); JButton tempButton = null; // shared actions need to report where they are coming from ppBar.setToolTipText("PlayPen Toolbar"); ppBar.setName("PlayPen ToolBar"); ppBar.add(zoomInAction); ppBar.add(zoomOutAction); ppBar.add(zoomNormalAction); ppBar.addSeparator(); tempButton = ppBar.add(deleteSelectedAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(createTableAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(insertColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); tempButton = ppBar.add(editColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); ppBar.add(createNonIdentifyingRelationshipAction); ppBar.add(createIdentifyingRelationshipAction); tempButton = ppBar.add(editRelationshipAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); Container projectBarPane = getContentPane(); projectBarPane.setLayout(new BorderLayout()); projectBarPane.add(projectBar, BorderLayout.NORTH); JPanel cp = new JPanel(new BorderLayout()); cp.add(ppBar, BorderLayout.EAST); projectBarPane.add(cp, BorderLayout.CENTER); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); cp.add(splitPane, BorderLayout.CENTER); logger.debug("Added splitpane to content pane"); splitPane.setDividerLocation (sprefs.getInt(SwingUserSettings.DIVIDER_LOCATION, 150)); //dbTree.getPreferredSize().width)); Rectangle bounds = new Rectangle(); bounds.x = sprefs.getInt(SwingUserSettings.MAIN_FRAME_X, 40); bounds.y = sprefs.getInt(SwingUserSettings.MAIN_FRAME_Y, 40); bounds.width = sprefs.getInt(SwingUserSettings.MAIN_FRAME_WIDTH, 600); bounds.height = sprefs.getInt(SwingUserSettings.MAIN_FRAME_HEIGHT, 440); setBounds(bounds); addWindowListener(afWindowListener = new ArchitectFrameWindowListener()); setProject(new SwingUIProject("New Project")); }
protected void init() throws ArchitectException { int accelMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); UserSettings us; // must be done right away, because a static // initializer in this class effects BeanUtils // behaviour which the XML Digester relies // upon heavily //TypeMap.getInstance(); contentPane = (JComponent)getContentPane(); try { ConfigFile cf = ConfigFile.getDefaultInstance(); us = cf.read(); architectSession.setUserSettings(us); sprefs = architectSession.getUserSettings().getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } while (us.getPlDotIni() == null) { String message; String[] options = new String[] {"Browse", "Create"}; if (us.getPlDotIniPath() == null) { message = "location is not set"; } else if (new File(us.getPlDotIniPath()).isFile()) { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n could not be read"; } else { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n does not exist"; } int choice = JOptionPane.showOptionDialog(null, "The Architect keeps its list of database connections" + "\nin a file called PL.INI. Your PL.INI "+message+"." + "\n\nYou can browse for an existing PL.INI file on your system" + "\nor allow the Architect to create a new one in your home directory." + "\n\nHint: If you are a Power*Loader Suite user, you should browse for" + "\nan existing PL.INI in your Power*Loader installation directory.", "Missing PL.INI", 0, JOptionPane.INFORMATION_MESSAGE, null, options, null); File newPlIniFile; if (choice == 0) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(ASUtils.INI_FILE_FILTER); fc.setDialogTitle("Locate your PL.INI file"); int fcChoice = fc.showOpenDialog(null); if (fcChoice == JFileChooser.APPROVE_OPTION) { newPlIniFile = fc.getSelectedFile(); } else { newPlIniFile = null; } } else { newPlIniFile = new File(System.getProperty("user.home"), "pl.ini"); } if (newPlIniFile != null) try { newPlIniFile.createNewFile(); us.setPlDotIniPath(newPlIniFile.getPath()); } catch (IOException e1) { logger.error("Caught IO exception while creating empty PL.INI at \"" +newPlIniFile.getPath()+"\"", e1); JOptionPane.showMessageDialog(null, "Failed to create file \""+newPlIniFile.getPath()+"\":\n"+e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } // Create actions aboutAction = new AboutAction(); newProjectAction = new AbstractAction("New Project", ASUtils.createJLFIcon("general/New","New Project",sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } } }; newProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "New"); newProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, accelMask)); final RecentMenu recent = new RecentMenu(this) { @Override public void loadFile(String fileName) throws IOException { openFile(fileName); } }; openProjectAction = new OpenProjectAction(recent); JMenuItem clearItem = new JMenuItem("Clear Recent Files"); clearItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { recent.clear(); } }); saveProjectAction = new AbstractAction("Save Project", ASUtils.createJLFIcon("general/Save", "Save Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); } }; saveProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save"); saveProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, accelMask)); saveProjectAsAction = new AbstractAction("Save Project As...", ASUtils.createJLFIcon("general/SaveAs", "Save Project As...", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); } }; saveProjectAsAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save As"); prefAction = new PreferencesAction(); projectSettingsAction = new ProjectSettingsAction(); projectSettingsAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, accelMask)); printAction = new PrintAction(); printAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, accelMask)); zoomInAction = new ZoomAction(ZOOM_STEP); zoomOutAction = new ZoomAction(ZOOM_STEP * -1.0); zoomNormalAction = new AbstractAction("Reset Zoom", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); } }; zoomNormalAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Reset Zoom"); undoAction = new UndoAction(); redoAction = new RedoAction(); autoLayoutAction = new AutoLayoutAction(); autoLayout = new FruchtermanReingoldForceLayout(); autoLayoutAction.setLayout(autoLayout); exportDDLAction = new ExportDDLAction(); compareDMAction = new CompareDMAction(); exportPLTransAction = new ExportPLTransAction(); quickStartAction = new QuickStartAction(); deleteSelectedAction = new DeleteSelectedAction(); createIdentifyingRelationshipAction = new CreateRelationshipAction(true); createNonIdentifyingRelationshipAction = new CreateRelationshipAction(false); editRelationshipAction = new EditRelationshipAction(); createTableAction = new CreateTableAction(); editColumnAction = new EditColumnAction(); insertColumnAction = new InsertColumnAction(); editTableAction = new EditTableAction(); searchReplaceAction = new SearchReplaceAction(); searchReplaceAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, accelMask)); selectAllAction = new SelectAllAction(); selectAllAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, accelMask)); menuBar = new JMenuBar(); //Settingup JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); fileMenu.add(newProjectAction); fileMenu.add(openProjectAction); fileMenu.add(saveProjectAction); fileMenu.add(saveProjectAsAction); fileMenu.add(printAction); fileMenu.add(prefAction); fileMenu.add(projectSettingsAction); fileMenu.add(saveSettingsAction); fileMenu.add(exitAction); menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic('e'); editMenu.add(undoAction); editMenu.add(redoAction); editMenu.addSeparator(); editMenu.add(selectAllAction); editMenu.addSeparator(); editMenu.add(searchReplaceAction); menuBar.add(editMenu); // the connections menu is set up when a new project is created (because it depends on the current DBTree) connectionsMenu = new JMenu("Connections"); connectionsMenu.setMnemonic('c'); menuBar.add(connectionsMenu); JMenu etlMenu = new JMenu("ETL"); etlMenu.setMnemonic('l'); JMenu etlSubmenuOne = new JMenu("Power*Loader"); etlSubmenuOne.add(exportPLTransAction); etlSubmenuOne.add(new JMenuItem("PL Transaction File Export")); etlSubmenuOne.add(new JMenuItem("Run Power*Loader")); etlSubmenuOne.add(quickStartAction); etlMenu.add(etlSubmenuOne); menuBar.add(etlMenu); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('t'); toolsMenu.add(exportDDLAction); toolsMenu.add(compareDMAction); menuBar.add(toolsMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('h'); helpMenu.add(aboutAction); menuBar.add(helpMenu); setJMenuBar(menuBar); projectBar = new JToolBar(JToolBar.HORIZONTAL); ppBar = new JToolBar(JToolBar.VERTICAL); projectBar.add(newProjectAction); projectBar.add(openProjectAction); projectBar.add(saveProjectAction); projectBar.addSeparator(); projectBar.add(printAction); projectBar.addSeparator(); projectBar.add(undoAction); projectBar.add(redoAction); projectBar.addSeparator(); projectBar.add(exportDDLAction); projectBar.addSeparator(); projectBar.add(compareDMAction); projectBar.addSeparator(); projectBar.add(autoLayoutAction); projectBar.setToolTipText("Project Toolbar"); projectBar.setName("Project Toolbar"); JButton tempButton = null; // shared actions need to report where they are coming from ppBar.setToolTipText("PlayPen Toolbar"); ppBar.setName("PlayPen ToolBar"); ppBar.add(zoomInAction); ppBar.add(zoomOutAction); ppBar.add(zoomNormalAction); ppBar.addSeparator(); tempButton = ppBar.add(deleteSelectedAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(createTableAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(insertColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); tempButton = ppBar.add(editColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); ppBar.add(createNonIdentifyingRelationshipAction); ppBar.add(createIdentifyingRelationshipAction); tempButton = ppBar.add(editRelationshipAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); Container projectBarPane = getContentPane(); projectBarPane.setLayout(new BorderLayout()); projectBarPane.add(projectBar, BorderLayout.NORTH); JPanel cp = new JPanel(new BorderLayout()); cp.add(ppBar, BorderLayout.EAST); projectBarPane.add(cp, BorderLayout.CENTER); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); cp.add(splitPane, BorderLayout.CENTER); logger.debug("Added splitpane to content pane"); splitPane.setDividerLocation (sprefs.getInt(SwingUserSettings.DIVIDER_LOCATION, 150)); //dbTree.getPreferredSize().width)); Rectangle bounds = new Rectangle(); bounds.x = sprefs.getInt(SwingUserSettings.MAIN_FRAME_X, 40); bounds.y = sprefs.getInt(SwingUserSettings.MAIN_FRAME_Y, 40); bounds.width = sprefs.getInt(SwingUserSettings.MAIN_FRAME_WIDTH, 600); bounds.height = sprefs.getInt(SwingUserSettings.MAIN_FRAME_HEIGHT, 440); setBounds(bounds); addWindowListener(afWindowListener = new ArchitectFrameWindowListener()); setProject(new SwingUIProject("New Project")); }
1,111,680
protected void init() throws ArchitectException { int accelMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); UserSettings us; // must be done right away, because a static // initializer in this class effects BeanUtils // behaviour which the XML Digester relies // upon heavily //TypeMap.getInstance(); contentPane = (JComponent)getContentPane(); try { ConfigFile cf = ConfigFile.getDefaultInstance(); us = cf.read(); architectSession.setUserSettings(us); sprefs = architectSession.getUserSettings().getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } while (us.getPlDotIni() == null) { String message; String[] options = new String[] {"Browse", "Create"}; if (us.getPlDotIniPath() == null) { message = "location is not set"; } else if (new File(us.getPlDotIniPath()).isFile()) { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n could not be read"; } else { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n does not exist"; } int choice = JOptionPane.showOptionDialog(null, "The Architect keeps its list of database connections" + "\nin a file called PL.INI. Your PL.INI "+message+"." + "\n\nYou can browse for an existing PL.INI file on your system" + "\nor allow the Architect to create a new one in your home directory." + "\n\nHint: If you are a Power*Loader Suite user, you should browse for" + "\nan existing PL.INI in your Power*Loader installation directory.", "Missing PL.INI", 0, JOptionPane.INFORMATION_MESSAGE, null, options, null); File newPlIniFile; if (choice == 0) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(ASUtils.INI_FILE_FILTER); fc.setDialogTitle("Locate your PL.INI file"); int fcChoice = fc.showOpenDialog(null); if (fcChoice == JFileChooser.APPROVE_OPTION) { newPlIniFile = fc.getSelectedFile(); } else { newPlIniFile = null; } } else { newPlIniFile = new File(System.getProperty("user.home"), "pl.ini"); } if (newPlIniFile != null) try { newPlIniFile.createNewFile(); us.setPlDotIniPath(newPlIniFile.getPath()); } catch (IOException e1) { logger.error("Caught IO exception while creating empty PL.INI at \"" +newPlIniFile.getPath()+"\"", e1); JOptionPane.showMessageDialog(null, "Failed to create file \""+newPlIniFile.getPath()+"\":\n"+e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } // Create actions aboutAction = new AboutAction(); newProjectAction = new AbstractAction("New Project", ASUtils.createJLFIcon("general/New","New Project",sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } } }; newProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "New"); newProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, accelMask)); openProjectAction = new OpenProjectAction(); saveProjectAction = new AbstractAction("Save Project", ASUtils.createJLFIcon("general/Save", "Save Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); } }; saveProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save"); saveProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, accelMask)); saveProjectAsAction = new AbstractAction("Save Project As...", ASUtils.createJLFIcon("general/SaveAs", "Save Project As...", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); } }; saveProjectAsAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save As"); prefAction = new PreferencesAction(); projectSettingsAction = new ProjectSettingsAction(); projectSettingsAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, accelMask)); printAction = new PrintAction(); printAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, accelMask)); zoomInAction = new ZoomAction(ZOOM_STEP); zoomOutAction = new ZoomAction(ZOOM_STEP * -1.0); zoomNormalAction = new AbstractAction("Reset Zoom", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); } }; zoomNormalAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Reset Zoom"); undoAction = new UndoAction(); redoAction = new RedoAction(); autoLayoutAction = new AutoLayoutAction(); autoLayout = new FruchtermanReingoldForceLayout(); autoLayoutAction.setLayout(autoLayout); exportDDLAction = new ExportDDLAction(); compareDMAction = new CompareDMAction(); exportPLTransAction = new ExportPLTransAction(); quickStartAction = new QuickStartAction(); deleteSelectedAction = new DeleteSelectedAction(); createIdentifyingRelationshipAction = new CreateRelationshipAction(true); createNonIdentifyingRelationshipAction = new CreateRelationshipAction(false); editRelationshipAction = new EditRelationshipAction(); createTableAction = new CreateTableAction(); editColumnAction = new EditColumnAction(); insertColumnAction = new InsertColumnAction(); editTableAction = new EditTableAction(); searchReplaceAction = new SearchReplaceAction(); searchReplaceAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, accelMask)); selectAllAction = new SelectAllAction(); selectAllAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, accelMask)); menuBar = new JMenuBar(); //Settingup JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); fileMenu.add(newProjectAction); fileMenu.add(openProjectAction); fileMenu.add(saveProjectAction); fileMenu.add(saveProjectAsAction); fileMenu.add(printAction); fileMenu.add(prefAction); fileMenu.add(projectSettingsAction); fileMenu.add(saveSettingsAction); fileMenu.add(exitAction); menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic('e'); editMenu.add(undoAction); editMenu.add(redoAction); editMenu.addSeparator(); editMenu.add(selectAllAction); editMenu.addSeparator(); editMenu.add(searchReplaceAction); menuBar.add(editMenu); // the connections menu is set up when a new project is created (because it depends on the current DBTree) connectionsMenu = new JMenu("Connections"); connectionsMenu.setMnemonic('c'); menuBar.add(connectionsMenu); JMenu etlMenu = new JMenu("ETL"); etlMenu.setMnemonic('l'); JMenu etlSubmenuOne = new JMenu("Power*Loader"); etlSubmenuOne.add(exportPLTransAction); etlSubmenuOne.add(new JMenuItem("PL Transaction File Export")); etlSubmenuOne.add(new JMenuItem("Run Power*Loader")); etlSubmenuOne.add(quickStartAction); etlMenu.add(etlSubmenuOne); menuBar.add(etlMenu); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('t'); toolsMenu.add(exportDDLAction); toolsMenu.add(compareDMAction); menuBar.add(toolsMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('h'); helpMenu.add(aboutAction); menuBar.add(helpMenu); setJMenuBar(menuBar); projectBar = new JToolBar(JToolBar.HORIZONTAL); ppBar = new JToolBar(JToolBar.VERTICAL); projectBar.add(newProjectAction); projectBar.add(openProjectAction); projectBar.add(saveProjectAction); projectBar.addSeparator(); projectBar.add(printAction); projectBar.addSeparator(); projectBar.add(undoAction); projectBar.add(redoAction); projectBar.addSeparator(); projectBar.add(exportDDLAction); projectBar.addSeparator(); projectBar.add(compareDMAction); projectBar.addSeparator(); projectBar.add(autoLayoutAction); projectBar.setToolTipText("Project Toolbar"); projectBar.setName("Project Toolbar"); JButton tempButton = null; // shared actions need to report where they are coming from ppBar.setToolTipText("PlayPen Toolbar"); ppBar.setName("PlayPen ToolBar"); ppBar.add(zoomInAction); ppBar.add(zoomOutAction); ppBar.add(zoomNormalAction); ppBar.addSeparator(); tempButton = ppBar.add(deleteSelectedAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(createTableAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(insertColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); tempButton = ppBar.add(editColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); ppBar.add(createNonIdentifyingRelationshipAction); ppBar.add(createIdentifyingRelationshipAction); tempButton = ppBar.add(editRelationshipAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); Container projectBarPane = getContentPane(); projectBarPane.setLayout(new BorderLayout()); projectBarPane.add(projectBar, BorderLayout.NORTH); JPanel cp = new JPanel(new BorderLayout()); cp.add(ppBar, BorderLayout.EAST); projectBarPane.add(cp, BorderLayout.CENTER); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); cp.add(splitPane, BorderLayout.CENTER); logger.debug("Added splitpane to content pane"); splitPane.setDividerLocation (sprefs.getInt(SwingUserSettings.DIVIDER_LOCATION, 150)); //dbTree.getPreferredSize().width)); Rectangle bounds = new Rectangle(); bounds.x = sprefs.getInt(SwingUserSettings.MAIN_FRAME_X, 40); bounds.y = sprefs.getInt(SwingUserSettings.MAIN_FRAME_Y, 40); bounds.width = sprefs.getInt(SwingUserSettings.MAIN_FRAME_WIDTH, 600); bounds.height = sprefs.getInt(SwingUserSettings.MAIN_FRAME_HEIGHT, 440); setBounds(bounds); addWindowListener(afWindowListener = new ArchitectFrameWindowListener()); setProject(new SwingUIProject("New Project")); }
protected void init() throws ArchitectException { int accelMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); UserSettings us; // must be done right away, because a static // initializer in this class effects BeanUtils // behaviour which the XML Digester relies // upon heavily //TypeMap.getInstance(); contentPane = (JComponent)getContentPane(); try { ConfigFile cf = ConfigFile.getDefaultInstance(); us = cf.read(); architectSession.setUserSettings(us); sprefs = architectSession.getUserSettings().getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } while (us.getPlDotIni() == null) { String message; String[] options = new String[] {"Browse", "Create"}; if (us.getPlDotIniPath() == null) { message = "location is not set"; } else if (new File(us.getPlDotIniPath()).isFile()) { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n could not be read"; } else { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n does not exist"; } int choice = JOptionPane.showOptionDialog(null, "The Architect keeps its list of database connections" + "\nin a file called PL.INI. Your PL.INI "+message+"." + "\n\nYou can browse for an existing PL.INI file on your system" + "\nor allow the Architect to create a new one in your home directory." + "\n\nHint: If you are a Power*Loader Suite user, you should browse for" + "\nan existing PL.INI in your Power*Loader installation directory.", "Missing PL.INI", 0, JOptionPane.INFORMATION_MESSAGE, null, options, null); File newPlIniFile; if (choice == 0) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(ASUtils.INI_FILE_FILTER); fc.setDialogTitle("Locate your PL.INI file"); int fcChoice = fc.showOpenDialog(null); if (fcChoice == JFileChooser.APPROVE_OPTION) { newPlIniFile = fc.getSelectedFile(); } else { newPlIniFile = null; } } else { newPlIniFile = new File(System.getProperty("user.home"), "pl.ini"); } if (newPlIniFile != null) try { newPlIniFile.createNewFile(); us.setPlDotIniPath(newPlIniFile.getPath()); } catch (IOException e1) { logger.error("Caught IO exception while creating empty PL.INI at \"" +newPlIniFile.getPath()+"\"", e1); JOptionPane.showMessageDialog(null, "Failed to create file \""+newPlIniFile.getPath()+"\":\n"+e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } // Create actions aboutAction = new AboutAction(); newProjectAction = new AbstractAction("New Project", ASUtils.createJLFIcon("general/New","New Project",sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } } }; newProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "New"); newProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, accelMask)); openProjectAction = new OpenProjectAction(); saveProjectAction = new AbstractAction("Save Project", ASUtils.createJLFIcon("general/Save", "Save Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); } }; saveProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save"); saveProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, accelMask)); saveProjectAsAction = new AbstractAction("Save Project As...", ASUtils.createJLFIcon("general/SaveAs", "Save Project As...", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); } }; saveProjectAsAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save As"); prefAction = new PreferencesAction(); projectSettingsAction = new ProjectSettingsAction(); projectSettingsAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, accelMask)); printAction = new PrintAction(); printAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, accelMask)); zoomInAction = new ZoomAction(ZOOM_STEP); zoomOutAction = new ZoomAction(ZOOM_STEP * -1.0); zoomNormalAction = new AbstractAction("Reset Zoom", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); } }; zoomNormalAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Reset Zoom"); undoAction = new UndoAction(); redoAction = new RedoAction(); autoLayoutAction = new AutoLayoutAction(); autoLayout = new FruchtermanReingoldForceLayout(); autoLayoutAction.setLayout(autoLayout); exportDDLAction = new ExportDDLAction(); compareDMAction = new CompareDMAction(); exportPLTransAction = new ExportPLTransAction(); quickStartAction = new QuickStartAction(); deleteSelectedAction = new DeleteSelectedAction(); createIdentifyingRelationshipAction = new CreateRelationshipAction(true); createNonIdentifyingRelationshipAction = new CreateRelationshipAction(false); editRelationshipAction = new EditRelationshipAction(); createTableAction = new CreateTableAction(); editColumnAction = new EditColumnAction(); insertColumnAction = new InsertColumnAction(); editTableAction = new EditTableAction(); searchReplaceAction = new SearchReplaceAction(); searchReplaceAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, accelMask)); selectAllAction = new SelectAllAction(); selectAllAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, accelMask)); menuBar = new JMenuBar(); //Settingup JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); fileMenu.add(newProjectAction); fileMenu.add(openProjectAction); fileMenu.add(saveProjectAction); fileMenu.add(saveProjectAsAction); fileMenu.add(printAction); fileMenu.add(prefAction); fileMenu.add(projectSettingsAction); fileMenu.add(saveSettingsAction); fileMenu.add(exitAction); menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic('e'); editMenu.add(undoAction); editMenu.add(redoAction); editMenu.addSeparator(); editMenu.add(selectAllAction); editMenu.addSeparator(); editMenu.add(searchReplaceAction); menuBar.add(editMenu); // the connections menu is set up when a new project is created (because it depends on the current DBTree) connectionsMenu = new JMenu("Connections"); connectionsMenu.setMnemonic('c'); menuBar.add(connectionsMenu); JMenu etlMenu = new JMenu("ETL"); etlMenu.setMnemonic('l'); JMenu etlSubmenuOne = new JMenu("Power*Loader"); etlSubmenuOne.add(exportPLTransAction); etlSubmenuOne.add(new JMenuItem("PL Transaction File Export")); etlSubmenuOne.add(new JMenuItem("Run Power*Loader")); etlSubmenuOne.add(quickStartAction); etlMenu.add(etlSubmenuOne); menuBar.add(etlMenu); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('t'); toolsMenu.add(exportDDLAction); toolsMenu.add(compareDMAction); menuBar.add(toolsMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('h'); helpMenu.add(aboutAction); menuBar.add(helpMenu); setJMenuBar(menuBar); projectBar = new JToolBar(JToolBar.HORIZONTAL); ppBar = new JToolBar(JToolBar.VERTICAL); projectBar.add(newProjectAction); projectBar.add(openProjectAction); projectBar.add(saveProjectAction); projectBar.addSeparator(); projectBar.add(printAction); projectBar.addSeparator(); projectBar.add(undoAction); projectBar.add(redoAction); projectBar.addSeparator(); projectBar.add(exportDDLAction); projectBar.addSeparator(); projectBar.add(compareDMAction); projectBar.addSeparator(); projectBar.add(autoLayoutAction); projectBar.setToolTipText("Project Toolbar"); projectBar.setName("Project Toolbar"); JButton tempButton = null; // shared actions need to report where they are coming from ppBar.setToolTipText("PlayPen Toolbar"); ppBar.setName("PlayPen ToolBar"); ppBar.add(zoomInAction); ppBar.add(zoomOutAction); ppBar.add(zoomNormalAction); ppBar.addSeparator(); tempButton = ppBar.add(deleteSelectedAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(createTableAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(insertColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); tempButton = ppBar.add(editColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); ppBar.add(createNonIdentifyingRelationshipAction); ppBar.add(createIdentifyingRelationshipAction); tempButton = ppBar.add(editRelationshipAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); Container projectBarPane = getContentPane(); projectBarPane.setLayout(new BorderLayout()); projectBarPane.add(projectBar, BorderLayout.NORTH); JPanel cp = new JPanel(new BorderLayout()); cp.add(ppBar, BorderLayout.EAST); projectBarPane.add(cp, BorderLayout.CENTER); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); cp.add(splitPane, BorderLayout.CENTER); logger.debug("Added splitpane to content pane"); splitPane.setDividerLocation (sprefs.getInt(SwingUserSettings.DIVIDER_LOCATION, 150)); //dbTree.getPreferredSize().width)); Rectangle bounds = new Rectangle(); bounds.x = sprefs.getInt(SwingUserSettings.MAIN_FRAME_X, 40); bounds.y = sprefs.getInt(SwingUserSettings.MAIN_FRAME_Y, 40); bounds.width = sprefs.getInt(SwingUserSettings.MAIN_FRAME_WIDTH, 600); bounds.height = sprefs.getInt(SwingUserSettings.MAIN_FRAME_HEIGHT, 440); setBounds(bounds); addWindowListener(afWindowListener = new ArchitectFrameWindowListener()); setProject(new SwingUIProject("New Project")); }
1,111,681
public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); }
public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); }
1,111,682
public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); }
public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); }
1,111,683
public void saveSettings() throws ArchitectException { if (configFile == null) configFile = ConfigFile.getDefaultInstance(); sprefs.setInt(SwingUserSettings.DIVIDER_LOCATION, splitPane.getDividerLocation()); sprefs.setInt(SwingUserSettings.MAIN_FRAME_X, getLocation().x); sprefs.setInt(SwingUserSettings.MAIN_FRAME_Y, getLocation().y); sprefs.setInt(SwingUserSettings.MAIN_FRAME_WIDTH, getWidth()); sprefs.setInt(SwingUserSettings.MAIN_FRAME_HEIGHT, getHeight()); configFile.write(getArchitectSession()); UserSettings us = getUserSettings(); try { us.getPlDotIni().write(new File(us.getPlDotIniPath())); } catch (IOException e) { logger.error("Couldn't save PL.INI file!", e); } }
public void saveSettings() throws ArchitectException { if (configFile == null) configFile = ConfigFile.getDefaultInstance(); sprefs.setInt(SwingUserSettings.DIVIDER_LOCATION, splitPane.getDividerLocation()); sprefs.setInt(SwingUserSettings.MAIN_FRAME_X, getLocation().x); sprefs.setInt(SwingUserSettings.MAIN_FRAME_Y, getLocation().y); sprefs.setInt(SwingUserSettings.MAIN_FRAME_WIDTH, getWidth()); sprefs.setInt(SwingUserSettings.MAIN_FRAME_HEIGHT, getHeight()); configFile.write(getArchitectSession()); UserSettings us = getUserSettings(); try { us.getPlDotIni().write(new File(us.getPlDotIniPath())); } catch (IOException e) { logger.error("Couldn't save PL.INI file!", e); } }
1,111,684
private void processFile(String fileName,int fileType,String infoFileName){ System.out.println(TITLE_STRING); try { int outputType; long maxDistance; HaploData textData; File OutputFile; File inputFile; inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } maxDistance = this.arg_distance * 1000; outputType = this.arg_output; textData = new HaploData(0); Vector result = null; if(fileType == 0){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == 1) { //read in ped file /* if(this.arg_ignoreMarkers.size()>0) { for(int i=0;i<this.arg_ignoreMarkers.size();i++){ int index = Integer.parseInt((String)this.arg_ignoreMarkers.get(i)); if(index>0 && index<markerResultArray.length){ markerResultArray[index] = false; if(!this.arg_quiet) { System.out.println("Ignoring marker " + (index)); } } } }*/ result = textData.linkageToChrom(inputFile, 3, arg_skipCheck); }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,4,arg_skipCheck); } File infoFile; if(infoFileName.equals("")) { infoFile = null; }else{ infoFile = new File(infoFileName); } textData.prepareMarkerInput(infoFile,maxDistance,textData.getPedFile().getHMInfo()); if(!arg_quiet && infoFile != null){ System.out.println("Using marker file " + infoFile.getName()); } textData.infoKnown = true; if(this.arg_showCheck && result != null) { System.out.println("Data check results:\n" + "Name\tObsHET\tPredHET\tHWpval\t%Geno\tFamTrio\tMendErr"); for(int i=0;i<result.size();i++){ MarkerResult currentResult = (MarkerResult)result.get(i); System.out.println( Chromosome.getMarker(i).getName() +"\t"+ currentResult.getObsHet() +"\t"+ currentResult.getPredHet() +"\t"+ currentResult.getHWpvalue() +"\t"+ currentResult.getGenoPercent() +"\t"+ currentResult.getFamTrioNum() +"\t"+ currentResult.getMendErrNum()); } } if(this.arg_check && result != null){ OutputFile = new File (fileName + ".CHECK"); FileWriter saveCheckWriter = new FileWriter(OutputFile); saveCheckWriter.write("Name\tObsHET\tPredHET\tHWpval\t%Geno\tFamTrio\tMendErr\n"); for(int i=0;i<result.size();i++){ MarkerResult currentResult = (MarkerResult)result.get(i); saveCheckWriter.write( Chromosome.getMarker(i).getName() +"\t"+ currentResult.getObsHet() +"\t"+ currentResult.getPredHet() +"\t"+ currentResult.getHWpvalue() +"\t"+ currentResult.getGenoPercent() +"\t"+ currentResult.getFamTrioNum() +"\t"+ currentResult.getMendErrNum() +"\n"); } saveCheckWriter.close(); } Vector cust = new Vector(); if(outputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; switch(outputType){ case BLOX_GABRIEL: OutputFile = new File(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = new File(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = new File(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = new File(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(arg_blockfile); cust = textData.readBlocks(blocksFile); break; default: OutputFile = new File(fileName + ".GABRIELblocks"); break; } //this handles output type ALL int start = 0; int stop = Chromosome.getFilteredSize(); if(outputType == BLOX_ALL) { OutputFile = new File(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); OutputFile = new File(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); OutputFile = new File(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); }else{ textData.guessBlocks(outputType, cust); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); } } if(this.arg_dprime) { OutputFile = new File(fileName + ".DPRIME"); if (textData.filteredDPrimeTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getFilteredSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getFilteredSize()); } } //if(fileType){ //TDT.calcTrioTDT(textData.chromosomes); //TODO: Deal with this. why do we calc TDT? and make sure not to do it except when appropriate //} } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } }
private void processFile(String fileName,int fileType,String infoFileName){ System.out.println(TITLE_STRING); try { int outputType; long maxDistance; HaploData textData; File OutputFile; File inputFile; inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } maxDistance = this.arg_distance * 1000; outputType = this.arg_output; textData = new HaploData(0); Vector result = null; if(fileType == 0){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == 1) { //read in ped file /* if(this.arg_ignoreMarkers.size()>0) { for(int i=0;i<this.arg_ignoreMarkers.size();i++){ int index = Integer.parseInt((String)this.arg_ignoreMarkers.get(i)); if(index>0 && index<markerResultArray.length){ markerResultArray[index] = false; if(!this.arg_quiet) { System.out.println("Ignoring marker " + (index)); } } } }*/ result = textData.linkageToChrom(inputFile, 3, arg_skipCheck); }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,4,arg_skipCheck); } File infoFile; if(infoFileName.equals("")) { infoFile = null; }else{ infoFile = new File(infoFileName); } textData.prepareMarkerInput(infoFile,maxDistance,textData.getPedFile().getHMInfo()); if(!arg_quiet && infoFile != null){ System.out.println("Using marker file " + infoFile.getName()); } textData.infoKnown = true; if(this.arg_showCheck && result != null) { System.out.println("Data check results:\n" + "Name\tObsHET\tPredHET\tHWpval\t%Geno\tFamTrio\tMendErr"); for(int i=0;i<result.size();i++){ MarkerResult currentResult = (MarkerResult)result.get(i); System.out.println( Chromosome.getMarker(i).getName() +"\t"+ currentResult.getObsHet() +"\t"+ currentResult.getPredHet() +"\t"+ currentResult.getHWpvalue() +"\t"+ currentResult.getGenoPercent() +"\t"+ currentResult.getFamTrioNum() +"\t"+ currentResult.getMendErrNum()); } } if(this.arg_check && result != null){ OutputFile = new File (fileName + ".CHECK"); FileWriter saveCheckWriter = new FileWriter(OutputFile); saveCheckWriter.write("Name\tObsHET\tPredHET\tHWpval\t%Geno\tFamTrio\tMendErr\n"); for(int i=0;i<result.size();i++){ MarkerResult currentResult = (MarkerResult)result.get(i); saveCheckWriter.write( Chromosome.getMarker(i).getName() +"\t"+ currentResult.getObsHet() +"\t"+ currentResult.getPredHet() +"\t"+ currentResult.getHWpvalue() +"\t"+ currentResult.getGenoPercent() +"\t"+ currentResult.getFamTrioNum() +"\t"+ currentResult.getMendErrNum() +"\n"); } saveCheckWriter.close(); } Vector cust = new Vector(); if(outputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; switch(outputType){ case BLOX_GABRIEL: OutputFile = new File(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = new File(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = new File(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = new File(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(arg_blockfile); cust = textData.readBlocks(blocksFile); break; default: OutputFile = new File(fileName + ".GABRIELblocks"); break; } //this handles output type ALL int start = 0; int stop = Chromosome.getFilteredSize(); if(outputType == BLOX_ALL) { OutputFile = new File(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); OutputFile = new File(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); OutputFile = new File(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); }else{ textData.guessBlocks(outputType, cust); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); } } if(this.arg_dprime) { OutputFile = new File(fileName + ".DPRIME"); if (textData.filteredDPrimeTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getFilteredSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getFilteredSize()); } } //if(fileType){ //TDT.calcTrioTDT(textData.chromosomes); //TODO: Deal with this. why do we calc TDT? and make sure not to do it except when appropriate //} } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } }
1,111,685
private void processFile(String fileName,int fileType,String infoFileName){ System.out.println(TITLE_STRING); try { int outputType; long maxDistance; HaploData textData; File OutputFile; File inputFile; inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } maxDistance = this.arg_distance * 1000; outputType = this.arg_output; textData = new HaploData(0); Vector result = null; if(fileType == 0){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == 1) { //read in ped file /* if(this.arg_ignoreMarkers.size()>0) { for(int i=0;i<this.arg_ignoreMarkers.size();i++){ int index = Integer.parseInt((String)this.arg_ignoreMarkers.get(i)); if(index>0 && index<markerResultArray.length){ markerResultArray[index] = false; if(!this.arg_quiet) { System.out.println("Ignoring marker " + (index)); } } } }*/ result = textData.linkageToChrom(inputFile, 3, arg_skipCheck); }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,4,arg_skipCheck); } File infoFile; if(infoFileName.equals("")) { infoFile = null; }else{ infoFile = new File(infoFileName); } textData.prepareMarkerInput(infoFile,maxDistance,textData.getPedFile().getHMInfo()); if(!arg_quiet && infoFile != null){ System.out.println("Using marker file " + infoFile.getName()); } textData.infoKnown = true; if(this.arg_showCheck && result != null) { System.out.println("Data check results:\n" + "Name\tObsHET\tPredHET\tHWpval\t%Geno\tFamTrio\tMendErr"); for(int i=0;i<result.size();i++){ MarkerResult currentResult = (MarkerResult)result.get(i); System.out.println( Chromosome.getMarker(i).getName() +"\t"+ currentResult.getObsHet() +"\t"+ currentResult.getPredHet() +"\t"+ currentResult.getHWpvalue() +"\t"+ currentResult.getGenoPercent() +"\t"+ currentResult.getFamTrioNum() +"\t"+ currentResult.getMendErrNum()); } } if(this.arg_check && result != null){ OutputFile = new File (fileName + ".CHECK"); FileWriter saveCheckWriter = new FileWriter(OutputFile); saveCheckWriter.write("Name\tObsHET\tPredHET\tHWpval\t%Geno\tFamTrio\tMendErr\n"); for(int i=0;i<result.size();i++){ MarkerResult currentResult = (MarkerResult)result.get(i); saveCheckWriter.write( Chromosome.getMarker(i).getName() +"\t"+ currentResult.getObsHet() +"\t"+ currentResult.getPredHet() +"\t"+ currentResult.getHWpvalue() +"\t"+ currentResult.getGenoPercent() +"\t"+ currentResult.getFamTrioNum() +"\t"+ currentResult.getMendErrNum() +"\n"); } saveCheckWriter.close(); } Vector cust = new Vector(); if(outputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; switch(outputType){ case BLOX_GABRIEL: OutputFile = new File(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = new File(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = new File(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = new File(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(arg_blockfile); cust = textData.readBlocks(blocksFile); break; default: OutputFile = new File(fileName + ".GABRIELblocks"); break; } //this handles output type ALL int start = 0; int stop = Chromosome.getFilteredSize(); if(outputType == BLOX_ALL) { OutputFile = new File(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); OutputFile = new File(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); OutputFile = new File(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); }else{ textData.guessBlocks(outputType, cust); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); } } if(this.arg_dprime) { OutputFile = new File(fileName + ".DPRIME"); if (textData.filteredDPrimeTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getFilteredSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getFilteredSize()); } } //if(fileType){ //TDT.calcTrioTDT(textData.chromosomes); //TODO: Deal with this. why do we calc TDT? and make sure not to do it except when appropriate //} } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } }
private void processFile(String fileName,int fileType,String infoFileName){ System.out.println(TITLE_STRING); try { int outputType; long maxDistance; HaploData textData; File OutputFile; File inputFile; inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } maxDistance = this.arg_distance * 1000; outputType = this.arg_output; textData = new HaploData(0); Vector result = null; if(fileType == 0){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == 1) { //read in ped file /* if(this.arg_ignoreMarkers.size()>0) { for(int i=0;i<this.arg_ignoreMarkers.size();i++){ int index = Integer.parseInt((String)this.arg_ignoreMarkers.get(i)); if(index>0 && index<markerResultArray.length){ markerResultArray[index] = false; if(!this.arg_quiet) { System.out.println("Ignoring marker " + (index)); } } } }*/ result = textData.linkageToChrom(inputFile, 3, arg_skipCheck); }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,4,arg_skipCheck); } File infoFile; if(infoFileName.equals("")) { infoFile = null; }else{ infoFile = new File(infoFileName); } textData.prepareMarkerInput(infoFile,maxDistance,textData.getPedFile().getHMInfo()); if(!arg_quiet && infoFile != null){ System.out.println("Using marker file " + infoFile.getName()); } textData.infoKnown = true; if(this.arg_showCheck && result != null) { System.out.println("Data check results:\n" + "Name\tObsHET\tPredHET\tHWpval\t%Geno\tFamTrio\tMendErr"); for(int i=0;i<result.size();i++){ MarkerResult currentResult = (MarkerResult)result.get(i); System.out.println( Chromosome.getMarker(i).getName() +"\t"+ currentResult.getObsHet() +"\t"+ currentResult.getPredHet() +"\t"+ currentResult.getHWpvalue() +"\t"+ currentResult.getGenoPercent() +"\t"+ currentResult.getFamTrioNum() +"\t"+ currentResult.getMendErrNum()); } } if(this.arg_check && result != null){ OutputFile = new File (fileName + ".CHECK"); FileWriter saveCheckWriter = new FileWriter(OutputFile); saveCheckWriter.write("Name\tObsHET\tPredHET\tHWpval\t%Geno\tFamTrio\tMendErr\n"); for(int i=0;i<result.size();i++){ MarkerResult currentResult = (MarkerResult)result.get(i); saveCheckWriter.write( Chromosome.getMarker(i).getName() +"\t"+ currentResult.getObsHet() +"\t"+ currentResult.getPredHet() +"\t"+ currentResult.getHWpvalue() +"\t"+ currentResult.getGenoPercent() +"\t"+ currentResult.getFamTrioNum() +"\t"+ currentResult.getMendErrNum() +"\n"); } saveCheckWriter.close(); } Vector cust = new Vector(); if(outputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; switch(outputType){ case BLOX_GABRIEL: OutputFile = new File(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = new File(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = new File(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = new File(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(arg_blockfile); cust = textData.readBlocks(blocksFile); break; default: OutputFile = new File(fileName + ".GABRIELblocks"); break; } //this handles output type ALL int start = 0; int stop = Chromosome.getFilteredSize(); if(outputType == BLOX_ALL) { OutputFile = new File(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); OutputFile = new File(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); OutputFile = new File(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); }else{ textData.guessBlocks(outputType, cust); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); } } if(this.arg_dprime) { OutputFile = new File(fileName + ".DPRIME"); if (textData.filteredDPrimeTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getFilteredSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getFilteredSize()); } } //if(fileType){ //TDT.calcTrioTDT(textData.chromosomes); //TODO: Deal with this. why do we calc TDT? and make sure not to do it except when appropriate //} } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } }
1,111,686
public static Database getODMGDatabase() { if ( db == null ) { db = odmg.newDatabase(); try { db.open( "repository.xml", Database.OPEN_READ_WRITE ); } catch ( ODMGException e ) {// log.warn( "Could not open database: " + e.getMessage() ); db = null; } } return db; }
public static Database getODMGDatabase() { if ( db == null ) { db = odmg.newDatabase(); try { db.open( "pv_test#" + user + "#" + passwd, Database.OPEN_READ_WRITE ); } catch ( ODMGException e ) {// log.warn( "Could not open database: " + e.getMessage() ); db = null; } } return db; }
1,111,687
public void setUp() { try { photo = PhotoInfo.retrievePhotoInfo( 1 ); } catch ( Exception e ) { fail( "Unable to retrieve PhotoInfo object" ); } String volumeRoot = "c:\\temp\\photoVaultImageInstanceTest"; volume = new Volume( "imageInstanceTest", volumeRoot ); }
public void setUp() { try { photo = PhotoInfo.retrievePhotoInfo( 1 ); } catch ( Exception e ) { fail( "Unable to retrieve PhotoInfo object" ); } volume = new Volume( "imageInstanceTest", volumeRoot ); }
1,111,689
public void testImageInstanceCreate() { File testFile = new File( "c:\\java\\photovault\\testfiles\\test1.jpg" ); File instanceFile = volume.getFilingFname( testFile ); try { FileUtils.copyFile( testFile, instanceFile ); } catch ( IOException e ) { fail( e.getMessage() ); } ImageInstance f = ImageInstance.create( volume, instanceFile, photo ); assertNotNull( "Image instance is null", f ); assertMatchesDb( f ); f.delete(); }
public void testImageInstanceCreate() { File testFile = new File( testImgDir, "test1.jpg" ); File instanceFile = volume.getFilingFname( testFile ); try { FileUtils.copyFile( testFile, instanceFile ); } catch ( IOException e ) { fail( e.getMessage() ); } ImageInstance f = ImageInstance.create( volume, instanceFile, photo ); assertNotNull( "Image instance is null", f ); assertMatchesDb( f ); f.delete(); }
1,111,690
public void testImageInstanceDelete() { File testFile = new File( "c:\\java\\photovault\\testfiles\\test1.jpg" ); File instanceFile = volume.getFilingFname( testFile ); try { FileUtils.copyFile( testFile, instanceFile ); } catch ( IOException e ) { fail( e.getMessage() ); } ImageInstance f = ImageInstance.create( volume, instanceFile, photo ); assertNotNull( f ); f.delete(); Connection conn = ImageDb.getConnection(); try { Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery( "SELECT * FROM image_files WHERE dirname = \"c:\\java\\photovault\\testfiles\" AND fname = \"test1.jpg\"" ); if ( rs.next() ) { fail( "Found matching DB record after delete" ); } } catch ( SQLException e ) { fail( "DB error:; " + e.getMessage() ); } }
public void testImageInstanceDelete() { File testFile = new File( testImgDir, "test1.jpg" ); File instanceFile = volume.getFilingFname( testFile ); try { FileUtils.copyFile( testFile, instanceFile ); } catch ( IOException e ) { fail( e.getMessage() ); } ImageInstance f = ImageInstance.create( volume, instanceFile, photo ); assertNotNull( f ); f.delete(); Connection conn = ImageDb.getConnection(); try { Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery( "SELECT * FROM image_files WHERE dirname = \"c:\\java\\photovault\\testfiles\" AND fname = \"test1.jpg\"" ); if ( rs.next() ) { fail( "Found matching DB record after delete" ); } } catch ( SQLException e ) { fail( "DB error:; " + e.getMessage() ); } }
1,111,691
public void testImageInstanceDelete() { File testFile = new File( "c:\\java\\photovault\\testfiles\\test1.jpg" ); File instanceFile = volume.getFilingFname( testFile ); try { FileUtils.copyFile( testFile, instanceFile ); } catch ( IOException e ) { fail( e.getMessage() ); } ImageInstance f = ImageInstance.create( volume, instanceFile, photo ); assertNotNull( f ); f.delete(); Connection conn = ImageDb.getConnection(); try { Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery( "SELECT * FROM image_files WHERE dirname = \"c:\\java\\photovault\\testfiles\" AND fname = \"test1.jpg\"" ); if ( rs.next() ) { fail( "Found matching DB record after delete" ); } } catch ( SQLException e ) { fail( "DB error:; " + e.getMessage() ); } }
public void testImageInstanceDelete() { File testFile = new File( "c:\\java\\photovault\\testfiles\\test1.jpg" ); File instanceFile = volume.getFilingFname( testFile ); try { FileUtils.copyFile( testFile, instanceFile ); } catch ( IOException e ) { fail( e.getMessage() ); } ImageInstance f = ImageInstance.create( volume, instanceFile, photo ); assertNotNull( f ); f.delete(); Connection conn = ImageDb.getConnection(); try { Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery( "SELECT * FROM image_instances WHERE dirname = \"" + testImgDir + "\" AND fname = \"test1.jpg\"" ); if ( rs.next() ) { fail( "Found matching DB record after delete" ); } } catch ( SQLException e ) { fail( "DB error:; " + e.getMessage() ); } }
1,111,692
public void testImageInstanceUpdate() { File testFile = new File( "c:\\java\\photovault\\testfiles\\test1.jpg" ); File instanceFile = volume.getFilingFname( testFile ); try { FileUtils.copyFile( testFile, instanceFile ); } catch ( IOException e ) { fail( e.getMessage() ); } ImageInstance f = ImageInstance.create( volume, instanceFile, photo ); assertNotNull( "Image instance is null", f ); int width = f.getWidth(); int height = f.getHeight(); int hist = f.getInstanceType(); f.setHeight( height + 1 ); f.setWidth( width + 1 ); f.setInstanceType( ImageInstance.INSTANCE_TYPE_THUMBNAIL ); File imgFile = f.getImageFile(); assertMatchesDb( f ); // Reload the object from database and check that the modifications are OK try { f = ImageInstance.retrieve( volume, imgFile.getName() ); } catch ( PhotoNotFoundException e ) { fail( "Image file not found after update" ); } assertNotNull( "Image instance is null", f ); assertEquals( "Width not updated", f.getWidth(), width+1 ); assertEquals( "height not updated", f.getHeight(), height+1 ); assertEquals( "Instance type not updated", f.getInstanceType(), ImageInstance.INSTANCE_TYPE_THUMBNAIL ); File imgFile2 = f.getImageFile(); assertTrue( "Image file does not exist", imgFile2.exists() ); assertTrue( "Image file name not same after update", imgFile.equals( imgFile2 ) ); // Tidy up after execution f.delete(); }
public void testImageInstanceUpdate() { File testFile = new File( testImgDir, "test1.jpg" ); File instanceFile = volume.getFilingFname( testFile ); try { FileUtils.copyFile( testFile, instanceFile ); } catch ( IOException e ) { fail( e.getMessage() ); } ImageInstance f = ImageInstance.create( volume, instanceFile, photo ); assertNotNull( "Image instance is null", f ); int width = f.getWidth(); int height = f.getHeight(); int hist = f.getInstanceType(); f.setHeight( height + 1 ); f.setWidth( width + 1 ); f.setInstanceType( ImageInstance.INSTANCE_TYPE_THUMBNAIL ); File imgFile = f.getImageFile(); assertMatchesDb( f ); // Reload the object from database and check that the modifications are OK try { f = ImageInstance.retrieve( volume, imgFile.getName() ); } catch ( PhotoNotFoundException e ) { fail( "Image file not found after update" ); } assertNotNull( "Image instance is null", f ); assertEquals( "Width not updated", f.getWidth(), width+1 ); assertEquals( "height not updated", f.getHeight(), height+1 ); assertEquals( "Instance type not updated", f.getInstanceType(), ImageInstance.INSTANCE_TYPE_THUMBNAIL ); File imgFile2 = f.getImageFile(); assertTrue( "Image file does not exist", imgFile2.exists() ); assertTrue( "Image file name not same after update", imgFile.equals( imgFile2 ) ); // Tidy up after execution f.delete(); }
1,111,693
protected void init() throws ArchitectException { int accelMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); UserSettings us; // must be done right away, because a static // initializer in this class effects BeanUtils // behaviour which the XML Digester relies // upon heavily //TypeMap.getInstance(); contentPane = (JComponent)getContentPane(); try { ConfigFile cf = ConfigFile.getDefaultInstance(); us = cf.read(); architectSession.setUserSettings(us); sprefs = architectSession.getUserSettings().getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } while (us.getPlDotIni() == null) { String message; String[] options = new String[] {"Browse", "Create"}; if (us.getPlDotIniPath() == null) { message = "location is not set"; } else if (new File(us.getPlDotIniPath()).isFile()) { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n could not be read"; } else { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n does not exist"; } int choice = JOptionPane.showOptionDialog(null, "The Architect keeps its list of database connections" + "\nin a file called PL.INI. Your PL.INI "+message+"." + "\n\nYou can browse for an existing PL.INI file on your system" + "\nor allow the Architect to create a new one in your home directory." + "\n\nHint: If you are a Power*Loader Suite user, you should browse for" + "\nan existing PL.INI in your Power*Loader installation directory.", "Missing PL.INI", 0, JOptionPane.INFORMATION_MESSAGE, null, options, null); File newPlIniFile; if (choice == 0) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(ASUtils.INI_FILE_FILTER); fc.setDialogTitle("Locate your PL.INI file"); int fcChoice = fc.showOpenDialog(null); if (fcChoice == JFileChooser.APPROVE_OPTION) { newPlIniFile = fc.getSelectedFile(); } else { newPlIniFile = null; } } else { newPlIniFile = new File(System.getProperty("user.home"), "pl.ini"); } if (newPlIniFile != null) try { newPlIniFile.createNewFile(); us.setPlDotIniPath(newPlIniFile.getPath()); } catch (IOException e1) { logger.error("Caught IO exception while creating empty PL.INI at \"" +newPlIniFile.getPath()+"\"", e1); JOptionPane.showMessageDialog(null, "Failed to create file \""+newPlIniFile.getPath()+"\":\n"+e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } // Create actions aboutAction = new AboutAction(); newProjectAction = new AbstractAction("New Project", ASUtils.createJLFIcon("general/New","New Project",sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); getGlassPane().setVisible(true); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } } }; newProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "New"); newProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, accelMask)); openProjectAction = new OpenProjectAction(); saveProjectAction = new AbstractAction("Save Project", ASUtils.createJLFIcon("general/Save", "Save Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); } }; saveProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save"); saveProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, accelMask)); saveProjectAsAction = new AbstractAction("Save Project As...", ASUtils.createJLFIcon("general/SaveAs", "Save Project As...", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); } }; saveProjectAsAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save As"); prefAction = new PreferencesAction(); projectSettingsAction = new ProjectSettingsAction(); projectSettingsAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, accelMask)); printAction = new PrintAction(); printAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, accelMask)); zoomInAction = new ZoomAction(ZOOM_STEP); zoomOutAction = new ZoomAction(ZOOM_STEP * -1.0); zoomNormalAction = new AbstractAction("Reset Zoom", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); } }; zoomNormalAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Reset Zoom"); undoAction = new UndoAction(); redoAction = new RedoAction(); autoLayoutAction = new AutoLayoutAction(); autoLayout = new FruchtermanReingoldForceLayout(); autoLayoutAction.setLayout(autoLayout); exportDDLAction = new ExportDDLAction(); compareDMAction = new CompareDMAction(); exportPLTransAction = new ExportPLTransAction(); quickStartAction = new QuickStartAction(); deleteSelectedAction = new DeleteSelectedAction(); createIdentifyingRelationshipAction = new CreateRelationshipAction(true); createNonIdentifyingRelationshipAction = new CreateRelationshipAction(false); editRelationshipAction = new EditRelationshipAction(); createTableAction = new CreateTableAction(); editColumnAction = new EditColumnAction(); insertColumnAction = new InsertColumnAction(); editTableAction = new EditTableAction(); searchReplaceAction = new SearchReplaceAction(); searchReplaceAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, accelMask)); menuBar = new JMenuBar(); //Settingup JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); fileMenu.add(new JMenuItem(newProjectAction)); fileMenu.add(new JMenuItem(openProjectAction)); fileMenu.add(new JMenuItem(saveProjectAction)); fileMenu.add(new JMenuItem(saveProjectAsAction)); fileMenu.add(new JMenuItem(printAction)); fileMenu.add(new JMenuItem(prefAction)); fileMenu.add(new JMenuItem(projectSettingsAction)); fileMenu.add(new JMenuItem(saveSettingsAction)); fileMenu.add(new JMenuItem(exitAction)); menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic('e'); editMenu.add(undoAction); editMenu.add(redoAction); editMenu.addSeparator(); editMenu.add(new JMenuItem(searchReplaceAction)); menuBar.add(editMenu); // the connections menu is set up when a new project is created (because it depends on the current DBTree) connectionsMenu = new JMenu("Connections"); connectionsMenu.setMnemonic('c'); menuBar.add(connectionsMenu); JMenu etlMenu = new JMenu("ETL"); etlMenu.setMnemonic('l'); JMenu etlSubmenuOne = new JMenu("Power*Loader"); etlSubmenuOne.add(new JMenuItem(exportPLTransAction)); etlSubmenuOne.add(new JMenuItem("PL Transaction File Export")); etlSubmenuOne.add(new JMenuItem("Run Power*Loader")); etlSubmenuOne.add(new JMenuItem(quickStartAction)); etlMenu.add(etlSubmenuOne); menuBar.add(etlMenu); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('t'); toolsMenu.add(new JMenuItem(exportDDLAction)); toolsMenu.add(new JMenuItem(compareDMAction)); menuBar.add(toolsMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('h'); helpMenu.add(new JMenuItem(aboutAction)); menuBar.add(helpMenu); setJMenuBar(menuBar); projectBar = new JToolBar(JToolBar.HORIZONTAL); ppBar = new JToolBar(JToolBar.VERTICAL); projectBar.add(newProjectAction); projectBar.add(openProjectAction); projectBar.add(saveProjectAction); projectBar.addSeparator(); projectBar.add(printAction); projectBar.addSeparator(); projectBar.add(undoAction); projectBar.add(redoAction); projectBar.addSeparator(); projectBar.add(exportDDLAction); projectBar.addSeparator(); projectBar.add(compareDMAction); projectBar.addSeparator(); projectBar.add(autoLayoutAction); JButton tempButton = null; // shared actions need to report where they are coming from ppBar.add(zoomInAction); ppBar.add(zoomOutAction); ppBar.add(zoomNormalAction); ppBar.addSeparator(); tempButton = ppBar.add(deleteSelectedAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(createTableAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(insertColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); tempButton = ppBar.add(editColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); ppBar.add(createNonIdentifyingRelationshipAction); ppBar.add(createIdentifyingRelationshipAction); tempButton = ppBar.add(editRelationshipAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); Container projectBarPane = getContentPane(); projectBarPane.setLayout(new BorderLayout()); projectBarPane.add(projectBar, BorderLayout.NORTH); JPanel cp = new JPanel(new BorderLayout()); cp.add(ppBar, BorderLayout.EAST); projectBarPane.add(cp, BorderLayout.CENTER); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); cp.add(splitPane, BorderLayout.CENTER); logger.debug("Added splitpane to content pane"); splitPane.setDividerLocation (sprefs.getInt(SwingUserSettings.DIVIDER_LOCATION, 150)); //dbTree.getPreferredSize().width)); Rectangle bounds = new Rectangle(); bounds.x = sprefs.getInt(SwingUserSettings.MAIN_FRAME_X, 40); bounds.y = sprefs.getInt(SwingUserSettings.MAIN_FRAME_Y, 40); bounds.width = sprefs.getInt(SwingUserSettings.MAIN_FRAME_WIDTH, 600); bounds.height = sprefs.getInt(SwingUserSettings.MAIN_FRAME_HEIGHT, 440); setBounds(bounds); addWindowListener(afWindowListener = new ArchitectFrameWindowListener()); setProject(new SwingUIProject("New Project")); }
protected void init() throws ArchitectException { int accelMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); UserSettings us; // must be done right away, because a static // initializer in this class effects BeanUtils // behaviour which the XML Digester relies // upon heavily //TypeMap.getInstance(); contentPane = (JComponent)getContentPane(); try { ConfigFile cf = ConfigFile.getDefaultInstance(); us = cf.read(); architectSession.setUserSettings(us); sprefs = architectSession.getUserSettings().getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } while (us.getPlDotIni() == null) { String message; String[] options = new String[] {"Browse", "Create"}; if (us.getPlDotIniPath() == null) { message = "location is not set"; } else if (new File(us.getPlDotIniPath()).isFile()) { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n could not be read"; } else { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n does not exist"; } int choice = JOptionPane.showOptionDialog(null, "The Architect keeps its list of database connections" + "\nin a file called PL.INI. Your PL.INI "+message+"." + "\n\nYou can browse for an existing PL.INI file on your system" + "\nor allow the Architect to create a new one in your home directory." + "\n\nHint: If you are a Power*Loader Suite user, you should browse for" + "\nan existing PL.INI in your Power*Loader installation directory.", "Missing PL.INI", 0, JOptionPane.INFORMATION_MESSAGE, null, options, null); File newPlIniFile; if (choice == 0) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(ASUtils.INI_FILE_FILTER); fc.setDialogTitle("Locate your PL.INI file"); int fcChoice = fc.showOpenDialog(null); if (fcChoice == JFileChooser.APPROVE_OPTION) { newPlIniFile = fc.getSelectedFile(); } else { newPlIniFile = null; } } else { newPlIniFile = new File(System.getProperty("user.home"), "pl.ini"); } if (newPlIniFile != null) try { newPlIniFile.createNewFile(); us.setPlDotIniPath(newPlIniFile.getPath()); } catch (IOException e1) { logger.error("Caught IO exception while creating empty PL.INI at \"" +newPlIniFile.getPath()+"\"", e1); JOptionPane.showMessageDialog(null, "Failed to create file \""+newPlIniFile.getPath()+"\":\n"+e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } // Create actions aboutAction = new AboutAction(); newProjectAction = new AbstractAction("New Project", ASUtils.createJLFIcon("general/New","New Project",sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); getGlassPane().setVisible(true); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } } }; newProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "New"); newProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, accelMask)); openProjectAction = new OpenProjectAction(); saveProjectAction = new AbstractAction("Save Project", ASUtils.createJLFIcon("general/Save", "Save Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); } }; saveProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save"); saveProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, accelMask)); saveProjectAsAction = new AbstractAction("Save Project As...", ASUtils.createJLFIcon("general/SaveAs", "Save Project As...", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); } }; saveProjectAsAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save As"); prefAction = new PreferencesAction(); projectSettingsAction = new ProjectSettingsAction(); projectSettingsAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, accelMask)); printAction = new PrintAction(); printAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, accelMask)); zoomInAction = new ZoomAction(ZOOM_STEP); zoomOutAction = new ZoomAction(ZOOM_STEP * -1.0); zoomNormalAction = new AbstractAction("Reset Zoom", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); } }; zoomNormalAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Reset Zoom"); undoAction = new UndoAction(); redoAction = new RedoAction(); autoLayoutAction = new AutoLayoutAction(); autoLayout = new FruchtermanReingoldForceLayout(); autoLayoutAction.setLayout(autoLayout); exportDDLAction = new ExportDDLAction(); compareDMAction = new CompareDMAction(); exportPLTransAction = new ExportPLTransAction(); quickStartAction = new QuickStartAction(); deleteSelectedAction = new DeleteSelectedAction(); createIdentifyingRelationshipAction = new CreateRelationshipAction(true); createNonIdentifyingRelationshipAction = new CreateRelationshipAction(false); editRelationshipAction = new EditRelationshipAction(); createTableAction = new CreateTableAction(); editColumnAction = new EditColumnAction(); insertColumnAction = new InsertColumnAction(); editTableAction = new EditTableAction(); searchReplaceAction = new SearchReplaceAction(); searchReplaceAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, accelMask)); menuBar = new JMenuBar(); //Settingup JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); fileMenu.add(new JMenuItem(newProjectAction)); fileMenu.add(new JMenuItem(openProjectAction)); fileMenu.add(new JMenuItem(saveProjectAction)); fileMenu.add(new JMenuItem(saveProjectAsAction)); fileMenu.add(new JMenuItem(printAction)); fileMenu.add(new JMenuItem(prefAction)); fileMenu.add(new JMenuItem(projectSettingsAction)); fileMenu.add(new JMenuItem(saveSettingsAction)); fileMenu.add(new JMenuItem(exitAction)); menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic('e'); editMenu.add(undoAction); editMenu.add(redoAction); editMenu.addSeparator(); editMenu.add(new JMenuItem(searchReplaceAction)); menuBar.add(editMenu); // the connections menu is set up when a new project is created (because it depends on the current DBTree) connectionsMenu = new JMenu("Connections"); connectionsMenu.setMnemonic('c'); menuBar.add(connectionsMenu); JMenu etlMenu = new JMenu("ETL"); etlMenu.setMnemonic('l'); JMenu etlSubmenuOne = new JMenu("Power*Loader"); etlSubmenuOne.add(new JMenuItem(exportPLTransAction)); etlSubmenuOne.add(new JMenuItem("PL Transaction File Export")); etlSubmenuOne.add(new JMenuItem("Run Power*Loader")); etlSubmenuOne.add(new JMenuItem(quickStartAction)); etlMenu.add(etlSubmenuOne); menuBar.add(etlMenu); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('t'); toolsMenu.add(new JMenuItem(exportDDLAction)); toolsMenu.add(new JMenuItem(compareDMAction)); menuBar.add(toolsMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('h'); helpMenu.add(new JMenuItem(aboutAction)); menuBar.add(helpMenu); setJMenuBar(menuBar); projectBar = new JToolBar(JToolBar.HORIZONTAL); ppBar = new JToolBar(JToolBar.VERTICAL); projectBar.add(newProjectAction); projectBar.add(openProjectAction); projectBar.add(saveProjectAction); projectBar.addSeparator(); projectBar.add(printAction); projectBar.addSeparator(); projectBar.add(undoAction); projectBar.add(redoAction); projectBar.addSeparator(); projectBar.add(exportDDLAction); projectBar.addSeparator(); projectBar.add(compareDMAction); projectBar.addSeparator(); projectBar.add(autoLayoutAction); JButton tempButton = null; // shared actions need to report where they are coming from ppBar.add(zoomInAction); ppBar.add(zoomOutAction); ppBar.add(zoomNormalAction); ppBar.addSeparator(); tempButton = ppBar.add(deleteSelectedAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(createTableAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(insertColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); tempButton = ppBar.add(editColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); ppBar.add(createNonIdentifyingRelationshipAction); ppBar.add(createIdentifyingRelationshipAction); tempButton = ppBar.add(editRelationshipAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); Container projectBarPane = getContentPane(); projectBarPane.setLayout(new BorderLayout()); projectBarPane.add(projectBar, BorderLayout.NORTH); JPanel cp = new JPanel(new BorderLayout()); cp.add(ppBar, BorderLayout.EAST); projectBarPane.add(cp, BorderLayout.CENTER); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); cp.add(splitPane, BorderLayout.CENTER); logger.debug("Added splitpane to content pane"); splitPane.setDividerLocation (sprefs.getInt(SwingUserSettings.DIVIDER_LOCATION, 150)); //dbTree.getPreferredSize().width)); Rectangle bounds = new Rectangle(); bounds.x = sprefs.getInt(SwingUserSettings.MAIN_FRAME_X, 40); bounds.y = sprefs.getInt(SwingUserSettings.MAIN_FRAME_Y, 40); bounds.width = sprefs.getInt(SwingUserSettings.MAIN_FRAME_WIDTH, 600); bounds.height = sprefs.getInt(SwingUserSettings.MAIN_FRAME_HEIGHT, 440); setBounds(bounds); addWindowListener(afWindowListener = new ArchitectFrameWindowListener()); setProject(new SwingUIProject("New Project")); }
1,111,694
public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); getGlassPane().setVisible(true); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } }
public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); getGlassPane().setVisible(true); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } }
1,111,695
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals(RAW_DATA)){ load(PED); }else if (command.equals(PHASED_DATA)){ load(HAPS); }else if (command.equals(HAPMAP_DATA)){ load(HMP); }else if (command.equals(BROWSE_GENO)){ browse(GENO); }else if (command.equals(BROWSE_INFO)){ browse(INFO); }else if (command.equals("OK")){ HaploView caller = (HaploView)this.getParent(); if (doTDT.isSelected()){ if (trioButton.isSelected()){ Options.setAssocTest(ASSOC_TRIO); } else { Options.setAssocTest(ASSOC_CC); } }else{ Options.setAssocTest(ASSOC_NONE); } if (maxComparisonDistField.getText().equals("")){ Options.setMaxDistance(0); }else{ Options.setMaxDistance(Integer.parseInt(maxComparisonDistField.getText())); } String[] returnStrings = {genoFileField.getText(), infoFileField.getText()}; if (returnStrings[1].equals("")) returnStrings[1] = null; //if a dataset was previously loaded during this session, discard the display panes for it. if (caller.dPrimeDisplay != null){ caller.dPrimeDisplay.setVisible(false); caller.dPrimeDisplay = null; } if (caller.hapDisplay != null){ caller.hapDisplay.setVisible(false); caller.hapDisplay = null; } caller.readGenotypes(returnStrings, fileType); this.dispose(); }else if (command.equals("Cancel")){ this.dispose(); }else if (command.equals("tdt")){ if(this.doTDT.isSelected()){ trioButton.setEnabled(true); ccButton.setEnabled(true); }else{ trioButton.setEnabled(false); ccButton.setEnabled(false); } } }
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals(RAW_DATA)){ load(PED); }else if (command.equals(PHASED_DATA)){ load(HAPS); }else if (command.equals(HAPMAP_DATA)){ load(HMP); }else if (command.equals(BROWSE_GENO)){ browse(GENO); }else if (command.equals(BROWSE_INFO)){ browse(INFO); }else if (command.equals("OK")){ HaploView caller = (HaploView)this.getParent(); if (doTDT.isSelected()){ if (trioButton.isSelected()){ Options.setAssocTest(ASSOC_TRIO); } else { Options.setAssocTest(ASSOC_CC); } }else{ Options.setAssocTest(ASSOC_NONE); } if (maxComparisonDistField.getText().equals("")){ Options.setMaxDistance(0); }else{ Options.setMaxDistance(Integer.parseInt(maxComparisonDistField.getText())); } String[] returnStrings = {genoFileField.getText(), infoFileField.getText()}; if (returnStrings[1].equals("")) returnStrings[1] = null; //if a dataset was previously loaded during this session, discard the display panes for it. if (caller.dPrimeDisplay != null){ caller.dPrimeDisplay.setVisible(false); caller.dPrimeDisplay = null; } if (caller.hapDisplay != null){ caller.hapDisplay.setVisible(false); caller.hapDisplay = null; } caller.readGenotypes(returnStrings, fileType); this.dispose(); }else if (command.equals("Cancel")){ this.dispose(); }else if (command.equals("tdt")){ if(this.doTDT.isSelected()){ trioButton.setEnabled(true); ccButton.setEnabled(true); }else{ trioButton.setEnabled(false); ccButton.setEnabled(false); } } }
1,111,698
public void componentResized(PlayPenComponentEvent e) { logger.debug("Component "+e.getPPComponent().getName()+" changed size"); if (e.getPPComponent() == pkTable) { setPkConnectionPoint(ui.closestEdgePoint(true, getPkConnectionPoint())); // true == PK } if (e.getPPComponent() == fkTable) { setFkConnectionPoint(ui.closestEdgePoint(false, getFkConnectionPoint())); // false == FK } }
public void componentResized(PlayPenComponentEvent e) { logger.debug("Component "+e.getPPComponent().getName()+" changed size"); if (e.getPPComponent() == pkTable) { setPkConnectionPoint(((RelationshipUI) getUI()).closestEdgePoint(true, getPkConnectionPoint())); // true == PK } if (e.getPPComponent() == fkTable) { setFkConnectionPoint(ui.closestEdgePoint(false, getFkConnectionPoint())); // false == FK } }
1,111,699
public void componentResized(PlayPenComponentEvent e) { logger.debug("Component "+e.getPPComponent().getName()+" changed size"); if (e.getPPComponent() == pkTable) { setPkConnectionPoint(ui.closestEdgePoint(true, getPkConnectionPoint())); // true == PK } if (e.getPPComponent() == fkTable) { setFkConnectionPoint(ui.closestEdgePoint(false, getFkConnectionPoint())); // false == FK } }
public void componentResized(PlayPenComponentEvent e) { logger.debug("Component "+e.getPPComponent().getName()+" changed size"); if (e.getPPComponent() == pkTable) { setPkConnectionPoint(ui.closestEdgePoint(true, getPkConnectionPoint())); // true == PK } if (e.getPPComponent() == fkTable) { setFkConnectionPoint(((RelationshipUI) getUI()).closestEdgePoint(false, getFkConnectionPoint())); // false == FK } }
1,111,700
protected Point translatePoint(Point p) { if (movingPk) { p.x = p.x - r.getPkTable().getX(); p.y = p.y - r.getPkTable().getY(); p = r.ui.closestEdgePoint(movingPk, p); } else { p.x = p.x - r.getFkTable().getX(); p.y = p.y - r.getFkTable().getY(); p = r.ui.closestEdgePoint(movingPk, p); } return p; }
protected Point translatePoint(Point p) { if (movingPk) { p.x = p.x - r.getPkTable().getX(); p.y = p.y - r.getPkTable().getY(); p = ((RelationshipUI) r.getUI()).closestEdgePoint(movingPk, p); } else { p.x = p.x - r.getFkTable().getX(); p.y = p.y - r.getFkTable().getY(); p = ((RelationshipUI) r.getUI()).closestEdgePoint(movingPk, p); } return p; }
1,111,701
public Point getFkConnectionPoint() { return ui.getFkConnectionPoint(); }
public Point getFkConnectionPoint() { return ((RelationshipUI) getUI()).getFkConnectionPoint(); }
1,111,702
public Point getPkConnectionPoint() { return ui.getPkConnectionPoint(); }
public Point getPkConnectionPoint() { return ((RelationshipUI) getUI()).getPkConnectionPoint(); }
1,111,703
public Point getPreferredLocation() { return ui.getPreferredLocation(); }
public Point getPreferredLocation() { return ((RelationshipUI) getUI()).getPreferredLocation(); }
1,111,704
public boolean intersects(Rectangle region) { return ui.intersects(region); }
public boolean intersects(Rectangle region) { return ((RelationshipUI) getUI()).intersects(region); }
1,111,705
public void setFkConnectionPoint(Point p) { ui.setFkConnectionPoint(p); revalidate(); }
public void setFkConnectionPoint(Point p) { ((RelationshipUI) getUI()).setFkConnectionPoint(p); revalidate(); }
1,111,706
public void setPkConnectionPoint(Point p) { ui.setPkConnectionPoint(p); revalidate(); }
public void setPkConnectionPoint(Point p) { ((RelationshipUI) getUI()).setPkConnectionPoint(p); revalidate(); }
1,111,707
public TDTResult() { counts = new int[2][2]; }
public TDTResult(SNP tempSNP) { counts = new int[2][2]; }
1,111,708
public double getChiSq() { if(!this.chiSet){ this.chiSqVal = Math.pow( (this.counts[0][0] - this.counts[0][1]),2) / (this.counts[0][0] + this.counts[0][1]); this.chiSqVal = Math.rint(this.chiSqVal*1000.0)/1000.0; this.chiSet = true; } return this.chiSqVal; }
public double getChiSq(int type) { if(!this.chiSet){ this.chiSqVal = Math.pow( (this.counts[0][0] - this.counts[0][1]),2) / (this.counts[0][0] + this.counts[0][1]); this.chiSqVal = Math.rint(this.chiSqVal*1000.0)/1000.0; this.chiSet = true; } return this.chiSqVal; }
1,111,710
public double getChiSq() { if(!this.chiSet){ this.chiSqVal = Math.pow( (this.counts[0][0] - this.counts[0][1]),2) / (this.counts[0][0] + this.counts[0][1]); this.chiSqVal = Math.rint(this.chiSqVal*1000.0)/1000.0; this.chiSet = true; } return this.chiSqVal; }
public double getChiSq() { if(!this.chiSet){ if (type == 1){ this.chiSqVal = Math.pow( (this.counts[0][0] - this.counts[0][1]),2) / (this.counts[0][0] + this.counts[0][1]); }else{ int N = counts[0][0] + counts[0][1] + counts[1][0] + counts[1][1]; for (int i = 0; i < 2; i++){ for (int j = 0; j < 2; j++){ double nij = ((double)(counts[i][0] + counts[i][1])*(counts[0][j] + counts[1][j]))/N; this.chiSqVal += Math.pow( (this.counts[i][j] - nij), 2) / nij; } } } this.chiSqVal = Math.rint(this.chiSqVal*1000.0)/1000.0; this.chiSet = true; } return this.chiSqVal; }
1,111,711
public double getPValue() { double pval = 0; pval= MathUtil.gammq(.5,.5*getChiSq()); return Math.rint(pval*10000.0)/10000.0; }
public String getPValue() { double pval = 0; pval= MathUtil.gammq(.5,.5*getChiSq()); return Math.rint(pval*10000.0)/10000.0; }
1,111,712
public double getPValue() { double pval = 0; pval= MathUtil.gammq(.5,.5*getChiSq()); return Math.rint(pval*10000.0)/10000.0; }
public double getPValue() { double pval = 0; pval= MathUtil.gammq(.5,.5*getChiSq()); return Math.rint(pval*10000.0)/10000.0; }
1,111,713
public String getTURatio() { return this.counts[0][0] + ":" + this.counts[0][1]; }
public String getTURatio() { return this.counts[0][0] + ":" + this.counts[0][1]; }
1,111,714
protected void runScript(String name) throws Exception { InputStream in = new FileInputStream(name); Script script = parser.parse(in); script = script.compile(); log.info("Evaluating: " + script); script.run(parser.getContext(), output); }
protected void runScript(String name) throws Exception { InputStream in = new FileInputStream(name); Script script = parser.parse(in); script = script.compile(); log.info("Evaluating: " + script); script.run(parser.getContext(), output); }
1,111,715
public void testParse() throws Exception { StringWriter buffer = new StringWriter(); output = XMLOutput.createXMLOutput(buffer); runScript("src/test/org/apache/commons/jelly/define/babelfishTaglib.jelly"); runScript("src/test/org/apache/commons/jelly/define/example.jelly"); log.info("The output was as follows"); log.info(buffer.toString()); }
public void testParse() throws Exception { StringWriter buffer = new StringWriter(); output = XMLOutput.createXMLOutput(buffer); runScript("src/test/org/apache/commons/jelly/define/example.jelly"); log.info("The output was as follows"); log.info(buffer.toString()); }
1,111,716
private static void displayExceptionDialog(Component parent, String message, Throwable throwable) { if (parent == null) { logger.error("displayExceptionDialog with null parent for message " + message); } else if (parent instanceof Frame) { dialog = new JDialog((Frame) parent, "Error Report"); } else if (parent instanceof Dialog) { dialog = new JDialog((Dialog)parent, "Error Report"); } else { logger.error("non-null parent component is neither frame nor dialog"); } logger.debug("displayExceptionDialog: showing exception dialog for:", throwable); dialog.setLocationRelativeTo(parent); ((JComponent)dialog.getContentPane()).setBorder( BorderFactory.createEmptyBorder(10, 10, 5, 5)); // Details information final StringWriter traceWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(traceWriter)); try { traceWriter.close(); } catch (IOException e1) { // who cares!? } JPanel top = new JPanel(new GridLayout(0, 1, 5, 5)); final String LAYOUT_START = "<html><font color='red' size='+1'>"; final String LAYOUT_END = "</font>"; if (message == null) { message = "Unexpected error"; } JLabel messageLabel = new JLabel(LAYOUT_START + message + LAYOUT_END); messageLabel.setIcon(StatusIcon.getFailIcon()); top.add(messageLabel); JLabel errClassLabel = new JLabel("Exception type: " + throwable.getClass().getName()); top.add(errClassLabel); String excDetailMessage = throwable.getMessage(); if (excDetailMessage != null) { top.add(new JLabel("Detail string: " + excDetailMessage)); } dialog.add(top, BorderLayout.NORTH); final JScrollPane detailScroller = new JScrollPane(new JTextArea(traceWriter.toString())); final JPanel messageComponent = new JPanel(new BorderLayout()); messageComponent.add(detailScroller, BorderLayout.CENTER); messageComponent.setPreferredSize(new Dimension(700, 400)); final Dimension SIZE_NODETAILS = new Dimension(350, 200); // XXX This button should be at the right side of the // error text instead of the bottom, so it wouldn't jump // around when you activate it. final JButton detailsButton = new JButton("Show Details"); // N.B. AbstractAction in a JButton does not update the label // automatically when you change the SHORT_DESCRIPTION value. ActionListener detailsAction = new ActionListener() { boolean showDetails = true; public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; } }; detailsButton.addActionListener(detailsAction); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); } }); JPanel bottom = new JPanel(); bottom.add(detailsButton); bottom.add(okButton); dialog.add(bottom, BorderLayout.SOUTH); dialog.setSize(SIZE_NODETAILS); if (parent == null) { UtilGUI.centre(dialog); } dialog.setVisible(true); }
private static void displayExceptionDialog(final Component parent, String message, final Throwable throwable) { JDialog dialog; if (parent == null) { logger.error("displayExceptionDialog with null parent for message " + message); } else if (parent instanceof Frame) { dialog = new JDialog((Frame) parent, "Error Report"); } else if (parent instanceof Dialog) { dialog = new JDialog((Dialog)parent, "Error Report"); } else { logger.error("non-null parent component is neither frame nor dialog"); } logger.debug("displayExceptionDialog: showing exception dialog for:", throwable); dialog.setLocationRelativeTo(parent); ((JComponent)dialog.getContentPane()).setBorder( BorderFactory.createEmptyBorder(10, 10, 5, 5)); // Details information final StringWriter traceWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(traceWriter)); try { traceWriter.close(); } catch (IOException e1) { // who cares!? } JPanel top = new JPanel(new GridLayout(0, 1, 5, 5)); final String LAYOUT_START = "<html><font color='red' size='+1'>"; final String LAYOUT_END = "</font>"; if (message == null) { message = "Unexpected error"; } JLabel messageLabel = new JLabel(LAYOUT_START + message + LAYOUT_END); messageLabel.setIcon(StatusIcon.getFailIcon()); top.add(messageLabel); JLabel errClassLabel = new JLabel("Exception type: " + throwable.getClass().getName()); top.add(errClassLabel); String excDetailMessage = throwable.getMessage(); if (excDetailMessage != null) { top.add(new JLabel("Detail string: " + excDetailMessage)); } dialog.add(top, BorderLayout.NORTH); final JScrollPane detailScroller = new JScrollPane(new JTextArea(traceWriter.toString())); final JPanel messageComponent = new JPanel(new BorderLayout()); messageComponent.add(detailScroller, BorderLayout.CENTER); messageComponent.setPreferredSize(new Dimension(700, 400)); final Dimension SIZE_NODETAILS = new Dimension(350, 200); // XXX This button should be at the right side of the // error text instead of the bottom, so it wouldn't jump // around when you activate it. final JButton detailsButton = new JButton("Show Details"); // N.B. AbstractAction in a JButton does not update the label // automatically when you change the SHORT_DESCRIPTION value. ActionListener detailsAction = new ActionListener() { boolean showDetails = true; public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; } }; detailsButton.addActionListener(detailsAction); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); } }); JPanel bottom = new JPanel(); bottom.add(detailsButton); bottom.add(okButton); dialog.add(bottom, BorderLayout.SOUTH); dialog.setSize(SIZE_NODETAILS); if (parent == null) { UtilGUI.centre(dialog); } dialog.setVisible(true); }
1,111,717
private static void displayExceptionDialog(Component parent, String message, Throwable throwable) { if (parent == null) { logger.error("displayExceptionDialog with null parent for message " + message); } else if (parent instanceof Frame) { dialog = new JDialog((Frame) parent, "Error Report"); } else if (parent instanceof Dialog) { dialog = new JDialog((Dialog)parent, "Error Report"); } else { logger.error("non-null parent component is neither frame nor dialog"); } logger.debug("displayExceptionDialog: showing exception dialog for:", throwable); dialog.setLocationRelativeTo(parent); ((JComponent)dialog.getContentPane()).setBorder( BorderFactory.createEmptyBorder(10, 10, 5, 5)); // Details information final StringWriter traceWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(traceWriter)); try { traceWriter.close(); } catch (IOException e1) { // who cares!? } JPanel top = new JPanel(new GridLayout(0, 1, 5, 5)); final String LAYOUT_START = "<html><font color='red' size='+1'>"; final String LAYOUT_END = "</font>"; if (message == null) { message = "Unexpected error"; } JLabel messageLabel = new JLabel(LAYOUT_START + message + LAYOUT_END); messageLabel.setIcon(StatusIcon.getFailIcon()); top.add(messageLabel); JLabel errClassLabel = new JLabel("Exception type: " + throwable.getClass().getName()); top.add(errClassLabel); String excDetailMessage = throwable.getMessage(); if (excDetailMessage != null) { top.add(new JLabel("Detail string: " + excDetailMessage)); } dialog.add(top, BorderLayout.NORTH); final JScrollPane detailScroller = new JScrollPane(new JTextArea(traceWriter.toString())); final JPanel messageComponent = new JPanel(new BorderLayout()); messageComponent.add(detailScroller, BorderLayout.CENTER); messageComponent.setPreferredSize(new Dimension(700, 400)); final Dimension SIZE_NODETAILS = new Dimension(350, 200); // XXX This button should be at the right side of the // error text instead of the bottom, so it wouldn't jump // around when you activate it. final JButton detailsButton = new JButton("Show Details"); // N.B. AbstractAction in a JButton does not update the label // automatically when you change the SHORT_DESCRIPTION value. ActionListener detailsAction = new ActionListener() { boolean showDetails = true; public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; } }; detailsButton.addActionListener(detailsAction); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); } }); JPanel bottom = new JPanel(); bottom.add(detailsButton); bottom.add(okButton); dialog.add(bottom, BorderLayout.SOUTH); dialog.setSize(SIZE_NODETAILS); if (parent == null) { UtilGUI.centre(dialog); } dialog.setVisible(true); }
private static void displayExceptionDialog(Component parent, String message, Throwable throwable) { if (parent == null) { logger.error("displayExceptionDialog with null parent for message " + message); } else if (parent instanceof Frame) { dialog = new JDialog((Frame) parent, "Error Report"); } else if (parent instanceof Dialog) { dialog = new JDialog((Dialog)parent, "Error Report"); } else { logger.error("non-null parent component is neither frame nor dialog"); } logger.debug("displayExceptionDialog: showing exception dialog for:", throwable); dialog.setLocationRelativeTo(parent); ((JComponent)dialog.getContentPane()).setBorder( BorderFactory.createEmptyBorder(10, 10, 5, 5)); // Details information final StringWriter traceWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(traceWriter)); try { traceWriter.close(); } catch (IOException e1) { // who cares!? } JPanel top = new JPanel(new GridLayout(0, 1, 5, 5)); final String LAYOUT_START = "<html><font color='red' size='+1'>"; final String LAYOUT_END = "</font>"; if (message == null) { message = "Unexpected error"; } JLabel messageLabel = new JLabel(LAYOUT_START + message + LAYOUT_END); messageLabel.setIcon(StatusIcon.getFailIcon()); top.add(messageLabel); JLabel errClassLabel = new JLabel("Exception type: " + throwable.getClass().getName()); top.add(errClassLabel); String excDetailMessage = throwable.getMessage(); if (excDetailMessage != null) { top.add(new JLabel("Detail string: " + excDetailMessage)); } dialog.add(top, BorderLayout.NORTH); final JScrollPane detailScroller = new JScrollPane(new JTextArea(traceWriter.toString())); final JPanel messageComponent = new JPanel(new BorderLayout()); messageComponent.add(detailScroller, BorderLayout.CENTER); messageComponent.setPreferredSize(new Dimension(700, 400)); final Dimension SIZE_NODETAILS = new Dimension(350, 200); // XXX This button should be at the right side of the // error text instead of the bottom, so it wouldn't jump // around when you activate it. final JButton detailsButton = new JButton("Show Details"); // N.B. AbstractAction in a JButton does not update the label // automatically when you change the SHORT_DESCRIPTION value. ActionListener detailsAction = new ActionListener() { boolean showDetails = true; public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; } }; detailsButton.addActionListener(detailsAction); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); } }); JPanel bottom = new JPanel(); bottom.add(detailsButton); bottom.add(okButton); dialog.add(bottom, BorderLayout.SOUTH); dialog.setSize(SIZE_NODETAILS); if (parent == null) { UtilGUI.centre(dialog); } dialog.setVisible(true); }
1,111,718
private static void displayExceptionDialog(Component parent, String message, Throwable throwable) { if (parent == null) { logger.error("displayExceptionDialog with null parent for message " + message); } else if (parent instanceof Frame) { dialog = new JDialog((Frame) parent, "Error Report"); } else if (parent instanceof Dialog) { dialog = new JDialog((Dialog)parent, "Error Report"); } else { logger.error("non-null parent component is neither frame nor dialog"); } logger.debug("displayExceptionDialog: showing exception dialog for:", throwable); dialog.setLocationRelativeTo(parent); ((JComponent)dialog.getContentPane()).setBorder( BorderFactory.createEmptyBorder(10, 10, 5, 5)); // Details information final StringWriter traceWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(traceWriter)); try { traceWriter.close(); } catch (IOException e1) { // who cares!? } JPanel top = new JPanel(new GridLayout(0, 1, 5, 5)); final String LAYOUT_START = "<html><font color='red' size='+1'>"; final String LAYOUT_END = "</font>"; if (message == null) { message = "Unexpected error"; } JLabel messageLabel = new JLabel(LAYOUT_START + message + LAYOUT_END); messageLabel.setIcon(StatusIcon.getFailIcon()); top.add(messageLabel); JLabel errClassLabel = new JLabel("Exception type: " + throwable.getClass().getName()); top.add(errClassLabel); String excDetailMessage = throwable.getMessage(); if (excDetailMessage != null) { top.add(new JLabel("Detail string: " + excDetailMessage)); } dialog.add(top, BorderLayout.NORTH); final JScrollPane detailScroller = new JScrollPane(new JTextArea(traceWriter.toString())); final JPanel messageComponent = new JPanel(new BorderLayout()); messageComponent.add(detailScroller, BorderLayout.CENTER); messageComponent.setPreferredSize(new Dimension(700, 400)); final Dimension SIZE_NODETAILS = new Dimension(350, 200); // XXX This button should be at the right side of the // error text instead of the bottom, so it wouldn't jump // around when you activate it. final JButton detailsButton = new JButton("Show Details"); // N.B. AbstractAction in a JButton does not update the label // automatically when you change the SHORT_DESCRIPTION value. ActionListener detailsAction = new ActionListener() { boolean showDetails = true; public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; } }; detailsButton.addActionListener(detailsAction); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); } }); JPanel bottom = new JPanel(); bottom.add(detailsButton); bottom.add(okButton); dialog.add(bottom, BorderLayout.SOUTH); dialog.setSize(SIZE_NODETAILS); if (parent == null) { UtilGUI.centre(dialog); } dialog.setVisible(true); }
private static void displayExceptionDialog(Component parent, String message, Throwable throwable) { if (parent == null) { logger.error("displayExceptionDialog with null parent for message " + message); } else if (parent instanceof Frame) { dialog = new JDialog((Frame) parent, "Error Report"); } else if (parent instanceof Dialog) { dialog = new JDialog((Dialog)parent, "Error Report"); } else { logger.error("non-null parent component is neither frame nor dialog"); } logger.debug("displayExceptionDialog: showing exception dialog for:", throwable); dialog.setLocationRelativeTo(parent); ((JComponent)dialog.getContentPane()).setBorder( BorderFactory.createEmptyBorder(10, 10, 5, 5)); // Details information final StringWriter traceWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(traceWriter)); try { traceWriter.close(); } catch (IOException e1) { // who cares!? } JPanel top = new JPanel(new GridLayout(0, 1, 5, 5)); final String LAYOUT_START = "<html><font color='red' size='+1'>"; final String LAYOUT_END = "</font>"; if (message == null) { message = "Unexpected error"; } JLabel messageLabel = new JLabel(LAYOUT_START + message + LAYOUT_END); messageLabel.setIcon(StatusIcon.getFailIcon()); top.add(messageLabel); JLabel errClassLabel = new JLabel("Exception type: " + throwable.getClass().getName()); top.add(errClassLabel); String excDetailMessage = throwable.getMessage(); if (excDetailMessage != null) { top.add(new JLabel("Detail string: " + excDetailMessage)); } dialog.add(top, BorderLayout.NORTH); final JScrollPane detailScroller = new JScrollPane(new JTextArea(stringWriter.toString())); final JPanel messageComponent = new JPanel(new BorderLayout()); messageComponent.add(detailScroller, BorderLayout.CENTER); messageComponent.setPreferredSize(new Dimension(700, 400)); final Dimension SIZE_NODETAILS = new Dimension(350, 200); // XXX This button should be at the right side of the // error text instead of the bottom, so it wouldn't jump // around when you activate it. final JButton detailsButton = new JButton("Show Details"); // N.B. AbstractAction in a JButton does not update the label // automatically when you change the SHORT_DESCRIPTION value. ActionListener detailsAction = new ActionListener() { boolean showDetails = true; public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; } }; detailsButton.addActionListener(detailsAction); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); } }); JPanel bottom = new JPanel(); bottom.add(detailsButton); bottom.add(okButton); dialog.add(bottom, BorderLayout.SOUTH); dialog.setSize(SIZE_NODETAILS); if (parent == null) { UtilGUI.centre(dialog); } dialog.setVisible(true); }
1,111,719
private static void displayExceptionDialog(Component parent, String message, Throwable throwable) { if (parent == null) { logger.error("displayExceptionDialog with null parent for message " + message); } else if (parent instanceof Frame) { dialog = new JDialog((Frame) parent, "Error Report"); } else if (parent instanceof Dialog) { dialog = new JDialog((Dialog)parent, "Error Report"); } else { logger.error("non-null parent component is neither frame nor dialog"); } logger.debug("displayExceptionDialog: showing exception dialog for:", throwable); dialog.setLocationRelativeTo(parent); ((JComponent)dialog.getContentPane()).setBorder( BorderFactory.createEmptyBorder(10, 10, 5, 5)); // Details information final StringWriter traceWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(traceWriter)); try { traceWriter.close(); } catch (IOException e1) { // who cares!? } JPanel top = new JPanel(new GridLayout(0, 1, 5, 5)); final String LAYOUT_START = "<html><font color='red' size='+1'>"; final String LAYOUT_END = "</font>"; if (message == null) { message = "Unexpected error"; } JLabel messageLabel = new JLabel(LAYOUT_START + message + LAYOUT_END); messageLabel.setIcon(StatusIcon.getFailIcon()); top.add(messageLabel); JLabel errClassLabel = new JLabel("Exception type: " + throwable.getClass().getName()); top.add(errClassLabel); String excDetailMessage = throwable.getMessage(); if (excDetailMessage != null) { top.add(new JLabel("Detail string: " + excDetailMessage)); } dialog.add(top, BorderLayout.NORTH); final JScrollPane detailScroller = new JScrollPane(new JTextArea(traceWriter.toString())); final JPanel messageComponent = new JPanel(new BorderLayout()); messageComponent.add(detailScroller, BorderLayout.CENTER); messageComponent.setPreferredSize(new Dimension(700, 400)); final Dimension SIZE_NODETAILS = new Dimension(350, 200); // XXX This button should be at the right side of the // error text instead of the bottom, so it wouldn't jump // around when you activate it. final JButton detailsButton = new JButton("Show Details"); // N.B. AbstractAction in a JButton does not update the label // automatically when you change the SHORT_DESCRIPTION value. ActionListener detailsAction = new ActionListener() { boolean showDetails = true; public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; } }; detailsButton.addActionListener(detailsAction); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); } }); JPanel bottom = new JPanel(); bottom.add(detailsButton); bottom.add(okButton); dialog.add(bottom, BorderLayout.SOUTH); dialog.setSize(SIZE_NODETAILS); if (parent == null) { UtilGUI.centre(dialog); } dialog.setVisible(true); }
private static void displayExceptionDialog(Component parent, String message, Throwable throwable) { if (parent == null) { logger.error("displayExceptionDialog with null parent for message " + message); } else if (parent instanceof Frame) { dialog = new JDialog((Frame) parent, "Error Report"); } else if (parent instanceof Dialog) { dialog = new JDialog((Dialog)parent, "Error Report"); } else { logger.error("non-null parent component is neither frame nor dialog"); } logger.debug("displayExceptionDialog: showing exception dialog for:", throwable); dialog.setLocationRelativeTo(parent); ((JComponent)dialog.getContentPane()).setBorder( BorderFactory.createEmptyBorder(10, 10, 5, 5)); // Details information final StringWriter traceWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(traceWriter)); try { traceWriter.close(); } catch (IOException e1) { // who cares!? } JPanel top = new JPanel(new GridLayout(0, 1, 5, 5)); final String LAYOUT_START = "<html><font color='red' size='+1'>"; final String LAYOUT_END = "</font>"; if (message == null) { message = "Unexpected error"; } JLabel messageLabel = new JLabel(LAYOUT_START + message + LAYOUT_END); messageLabel.setIcon(StatusIcon.getFailIcon()); top.add(messageLabel); JLabel errClassLabel = new JLabel("Exception type: " + throwable.getClass().getName()); top.add(errClassLabel); String excDetailMessage = throwable.getMessage(); if (excDetailMessage != null) { top.add(new JLabel("Detail string: " + excDetailMessage)); } dialog.add(top, BorderLayout.NORTH); final JScrollPane detailScroller = new JScrollPane(new JTextArea(traceWriter.toString())); final JPanel messageComponent = new JPanel(new BorderLayout()); messageComponent.add(detailScroller, BorderLayout.CENTER); messageComponent.setPreferredSize(new Dimension(700, 400)); final Dimension SIZE_NODETAILS = new Dimension(350, 200); // XXX This button should be at the right side of the // error text instead of the bottom, so it wouldn't jump // around when you activate it. final JButton detailsButton = new JButton("Show Details"); // N.B. AbstractAction in a JButton does not update the label // automatically when you change the SHORT_DESCRIPTION value. ActionListener detailsAction = new ActionListener() { boolean showDetails = true; public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { finalDialogReference.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; } }; detailsButton.addActionListener(detailsAction); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); } }); JPanel bottom = new JPanel(); bottom.add(detailsButton); bottom.add(okButton); dialog.add(bottom, BorderLayout.SOUTH); dialog.setSize(SIZE_NODETAILS); if (parent == null) { UtilGUI.centre(dialog); } dialog.setVisible(true); }
1,111,720
private static void displayExceptionDialog(Component parent, String message, Throwable throwable) { if (parent == null) { logger.error("displayExceptionDialog with null parent for message " + message); } else if (parent instanceof Frame) { dialog = new JDialog((Frame) parent, "Error Report"); } else if (parent instanceof Dialog) { dialog = new JDialog((Dialog)parent, "Error Report"); } else { logger.error("non-null parent component is neither frame nor dialog"); } logger.debug("displayExceptionDialog: showing exception dialog for:", throwable); dialog.setLocationRelativeTo(parent); ((JComponent)dialog.getContentPane()).setBorder( BorderFactory.createEmptyBorder(10, 10, 5, 5)); // Details information final StringWriter traceWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(traceWriter)); try { traceWriter.close(); } catch (IOException e1) { // who cares!? } JPanel top = new JPanel(new GridLayout(0, 1, 5, 5)); final String LAYOUT_START = "<html><font color='red' size='+1'>"; final String LAYOUT_END = "</font>"; if (message == null) { message = "Unexpected error"; } JLabel messageLabel = new JLabel(LAYOUT_START + message + LAYOUT_END); messageLabel.setIcon(StatusIcon.getFailIcon()); top.add(messageLabel); JLabel errClassLabel = new JLabel("Exception type: " + throwable.getClass().getName()); top.add(errClassLabel); String excDetailMessage = throwable.getMessage(); if (excDetailMessage != null) { top.add(new JLabel("Detail string: " + excDetailMessage)); } dialog.add(top, BorderLayout.NORTH); final JScrollPane detailScroller = new JScrollPane(new JTextArea(traceWriter.toString())); final JPanel messageComponent = new JPanel(new BorderLayout()); messageComponent.add(detailScroller, BorderLayout.CENTER); messageComponent.setPreferredSize(new Dimension(700, 400)); final Dimension SIZE_NODETAILS = new Dimension(350, 200); // XXX This button should be at the right side of the // error text instead of the bottom, so it wouldn't jump // around when you activate it. final JButton detailsButton = new JButton("Show Details"); // N.B. AbstractAction in a JButton does not update the label // automatically when you change the SHORT_DESCRIPTION value. ActionListener detailsAction = new ActionListener() { boolean showDetails = true; public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; } }; detailsButton.addActionListener(detailsAction); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); } }); JPanel bottom = new JPanel(); bottom.add(detailsButton); bottom.add(okButton); dialog.add(bottom, BorderLayout.SOUTH); dialog.setSize(SIZE_NODETAILS); if (parent == null) { UtilGUI.centre(dialog); } dialog.setVisible(true); }
private static void displayExceptionDialog(Component parent, String message, Throwable throwable) { if (parent == null) { logger.error("displayExceptionDialog with null parent for message " + message); } else if (parent instanceof Frame) { dialog = new JDialog((Frame) parent, "Error Report"); } else if (parent instanceof Dialog) { dialog = new JDialog((Dialog)parent, "Error Report"); } else { logger.error("non-null parent component is neither frame nor dialog"); } logger.debug("displayExceptionDialog: showing exception dialog for:", throwable); dialog.setLocationRelativeTo(parent); ((JComponent)dialog.getContentPane()).setBorder( BorderFactory.createEmptyBorder(10, 10, 5, 5)); // Details information final StringWriter traceWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(traceWriter)); try { traceWriter.close(); } catch (IOException e1) { // who cares!? } JPanel top = new JPanel(new GridLayout(0, 1, 5, 5)); final String LAYOUT_START = "<html><font color='red' size='+1'>"; final String LAYOUT_END = "</font>"; if (message == null) { message = "Unexpected error"; } JLabel messageLabel = new JLabel(LAYOUT_START + message + LAYOUT_END); messageLabel.setIcon(StatusIcon.getFailIcon()); top.add(messageLabel); JLabel errClassLabel = new JLabel("Exception type: " + throwable.getClass().getName()); top.add(errClassLabel); String excDetailMessage = throwable.getMessage(); if (excDetailMessage != null) { top.add(new JLabel("Detail string: " + excDetailMessage)); } dialog.add(top, BorderLayout.NORTH); final JScrollPane detailScroller = new JScrollPane(new JTextArea(traceWriter.toString())); final JPanel messageComponent = new JPanel(new BorderLayout()); messageComponent.add(detailScroller, BorderLayout.CENTER); messageComponent.setPreferredSize(new Dimension(700, 400)); final Dimension SIZE_NODETAILS = new Dimension(350, 200); // XXX This button should be at the right side of the // error text instead of the bottom, so it wouldn't jump // around when you activate it. final JButton detailsButton = new JButton("Show Details"); // N.B. AbstractAction in a JButton does not update the label // automatically when you change the SHORT_DESCRIPTION value. ActionListener detailsAction = new ActionListener() { boolean showDetails = true; public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); finalDialogReference.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; } }; detailsButton.addActionListener(detailsAction); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); } }); JPanel bottom = new JPanel(); bottom.add(detailsButton); bottom.add(okButton); dialog.add(bottom, BorderLayout.SOUTH); dialog.setSize(SIZE_NODETAILS); if (parent == null) { UtilGUI.centre(dialog); } dialog.setVisible(true); }
1,111,721
private static void displayExceptionDialog(Component parent, String message, Throwable throwable) { if (parent == null) { logger.error("displayExceptionDialog with null parent for message " + message); } else if (parent instanceof Frame) { dialog = new JDialog((Frame) parent, "Error Report"); } else if (parent instanceof Dialog) { dialog = new JDialog((Dialog)parent, "Error Report"); } else { logger.error("non-null parent component is neither frame nor dialog"); } logger.debug("displayExceptionDialog: showing exception dialog for:", throwable); dialog.setLocationRelativeTo(parent); ((JComponent)dialog.getContentPane()).setBorder( BorderFactory.createEmptyBorder(10, 10, 5, 5)); // Details information final StringWriter traceWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(traceWriter)); try { traceWriter.close(); } catch (IOException e1) { // who cares!? } JPanel top = new JPanel(new GridLayout(0, 1, 5, 5)); final String LAYOUT_START = "<html><font color='red' size='+1'>"; final String LAYOUT_END = "</font>"; if (message == null) { message = "Unexpected error"; } JLabel messageLabel = new JLabel(LAYOUT_START + message + LAYOUT_END); messageLabel.setIcon(StatusIcon.getFailIcon()); top.add(messageLabel); JLabel errClassLabel = new JLabel("Exception type: " + throwable.getClass().getName()); top.add(errClassLabel); String excDetailMessage = throwable.getMessage(); if (excDetailMessage != null) { top.add(new JLabel("Detail string: " + excDetailMessage)); } dialog.add(top, BorderLayout.NORTH); final JScrollPane detailScroller = new JScrollPane(new JTextArea(traceWriter.toString())); final JPanel messageComponent = new JPanel(new BorderLayout()); messageComponent.add(detailScroller, BorderLayout.CENTER); messageComponent.setPreferredSize(new Dimension(700, 400)); final Dimension SIZE_NODETAILS = new Dimension(350, 200); // XXX This button should be at the right side of the // error text instead of the bottom, so it wouldn't jump // around when you activate it. final JButton detailsButton = new JButton("Show Details"); // N.B. AbstractAction in a JButton does not update the label // automatically when you change the SHORT_DESCRIPTION value. ActionListener detailsAction = new ActionListener() { boolean showDetails = true; public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; } }; detailsButton.addActionListener(detailsAction); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); } }); JPanel bottom = new JPanel(); bottom.add(detailsButton); bottom.add(okButton); dialog.add(bottom, BorderLayout.SOUTH); dialog.setSize(SIZE_NODETAILS); if (parent == null) { UtilGUI.centre(dialog); } dialog.setVisible(true); }
private static void displayExceptionDialog(Component parent, String message, Throwable throwable) { if (parent == null) { logger.error("displayExceptionDialog with null parent for message " + message); } else if (parent instanceof Frame) { dialog = new JDialog((Frame) parent, "Error Report"); } else if (parent instanceof Dialog) { dialog = new JDialog((Dialog)parent, "Error Report"); } else { logger.error("non-null parent component is neither frame nor dialog"); } logger.debug("displayExceptionDialog: showing exception dialog for:", throwable); dialog.setLocationRelativeTo(parent); ((JComponent)dialog.getContentPane()).setBorder( BorderFactory.createEmptyBorder(10, 10, 5, 5)); // Details information final StringWriter traceWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(traceWriter)); try { traceWriter.close(); } catch (IOException e1) { // who cares!? } JPanel top = new JPanel(new GridLayout(0, 1, 5, 5)); final String LAYOUT_START = "<html><font color='red' size='+1'>"; final String LAYOUT_END = "</font>"; if (message == null) { message = "Unexpected error"; } JLabel messageLabel = new JLabel(LAYOUT_START + message + LAYOUT_END); messageLabel.setIcon(StatusIcon.getFailIcon()); top.add(messageLabel); JLabel errClassLabel = new JLabel("Exception type: " + throwable.getClass().getName()); top.add(errClassLabel); String excDetailMessage = throwable.getMessage(); if (excDetailMessage != null) { top.add(new JLabel("Detail string: " + excDetailMessage)); } dialog.add(top, BorderLayout.NORTH); final JScrollPane detailScroller = new JScrollPane(new JTextArea(traceWriter.toString())); final JPanel messageComponent = new JPanel(new BorderLayout()); messageComponent.add(detailScroller, BorderLayout.CENTER); messageComponent.setPreferredSize(new Dimension(700, 400)); final Dimension SIZE_NODETAILS = new Dimension(350, 200); // XXX This button should be at the right side of the // error text instead of the bottom, so it wouldn't jump // around when you activate it. final JButton detailsButton = new JButton("Show Details"); // N.B. AbstractAction in a JButton does not update the label // automatically when you change the SHORT_DESCRIPTION value. ActionListener detailsAction = new ActionListener() { boolean showDetails = true; public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { finalDialogReference.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; } }; detailsButton.addActionListener(detailsAction); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); } }); JPanel bottom = new JPanel(); bottom.add(detailsButton); bottom.add(okButton); dialog.add(bottom, BorderLayout.SOUTH); dialog.setSize(SIZE_NODETAILS); if (parent == null) { UtilGUI.centre(dialog); } dialog.setVisible(true); }
1,111,722
private static void displayExceptionDialog(Component parent, String message, Throwable throwable) { if (parent == null) { logger.error("displayExceptionDialog with null parent for message " + message); } else if (parent instanceof Frame) { dialog = new JDialog((Frame) parent, "Error Report"); } else if (parent instanceof Dialog) { dialog = new JDialog((Dialog)parent, "Error Report"); } else { logger.error("non-null parent component is neither frame nor dialog"); } logger.debug("displayExceptionDialog: showing exception dialog for:", throwable); dialog.setLocationRelativeTo(parent); ((JComponent)dialog.getContentPane()).setBorder( BorderFactory.createEmptyBorder(10, 10, 5, 5)); // Details information final StringWriter traceWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(traceWriter)); try { traceWriter.close(); } catch (IOException e1) { // who cares!? } JPanel top = new JPanel(new GridLayout(0, 1, 5, 5)); final String LAYOUT_START = "<html><font color='red' size='+1'>"; final String LAYOUT_END = "</font>"; if (message == null) { message = "Unexpected error"; } JLabel messageLabel = new JLabel(LAYOUT_START + message + LAYOUT_END); messageLabel.setIcon(StatusIcon.getFailIcon()); top.add(messageLabel); JLabel errClassLabel = new JLabel("Exception type: " + throwable.getClass().getName()); top.add(errClassLabel); String excDetailMessage = throwable.getMessage(); if (excDetailMessage != null) { top.add(new JLabel("Detail string: " + excDetailMessage)); } dialog.add(top, BorderLayout.NORTH); final JScrollPane detailScroller = new JScrollPane(new JTextArea(traceWriter.toString())); final JPanel messageComponent = new JPanel(new BorderLayout()); messageComponent.add(detailScroller, BorderLayout.CENTER); messageComponent.setPreferredSize(new Dimension(700, 400)); final Dimension SIZE_NODETAILS = new Dimension(350, 200); // XXX This button should be at the right side of the // error text instead of the bottom, so it wouldn't jump // around when you activate it. final JButton detailsButton = new JButton("Show Details"); // N.B. AbstractAction in a JButton does not update the label // automatically when you change the SHORT_DESCRIPTION value. ActionListener detailsAction = new ActionListener() { boolean showDetails = true; public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; } }; detailsButton.addActionListener(detailsAction); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); } }); JPanel bottom = new JPanel(); bottom.add(detailsButton); bottom.add(okButton); dialog.add(bottom, BorderLayout.SOUTH); dialog.setSize(SIZE_NODETAILS); if (parent == null) { UtilGUI.centre(dialog); } dialog.setVisible(true); }
private static void displayExceptionDialog(Component parent, String message, Throwable throwable) { if (parent == null) { logger.error("displayExceptionDialog with null parent for message " + message); } else if (parent instanceof Frame) { dialog = new JDialog((Frame) parent, "Error Report"); } else if (parent instanceof Dialog) { dialog = new JDialog((Dialog)parent, "Error Report"); } else { logger.error("non-null parent component is neither frame nor dialog"); } logger.debug("displayExceptionDialog: showing exception dialog for:", throwable); dialog.setLocationRelativeTo(parent); ((JComponent)dialog.getContentPane()).setBorder( BorderFactory.createEmptyBorder(10, 10, 5, 5)); // Details information final StringWriter traceWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(traceWriter)); try { traceWriter.close(); } catch (IOException e1) { // who cares!? } JPanel top = new JPanel(new GridLayout(0, 1, 5, 5)); final String LAYOUT_START = "<html><font color='red' size='+1'>"; final String LAYOUT_END = "</font>"; if (message == null) { message = "Unexpected error"; } JLabel messageLabel = new JLabel(LAYOUT_START + message + LAYOUT_END); messageLabel.setIcon(StatusIcon.getFailIcon()); top.add(messageLabel); JLabel errClassLabel = new JLabel("Exception type: " + throwable.getClass().getName()); top.add(errClassLabel); String excDetailMessage = throwable.getMessage(); if (excDetailMessage != null) { top.add(new JLabel("Detail string: " + excDetailMessage)); } dialog.add(top, BorderLayout.NORTH); final JScrollPane detailScroller = new JScrollPane(new JTextArea(traceWriter.toString())); final JPanel messageComponent = new JPanel(new BorderLayout()); messageComponent.add(detailScroller, BorderLayout.CENTER); messageComponent.setPreferredSize(new Dimension(700, 400)); final Dimension SIZE_NODETAILS = new Dimension(350, 200); // XXX This button should be at the right side of the // error text instead of the bottom, so it wouldn't jump // around when you activate it. final JButton detailsButton = new JButton("Show Details"); // N.B. AbstractAction in a JButton does not update the label // automatically when you change the SHORT_DESCRIPTION value. ActionListener detailsAction = new ActionListener() { boolean showDetails = true; public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); finalDialogReference.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; } }; detailsButton.addActionListener(detailsAction); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); } }); JPanel bottom = new JPanel(); bottom.add(detailsButton); bottom.add(okButton); dialog.add(bottom, BorderLayout.SOUTH); finalDialogReference.setSize(SIZE_NODETAILS); if (parent == null) { UtilGUI.centre(dialog); } dialog.setVisible(true); }
1,111,723
private static void displayExceptionDialog(Component parent, String message, Throwable throwable) { if (parent == null) { logger.error("displayExceptionDialog with null parent for message " + message); } else if (parent instanceof Frame) { dialog = new JDialog((Frame) parent, "Error Report"); } else if (parent instanceof Dialog) { dialog = new JDialog((Dialog)parent, "Error Report"); } else { logger.error("non-null parent component is neither frame nor dialog"); } logger.debug("displayExceptionDialog: showing exception dialog for:", throwable); dialog.setLocationRelativeTo(parent); ((JComponent)dialog.getContentPane()).setBorder( BorderFactory.createEmptyBorder(10, 10, 5, 5)); // Details information final StringWriter traceWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(traceWriter)); try { traceWriter.close(); } catch (IOException e1) { // who cares!? } JPanel top = new JPanel(new GridLayout(0, 1, 5, 5)); final String LAYOUT_START = "<html><font color='red' size='+1'>"; final String LAYOUT_END = "</font>"; if (message == null) { message = "Unexpected error"; } JLabel messageLabel = new JLabel(LAYOUT_START + message + LAYOUT_END); messageLabel.setIcon(StatusIcon.getFailIcon()); top.add(messageLabel); JLabel errClassLabel = new JLabel("Exception type: " + throwable.getClass().getName()); top.add(errClassLabel); String excDetailMessage = throwable.getMessage(); if (excDetailMessage != null) { top.add(new JLabel("Detail string: " + excDetailMessage)); } dialog.add(top, BorderLayout.NORTH); final JScrollPane detailScroller = new JScrollPane(new JTextArea(traceWriter.toString())); final JPanel messageComponent = new JPanel(new BorderLayout()); messageComponent.add(detailScroller, BorderLayout.CENTER); messageComponent.setPreferredSize(new Dimension(700, 400)); final Dimension SIZE_NODETAILS = new Dimension(350, 200); // XXX This button should be at the right side of the // error text instead of the bottom, so it wouldn't jump // around when you activate it. final JButton detailsButton = new JButton("Show Details"); // N.B. AbstractAction in a JButton does not update the label // automatically when you change the SHORT_DESCRIPTION value. ActionListener detailsAction = new ActionListener() { boolean showDetails = true; public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; } }; detailsButton.addActionListener(detailsAction); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); } }); JPanel bottom = new JPanel(); bottom.add(detailsButton); bottom.add(okButton); dialog.add(bottom, BorderLayout.SOUTH); dialog.setSize(SIZE_NODETAILS); if (parent == null) { UtilGUI.centre(dialog); } dialog.setVisible(true); }
private static void displayExceptionDialog(Component parent, String message, Throwable throwable) { if (parent == null) { logger.error("displayExceptionDialog with null parent for message " + message); } else if (parent instanceof Frame) { dialog = new JDialog((Frame) parent, "Error Report"); } else if (parent instanceof Dialog) { dialog = new JDialog((Dialog)parent, "Error Report"); } else { logger.error("non-null parent component is neither frame nor dialog"); } logger.debug("displayExceptionDialog: showing exception dialog for:", throwable); dialog.setLocationRelativeTo(parent); ((JComponent)dialog.getContentPane()).setBorder( BorderFactory.createEmptyBorder(10, 10, 5, 5)); // Details information final StringWriter traceWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(traceWriter)); try { traceWriter.close(); } catch (IOException e1) { // who cares!? } JPanel top = new JPanel(new GridLayout(0, 1, 5, 5)); final String LAYOUT_START = "<html><font color='red' size='+1'>"; final String LAYOUT_END = "</font>"; if (message == null) { message = "Unexpected error"; } JLabel messageLabel = new JLabel(LAYOUT_START + message + LAYOUT_END); messageLabel.setIcon(StatusIcon.getFailIcon()); top.add(messageLabel); JLabel errClassLabel = new JLabel("Exception type: " + throwable.getClass().getName()); top.add(errClassLabel); String excDetailMessage = throwable.getMessage(); if (excDetailMessage != null) { top.add(new JLabel("Detail string: " + excDetailMessage)); } dialog.add(top, BorderLayout.NORTH); final JScrollPane detailScroller = new JScrollPane(new JTextArea(traceWriter.toString())); final JPanel messageComponent = new JPanel(new BorderLayout()); messageComponent.add(detailScroller, BorderLayout.CENTER); messageComponent.setPreferredSize(new Dimension(700, 400)); final Dimension SIZE_NODETAILS = new Dimension(350, 200); // XXX This button should be at the right side of the // error text instead of the bottom, so it wouldn't jump // around when you activate it. final JButton detailsButton = new JButton("Show Details"); // N.B. AbstractAction in a JButton does not update the label // automatically when you change the SHORT_DESCRIPTION value. ActionListener detailsAction = new ActionListener() { boolean showDetails = true; public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; } }; detailsButton.addActionListener(detailsAction); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); } }); JPanel bottom = new JPanel(); bottom.add(detailsButton); bottom.add(okButton); dialog.add(bottom, BorderLayout.SOUTH); dialog.setSize(SIZE_NODETAILS); if (parent == null) { UtilGUI.centre(dialog); } dialog.setVisible(true); }
1,111,724
public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; }
public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { finalDialogReference.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; }
1,111,725
public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; }
public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); finalDialogReference.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; }
1,111,726
public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; }
public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { finalDialogReference.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; }
1,111,727
public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); dialog.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; }
public void actionPerformed(ActionEvent e) { // System.out.println("showDetails=" + showDetails); if (showDetails) { dialog.add(messageComponent, BorderLayout.CENTER); detailsButton.setText("Hide Details"); dialog.pack(); } else /* hide details */ { dialog.remove(messageComponent); detailsButton.setText("Show Details"); finalDialogReference.setSize(SIZE_NODETAILS); } showDetails = ! showDetails; }
1,111,728
public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); }
public void actionPerformed(ActionEvent e) { dialog.dispose(); dialog.setVisible(false); }
1,111,729
public void dragGestureRecognized(DragGestureEvent dge) { PlayPenComponent c = contentPane.getComponentAt( unzoomPoint(((MouseEvent) dge.getTriggerEvent()).getPoint())); if ( c instanceof TablePane ) { TablePane tp = (TablePane) c; int colIndex = TablePane.COLUMN_INDEX_NONE; Point dragOrigin = tp.getPlayPen().unzoomPoint(new Point(dge.getDragOrigin())); dragOrigin.x -= tp.getX(); dragOrigin.y -= tp.getY(); // ignore drag events that aren't from the left mouse button if (dge.getTriggerEvent() instanceof MouseEvent && (dge.getTriggerEvent().getModifiers() & InputEvent.BUTTON1_MASK) == 0) return; // ignore drag events if we're in the middle of a createRelationship if (ArchitectFrame.getMainInstance().createRelationshipIsActive()) { logger.debug("CreateRelationship() is active, short circuiting DnD."); return; } try { colIndex = tp.pointToColumnIndex(dragOrigin); } catch (ArchitectException e) { logger.error("Got exception while translating drag point", e); } logger.debug("Recognized drag gesture on "+tp.getName()+"! origin="+dragOrigin +"; col="+colIndex); try { logger.debug("DGL: colIndex="+colIndex+",columnsSize="+tp.getModel().getColumns().size()); if (colIndex == TablePane.COLUMN_INDEX_TITLE) { // we don't use this because it often misses drags // that start near the edge of the titlebar logger.debug("Discarding drag on titlebar (handled by mousePressed())"); draggingTablePanes = true; } else if (colIndex >= 0 && colIndex < tp.getModel().getColumns().size()) { // export column as DnD event if (logger.isDebugEnabled()) { logger.debug("Exporting column "+colIndex+" with DnD"); } tp.draggingColumn = tp.getModel().getColumn(colIndex); DBTree tree = ArchitectFrame.getMainInstance().dbTree; int[] path = tree.getDnDPathToNode(tp.draggingColumn); if (logger.isDebugEnabled()) { StringBuffer array = new StringBuffer(); for (int i = 0; i < path.length; i++) { array.append(path[i]); array.append(","); } logger.debug("Path to dragged node: "+array); } // export list of DnD-type tree paths ArrayList paths = new ArrayList(1); paths.add(path); logger.info("DBTree: exporting 1-item list of DnD-type tree path"); JLabel label = new JLabel(tp.getModel().getName()+"."+tp.draggingColumn.getName()); Dimension labelSize = label.getPreferredSize(); label.setSize(labelSize); // because a LayoutManager would normally do this BufferedImage dragImage = new BufferedImage(labelSize.width, labelSize.height, BufferedImage.TYPE_4BYTE_ABGR); Graphics2D imageGraphics = dragImage.createGraphics(); // XXX: it would be nice to make this transparent, but initial attempts using AlphaComposite failed (on OS X) label.paint(imageGraphics); imageGraphics.dispose(); dge.getDragSource().startDrag(dge, null, dragImage, new Point(0, 0), new DnDTreePathTransferable(paths), tp); } } catch (ArchitectException ex) { logger.error("Couldn't drag column", ex); JOptionPane.showMessageDialog(tp.getPlayPen(), "Can't drag column: "+ex.getMessage()); } } else { return; } }
public void dragGestureRecognized(DragGestureEvent dge) { PlayPenComponent c = contentPane.getComponentAt( unzoomPoint(((MouseEvent) dge.getTriggerEvent()).getPoint())); if ( c instanceof TablePane ) { TablePane tp = (TablePane) c; int colIndex = TablePane.COLUMN_INDEX_NONE; Point dragOrigin = tp.getPlayPen().unzoomPoint(new Point(dge.getDragOrigin())); dragOrigin.x -= tp.getX(); dragOrigin.y -= tp.getY(); // ignore drag events that aren't from the left mouse button if (dge.getTriggerEvent() instanceof MouseEvent && (dge.getTriggerEvent().getModifiers() & InputEvent.BUTTON1_MASK) == 0) return; // ignore drag events if we're in the middle of a createRelationship if (ArchitectFrame.getMainInstance().createRelationshipIsActive()) { logger.debug("CreateRelationship() is active, short circuiting DnD."); return; } try { colIndex = tp.pointToColumnIndex(dragOrigin); } catch (ArchitectException e) { logger.error("Got exception while translating drag point", e); } logger.debug("Recognized drag gesture on "+tp.getName()+"! origin="+dragOrigin +"; col="+colIndex); try { logger.debug("DGL: colIndex="+colIndex+",columnsSize="+tp.getModel().getColumns().size()); if (colIndex == TablePane.COLUMN_INDEX_TITLE) { // we don't use this because it often misses drags // that start near the edge of the titlebar logger.debug("Discarding drag on titlebar (handled by mousePressed())"); draggingTablePanes = true; } else if (colIndex >= 0 && colIndex < tp.getModel().getColumns().size()) { // export column as DnD event if (logger.isDebugEnabled()) { logger.debug("Exporting column "+colIndex+" with DnD"); } tp.draggingColumn = tp.getModel().getColumn(colIndex); DBTree tree = ArchitectFrame.getMainInstance().dbTree; int[] path = tree.getDnDPathToNode(tp.draggingColumn); if (logger.isDebugEnabled()) { StringBuffer array = new StringBuffer(); for (int i = 0; i < path.length; i++) { array.append(path[i]); array.append(","); } logger.debug("Path to dragged node: "+array); } // export list of DnD-type tree paths ArrayList paths = new ArrayList(1); paths.add(path); logger.info("DBTree: exporting 1-item list of DnD-type tree path"); JLabel label = new JLabel(tp.getModel().getName()+"."+tp.draggingColumn.getName()); Dimension labelSize = label.getPreferredSize(); label.setSize(labelSize); // because a LayoutManager would normally do this BufferedImage dragImage = new BufferedImage(labelSize.width, labelSize.height, BufferedImage.TYPE_4BYTE_ABGR); Graphics2D imageGraphics = dragImage.createGraphics(); // XXX: it would be nice to make this transparent, but initial attempts using AlphaComposite failed (on OS X) label.repaint(); imageGraphics.dispose(); dge.getDragSource().startDrag(dge, null, dragImage, new Point(0, 0), new DnDTreePathTransferable(paths), tp); } } catch (ArchitectException ex) { logger.error("Couldn't drag column", ex); JOptionPane.showMessageDialog(tp.getPlayPen(), "Can't drag column: "+ex.getMessage()); } } else { return; } }
1,111,730
public void testThumbnailCreateCorruptInstances() throws Exception { String testImgDir = "c:\\java\\photovault\\testfiles"; String fname = "test1.jpg"; File f = new File( testImgDir, fname ); PhotoInfo photo = null; try { photo = PhotoInfo.addToDB( f ); } catch ( PhotoNotFoundException e ) { fail( "Could not find photo: " + e.getMessage() ); } // Create the thumbnail so that the database shows that such beast exist photo.createThumbnail(); // Corrupt the database by deleting the actual image files // that instances refer to int numInstances = photo.getNumInstances(); for ( int n = 0; n < numInstances ; n++ ) { ImageInstance instance = photo.getInstance( n ); File instFile = instance.getImageFile(); instFile.delete(); } try { Thumbnail thumb = photo.getThumbnail(); assertNotNull( thumb ); assertTrue( "Database is corrupt, should return default thumbnail", thumb == Thumbnail.getDefaultThumbnail() ); assertEquals( "Database is corrupt, getThumbnail should not create a new instance", numInstances, photo.getNumInstances() ); } finally { // Clean up in any case photo.delete(); } }
public void testThumbnailCreateCorruptInstances() throws Exception { String testImgDir = "c:\\java\\photovault\\testfiles"; String fname = "test1.jpg"; File f = new File( testImgDir, fname ); PhotoInfo photo = null; try { photo = PhotoInfo.addToDB( f ); } catch ( PhotoNotFoundException e ) { fail( "Could not find photo: " + e.getMessage() ); } // Create the thumbnail so that the database shows that such beast exist // Corrupt the database by deleting the actual image files // that instances refer to int numInstances = photo.getNumInstances(); for ( int n = 0; n < numInstances ; n++ ) { ImageInstance instance = photo.getInstance( n ); File instFile = instance.getImageFile(); instFile.delete(); } try { Thumbnail thumb = photo.getThumbnail(); assertNotNull( thumb ); assertTrue( "Database is corrupt, should return default thumbnail", thumb == Thumbnail.getDefaultThumbnail() ); assertEquals( "Database is corrupt, getThumbnail should not create a new instance", numInstances, photo.getNumInstances() ); } finally { // Clean up in any case photo.delete(); } }
1,111,731
public static void main(String[] args) throws Exception{ UserManager userManager = UserManager.getInstance(); User user = null; char[] password = null; int invalidAttempts = 0; if(args.length == 1){ password = args[0].toCharArray(); user = userManager.verifyUsernamePassword( AuthConstants.USER_ADMIN, password); /* invalid password was tried */ if(user == null){ invalidAttempts ++; } } while(user == null){ if(invalidAttempts > 0){ System.out.println("Invalid Admin Password."); } /* get the password */ password = PasswordField.getPassword("Enter password:"); /* the password should match for the admin user */ user = userManager.verifyUsernamePassword( AuthConstants.USER_ADMIN, password); invalidAttempts ++; if(invalidAttempts >= 3){ break; } } /* exit if the admin password is still invalid */ if(user == null){ System.out.println("Number of invalid attempts exceeded. Exiting !"); return; } /* set admin password as the stop key */ final JettyStopKey stopKey = new JettyStopKey(new String(password)); System.setProperty("STOP.KEY", stopKey.toString()); /* set stop.port */ System.setProperty("STOP.PORT", JManageProperties.getStopPort()); /* create logs dir */ new File(CoreUtils.getLogDir()).mkdirs(); /* initialize ServiceFactory */ ServiceFactory.init(ServiceFactory.MODE_LOCAL); /* initialize crypto */ Crypto.init(password); /* clear the password */ Arrays.fill(password, ' '); /* load ACLs */ ACLStore.getInstance(); /* load application types */ ApplicationTypes.init(); /* start the AlertEngine */ AlertEngine.getInstance().start(); /* start the application */ start(); }
public static void main(String[] args) throws Exception{ UserManager userManager = UserManager.getInstance(); User user = null; char[] password = null; int invalidAttempts = 0; if(args.length == 1){ password = args[0].toCharArray(); user = userManager.verifyUsernamePassword( AuthConstants.USER_ADMIN, password); /* invalid password was tried */ if(user == null){ invalidAttempts ++; } } while(user == null){ if(invalidAttempts > 0){ System.out.println("Invalid Admin Password."); } /* get the password */ password = PasswordField.getPassword("Enter password:"); /* the password should match for the admin user */ user = userManager.verifyUsernamePassword( AuthConstants.USER_ADMIN, password); invalidAttempts ++; if(invalidAttempts >= 3){ break; } } /* exit if the admin password is still invalid */ if(user == null){ System.out.println("Number of invalid attempts exceeded. Exiting !"); return; } /* set admin password as the stop key */ final JettyStopKey stopKey = new JettyStopKey(new String(password)); System.setProperty("STOP.KEY", stopKey.toString()); /* set stop.port */ System.setProperty("STOP.PORT", JManageProperties.getStopPort()); /* create logs dir */ /* initialize ServiceFactory */ ServiceFactory.init(ServiceFactory.MODE_LOCAL); /* initialize crypto */ Crypto.init(password); /* clear the password */ Arrays.fill(password, ' '); /* load ACLs */ ACLStore.getInstance(); /* load application types */ ApplicationTypes.init(); /* start the AlertEngine */ AlertEngine.getInstance().start(); /* start the application */ start(); }
1,111,733
public void stateChanged(ChangeEvent e) { viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel != null && checkPanel.changed){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); JTable table = checkPanel.getTable(); boolean[] markerResults = new boolean[table.getRowCount()]; for (int i = 0; i < table.getRowCount(); i++){ markerResults[i] = ((Boolean)table.getValueAt(i,7)).booleanValue(); } int count = 0; for (int i = 0; i < Chromosome.getSize(); i++){ if (markerResults[i]){ count++; } } Chromosome.realIndex = new int[count]; int k = 0; for (int i =0; i < Chromosome.getSize(); i++){ if (markerResults[i]){ Chromosome.realIndex[k] = i; k++; } } theData.guessBlocks(currentBlockDef); theData.filteredDPrimeTable = theData.getFilteredTable(); //hack-y way to refresh the image dPrimeDisplay.setVisible(false); dPrimeDisplay.setVisible(true); hapDisplay.theData = theData; try{ hapDisplay.getHaps(); }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); checkPanel.changed=false; } }
public void stateChanged(ChangeEvent e) { viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel != null && checkPanel.changed){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); JTable table = checkPanel.getTable(); boolean[] markerResults = new boolean[table.getRowCount()]; for (int i = 0; i < table.getRowCount(); i++){ markerResults[i] = ((Boolean)table.getValueAt(i,7)).booleanValue(); } int count = 0; for (int i = 0; i < Chromosome.getSize(); i++){ if (markerResults[i]){ count++; } } Chromosome.realIndex = new int[count]; int k = 0; for (int i =0; i < Chromosome.getSize(); i++){ if (markerResults[i]){ Chromosome.realIndex[k] = i; k++; } } theData.guessBlocks(currentBlockDef); //hack-y way to refresh the image dPrimeDisplay.setVisible(false); dPrimeDisplay.setVisible(true); hapDisplay.theData = theData; try{ hapDisplay.getHaps(); }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); checkPanel.changed=false; } }
1,111,734
public String getExpressionText() { return expression.getExpression(); }
public String getExpressionText() { return "${" + expression.getExpression() + "}"; }
1,111,737
public void doTag(XMLOutput output) throws JellyTagException { Project project = getAntProject(); String tagName = getTagName(); Object parentObject = findBeanAncestor(); Object parentTask = findParentTaskObject(); // lets assume that Task instances are not nested inside other Task instances // for example <manifest> inside a <jar> should be a nested object, where as // if the parent is not a Task the <manifest> should create a ManifestTask // // also its possible to have a root Ant tag which isn't a task, such as when // defining <fileset id="...">...</fileset> Object nested = null; if (parentObject != null && !( parentTask instanceof TaskContainer) ) { nested = createNestedObject( parentObject, tagName ); } if (nested == null) { task = createTask( tagName ); if (task != null) { if ( log.isDebugEnabled() ) { log.debug( "Creating an ant Task for name: " + tagName ); } // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { Object[] args = { body }; try { method.invoke(this.task, args); } catch (IllegalAccessException e) { throw new JellyTagException(e); } catch (InvocationTargetException e) { throw new JellyTagException(e); } } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? task.perform(); } } if (task == null) { if (nested == null) { if ( log.isDebugEnabled() ) { log.debug( "Trying to create a data type for tag: " + tagName ); } nested = createDataType( tagName ); } else { if ( log.isDebugEnabled() ) { log.debug( "Created nested property tag: " + tagName ); } } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, nested ); } try{ PropertyUtils.setProperty( nested, "name", tagName ); } catch (Exception e) { } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( parentObject != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObject.getClass() ); try { if (log.isDebugEnabled()) { log.debug("About to set the: " + tagName + " property on: " + parentObject + " to value: " + nested + " with type: " + nested.getClass() ); } ih.storeElement( project, parentObject, nested, tagName ); } catch (Exception e) { log.warn( "Caught exception setting nested: " + tagName, e ); } // now try to set the property for good measure // as the storeElement() method does not // seem to call any setter methods of non-String types try { BeanUtils.setProperty( parentObject, tagName, nested ); } catch (Exception e) { log.debug("Caught exception trying to set property: " + tagName + " on: " + parentObject); } } } else { log.warn("Could not convert tag: " + tagName + " into an Ant task, data type or property"); // lets treat this tag as static XML... StaticTag tag = new StaticTag("", tagName, tagName); tag.setParent( getParent() ); tag.setBody( getBody() ); tag.setContext(context); for (Iterator iter = getAttributes().entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); tag.setAttribute(name, value); } tag.doTag(output); } } }
public void doTag(XMLOutput output) throws JellyTagException { Project project = getAntProject(); String tagName = getTagName(); Object parentObject = findBeanAncestor(); Object parentTask = findParentTaskObject(); // lets assume that Task instances are not nested inside other Task instances // for example <manifest> inside a <jar> should be a nested object, where as // if the parent is not a Task the <manifest> should create a ManifestTask // // also its possible to have a root Ant tag which isn't a task, such as when // defining <fileset id="...">...</fileset> Object nested = null; if (parentObject != null && !( parentTask instanceof TaskContainer) ) { nested = createNestedObject( parentObject, tagName ); } if (nested == null) { task = createTask( tagName ); if (task != null) { if ( log.isDebugEnabled() ) { log.debug( "Creating an ant Task for name: " + tagName ); } // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { Object[] args = { body }; try { method.invoke(this.task, args); } catch (IllegalAccessException e) { throw new JellyTagException(e); } catch (InvocationTargetException e) { throw new JellyTagException(e); } } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? task.perform(); } } if (task == null) { if (nested == null) { if ( log.isDebugEnabled() ) { log.debug( "Trying to create a data type for tag: " + tagName ); } nested = createDataType( tagName ); } else { if ( log.isDebugEnabled() ) { log.debug( "Created nested property tag: " + tagName ); } } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, nested ); } try{ PropertyUtils.setProperty( nested, "name", tagName ); } catch (Exception e) { } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( parentObject != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObject.getClass() ); try { if (log.isDebugEnabled()) { log.debug("About to set the: " + tagName + " property on: " + parentObject + " to value: " + nested + " with type: " + nested.getClass() ); } ih.storeElement( project, parentObject, nested, tagName.toLowerCase() ); } catch (Exception e) { log.warn( "Caught exception setting nested: " + tagName, e ); } // now try to set the property for good measure // as the storeElement() method does not // seem to call any setter methods of non-String types try { BeanUtils.setProperty( parentObject, tagName, nested ); } catch (Exception e) { log.debug("Caught exception trying to set property: " + tagName + " on: " + parentObject); } } } else { log.warn("Could not convert tag: " + tagName + " into an Ant task, data type or property"); // lets treat this tag as static XML... StaticTag tag = new StaticTag("", tagName, tagName); tag.setParent( getParent() ); tag.setBody( getBody() ); tag.setContext(context); for (Iterator iter = getAttributes().entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); tag.setAttribute(name, value); } tag.doTag(output); } } }
1,111,738
private void putResult(ProfileResult profileResult) { if (logger.isDebugEnabled()) { logger.debug("[instance "+hashCode()+"]" + " Adding new profile result for "+profileResult.getProfiledObject().getName()+ " existing profile count: "+results.size()); } results.put(profileResult.getProfiledObject(), profileResult); }
public void putResult(ProfileResult profileResult) { if (logger.isDebugEnabled()) { logger.debug("[instance "+hashCode()+"]" + " Adding new profile result for "+profileResult.getProfiledObject().getName()+ " existing profile count: "+results.size()); } results.put(profileResult.getProfiledObject(), profileResult); }
1,111,739
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { final ObjectName objectName = context.getObjectName(); final ApplicationConfig appConfig = context.getApplicationConfig(); List applications = null; if(appConfig.isCluster()){ applications = appConfig.getApplications(); }else{ applications = new ArrayList(1); applications.add(appConfig); } for(Iterator it=applications.iterator(); it.hasNext(); ){ final ApplicationConfig childAppConfig = (ApplicationConfig)it.next(); try { final ServerConnection serverConnection = ServerConnector.getServerConnection(childAppConfig); List attributeList = buildAttributeList(request, childAppConfig.getApplicationId()); serverConnection.setAttributes(objectName, attributeList); String logString = getLogString(attributeList); UserActivityLogger.getInstance().logActivity( context.getUser().getUsername(), "Updated the attributes of application:" + childAppConfig.getName() + ", object name:" + objectName.getCanonicalName() + logString); } catch (ConnectionFailedException e) { logger.log(Level.FINE, "Error connecting to :" + childAppConfig.getName(), e); } } return mapping.findForward(Forwards.SUCCESS); }
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { final ObjectName objectName = context.getObjectName(); final ApplicationConfig appConfig = context.getApplicationConfig(); List applications = null; if(appConfig.isCluster()){ applications = appConfig.getApplications(); }else{ applications = new ArrayList(1); applications.add(appConfig); } for(Iterator it=applications.iterator(); it.hasNext(); ){ final ApplicationConfig childAppConfig = (ApplicationConfig)it.next(); try { final ServerConnection serverConnection = ServerConnector.getServerConnection(childAppConfig); List attributeList = buildAttributeList(request, childAppConfig.getApplicationId()); serverConnection.setAttributes(objectName, attributeList); String logString = getLogString(attributeList); UserActivityLogger.getInstance().logActivity( context.getUser().getUsername(), "Updated the attributes of application:" + childAppConfig.getName() + ", object name:" + objectName.getCanonicalName() + logString); } catch (ConnectionFailedException e) { logger.log(Level.FINE, "Error connecting to :" + childAppConfig.getName(), e); } } return mapping.findForward(Forwards.SUCCESS); }
1,111,740
public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException { if (var == null) { throw new MissingAttributeException( "var" ); } if (select == null) { throw new MissingAttributeException( "select" ); } Object xpathContext = getXPathContext(); Object value = null; try { if(single!=null && single.booleanValue()==true) { value = select.selectSingleNode(xpathContext); } else { value = select.evaluate(xpathContext); } } catch (JaxenException e) { throw new JellyTagException(e); } if (value instanceof List) { // sort the list if xpCmp is set. if (xpCmp != null && (xpCmp.getXpath() != null)) { Collections.sort((List)value, xpCmp); } } switch ( determineReturnType() ) { case RETURN_NODE_LIST: value = valueAsList(value); break; case RETURN_FIRST_NODE: value = valueAsSingle(value); break; case RETURN_STRING_LIST: value = nodeListToStringList(valueAsList(value)); break; case RETURN_DELIMITED_STRING_LIST: value = joinDelimitedElements(nodeListToStringList(valueAsList(value))); break; case RETURN_FIRST_AS_STRING: value = singleValueAsString(valueAsSingle(value)); break; } //log.info( "Evaluated xpath: " + select + " as: " + value + " of type: " + value.getClass().getName() ); context.setVariable(var, value); }
public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException { if (var == null) { throw new MissingAttributeException( "var" ); } if (select == null) { throw new MissingAttributeException( "select" ); } Object xpathContext = getXPathContext(); Object value = null; try { if(single!=null && single.booleanValue()==true) { value = select.selectSingleNode(xpathContext); } else { value = select.evaluate(xpathContext); } } catch (JaxenException e) { throw new JellyTagException(e); } if (value instanceof List) { // sort the list if xpCmp is set. if (xpCmp != null && (xpCmp.getXpath() != null)) { Collections.sort(list, xpCmp); } if(list.isEmpty()) { value = null; } } switch ( determineReturnType() ) { case RETURN_NODE_LIST: value = valueAsList(value); break; case RETURN_FIRST_NODE: value = valueAsSingle(value); break; case RETURN_STRING_LIST: value = nodeListToStringList(valueAsList(value)); break; case RETURN_DELIMITED_STRING_LIST: value = joinDelimitedElements(nodeListToStringList(valueAsList(value))); break; case RETURN_FIRST_AS_STRING: value = singleValueAsString(valueAsSingle(value)); break; } //log.info( "Evaluated xpath: " + select + " as: " + value + " of type: " + value.getClass().getName() ); context.setVariable(var, value); }
1,111,741
public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException { if (var == null) { throw new MissingAttributeException( "var" ); } if (select == null) { throw new MissingAttributeException( "select" ); } Object xpathContext = getXPathContext(); Object value = null; try { if(single!=null && single.booleanValue()==true) { value = select.selectSingleNode(xpathContext); } else { value = select.evaluate(xpathContext); } } catch (JaxenException e) { throw new JellyTagException(e); } if (value instanceof List) { // sort the list if xpCmp is set. if (xpCmp != null && (xpCmp.getXpath() != null)) { Collections.sort((List)value, xpCmp); } } switch ( determineReturnType() ) { case RETURN_NODE_LIST: value = valueAsList(value); break; case RETURN_FIRST_NODE: value = valueAsSingle(value); break; case RETURN_STRING_LIST: value = nodeListToStringList(valueAsList(value)); break; case RETURN_DELIMITED_STRING_LIST: value = joinDelimitedElements(nodeListToStringList(valueAsList(value))); break; case RETURN_FIRST_AS_STRING: value = singleValueAsString(valueAsSingle(value)); break; } //log.info( "Evaluated xpath: " + select + " as: " + value + " of type: " + value.getClass().getName() ); context.setVariable(var, value); }
public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException { if (var == null) { throw new MissingAttributeException( "var" ); } if (select == null) { throw new MissingAttributeException( "select" ); } Object xpathContext = getXPathContext(); Object value = null; try { if(single!=null && single.booleanValue()==true) { value = select.selectSingleNode(xpathContext); } else { value = select.evaluate(xpathContext); } } catch (JaxenException e) { throw new JellyTagException(e); } if (value instanceof List) { // sort the list if xpCmp is set. if (xpCmp != null && (xpCmp.getXpath() != null)) { Collections.sort((List)value, xpCmp); } } switch ( determineReturnType() ) { case RETURN_NODE_LIST: value = valueAsList(value); break; case RETURN_FIRST_NODE: value = valueAsSingle(value); break; case RETURN_STRING_LIST: value = nodeListToStringList(valueAsList(value)); break; case RETURN_DELIMITED_STRING_LIST: value = joinDelimitedElements(nodeListToStringList(valueAsList(value))); break; case RETURN_FIRST_AS_STRING: value = singleValueAsString(valueAsSingle(value)); break; } //log.info( "Evaluated xpath: " + select + " as: " + value + " of type: " + value.getClass().getName() ); context.setVariable(var, value); }
1,111,742
public void setDelim(String delim) { this.delim = delim; }
public void setDelim(String delim) { this.delimiter = delim; if( delim!=null ) { this.asString = Boolean.TRUE; } }
1,111,744
public void dbChildrenInserted(SQLObjectEvent e) { logger.debug("dbChildrenInserted SQLObjectEvent: "+e); try { SQLObject[] newEventSources = e.getChildren(); for (int i = 0; i < newEventSources.length; i++) { ArchitectUtils.listenToHierarchy(this, newEventSources[i]); } } catch (ArchitectException ex) { logger.error("Error listening to added object", ex); } TreeModelEvent tme = new TreeModelEvent(this, getPathToNode(e.getSQLSource()), e.getChangedIndices(), e.getChildren()); fireTreeNodesInserted(tme); }
public void dbChildrenInserted(SQLObjectEvent e) { if (logger.isDebugEnabled()) { logger.debug("dbChildrenInserted SQLObjectEvent: "+e +"; tree path="+Arrays.asList(getPathToNode(e.getSQLSource()))); } try { SQLObject[] newEventSources = e.getChildren(); for (int i = 0; i < newEventSources.length; i++) { ArchitectUtils.listenToHierarchy(this, newEventSources[i]); } } catch (ArchitectException ex) { logger.error("Error listening to added object", ex); } TreeModelEvent tme = new TreeModelEvent(this, getPathToNode(e.getSQLSource()), e.getChangedIndices(), e.getChildren()); fireTreeNodesInserted(tme); }
1,111,745
public void dbChildrenRemoved(SQLObjectEvent e) { logger.debug("dbChildrenRemoved SQLObjectEvent: "+e); try { SQLObject[] oldEventSources = e.getChildren(); for (int i = 0; i < oldEventSources.length; i++) { ArchitectUtils.unlistenToHierarchy(this, oldEventSources[i]); } } catch (ArchitectException ex) { logger.error("Error unlistening to removed object", ex); } TreeModelEvent tme = new TreeModelEvent(this, getPathToNode(e.getSQLSource()), e.getChangedIndices(), e.getChildren()); fireTreeNodesRemoved(tme); }
public void dbChildrenRemoved(SQLObjectEvent e) { if (logger.isDebugEnabled()) logger.debug("dbChildrenRemoved SQLObjectEvent: "+e); try { SQLObject[] oldEventSources = e.getChildren(); for (int i = 0; i < oldEventSources.length; i++) { ArchitectUtils.unlistenToHierarchy(this, oldEventSources[i]); } } catch (ArchitectException ex) { logger.error("Error unlistening to removed object", ex); } TreeModelEvent tme = new TreeModelEvent(this, getPathToNode(e.getSQLSource()), e.getChangedIndices(), e.getChildren()); fireTreeNodesRemoved(tme); }
1,111,746
public void dbObjectChanged(SQLObjectEvent e) { logger.debug("dbObjectChanged SQLObjectEvent: "+e); SQLObject source = e.getSQLSource(); fireTreeNodesChanged(new TreeModelEvent(this, getPathToNode(source))); }
public void dbObjectChanged(SQLObjectEvent e) { if (logger.isDebugEnabled()) logger.debug("dbObjectChanged SQLObjectEvent: "+e); SQLObject source = e.getSQLSource(); fireTreeNodesChanged(new TreeModelEvent(this, getPathToNode(source))); }
1,111,747
protected void fireTreeNodesInserted(TreeModelEvent e) { logger.debug("Firing treeNodesInserted event: "+e); Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeNodesInserted(e); } }
protected void fireTreeNodesInserted(TreeModelEvent e) { if (logger.isDebugEnabled()) logger.debug("Firing treeNodesInserted event: "+e); Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeNodesInserted(e); } }
1,111,748
protected void fireTreeNodesRemoved(TreeModelEvent e) { logger.debug("Firing treeNodesRemoved event "+e); Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeNodesRemoved(e); logger.debug("Sent a copy"); } }
protected void fireTreeNodesRemoved(TreeModelEvent e) { if (logger.isDebugEnabled()) logger.debug("Firing treeNodesRemoved event "+e); Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeNodesRemoved(e); logger.debug("Sent a copy"); } }
1,111,749
protected void fireTreeNodesRemoved(TreeModelEvent e) { logger.debug("Firing treeNodesRemoved event "+e); Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeNodesRemoved(e); logger.debug("Sent a copy"); } }
protected void fireTreeNodesRemoved(TreeModelEvent e) { logger.debug("Firing treeNodesRemoved event "+e); Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeNodesRemoved(e); if (logger.isDebugEnabled()) logger.debug("Sent a copy"); } }
1,111,750
public Object getChild(Object parent, int index) { try { logger.debug("DBTreeModel.getChild("+parent+","+index+"): returning "+((SQLObject) parent).getChild(index)); return ((SQLObject) parent).getChild(index); } catch (ArchitectException e) { //logger.error("Couldn't get child "+index+" of "+parent, e); //return null; throw new ArchitectRuntimeException(e); } }
public Object getChild(Object parent, int index) { try { if (logger.isDebugEnabled()) logger.debug("DBTreeModel.getChild("+parent+","+index+"): returning "+((SQLObject) parent).getChild(index)); return ((SQLObject) parent).getChild(index); } catch (ArchitectException e) { //logger.error("Couldn't get child "+index+" of "+parent, e); //return null; throw new ArchitectRuntimeException(e); } }
1,111,751
public int getChildCount(Object parent) { try { logger.debug("DBTreeModel.getChildCount("+parent+"): returning "+((SQLObject) parent).getChildCount()); return ((SQLObject) parent).getChildCount(); } catch (ArchitectException e) { //logger.error("Couldn't get child count of "+parent, e); //return -1; throw new ArchitectRuntimeException(e); } }
public int getChildCount(Object parent) { try { if (logger.isDebugEnabled()) logger.debug("DBTreeModel.getChildCount("+parent+"): returning "+((SQLObject) parent).getChildCount()); return ((SQLObject) parent).getChildCount(); } catch (ArchitectException e) { //logger.error("Couldn't get child count of "+parent, e); //return -1; throw new ArchitectRuntimeException(e); } }
1,111,752
public int getIndexOfChild(Object parent, Object child) { try { logger.debug("DBTreeModel.getIndexOfChild("+parent+","+child+"): returning "+((SQLObject) parent).getChildren().indexOf(child)); return ((SQLObject) parent).getChildren().indexOf(child); } catch (ArchitectException e) { //logger.error("Couldn't get index of child "+child, e); //return -1; throw new ArchitectRuntimeException(e); } }
public int getIndexOfChild(Object parent, Object child) { try { if (logger.isDebugEnabled()) logger.debug("DBTreeModel.getIndexOfChild("+parent+","+child+"): returning "+((SQLObject) parent).getChildren().indexOf(child)); return ((SQLObject) parent).getChildren().indexOf(child); } catch (ArchitectException e) { //logger.error("Couldn't get index of child "+child, e); //return -1; throw new ArchitectRuntimeException(e); } }
1,111,753
public Object getRoot() { logger.debug("DBTreeModel.getRoot: returning "+root); return root; }
public Object getRoot() { if (logger.isDebugEnabled()) logger.debug("DBTreeModel.getRoot: returning "+root); return root; }
1,111,754
public boolean isLeaf(Object parent) { logger.debug("DBTreeModel.isLeaf("+parent+"): returning "+!((SQLObject) parent).allowsChildren()); return !((SQLObject) parent).allowsChildren(); }
public boolean isLeaf(Object parent) { if (logger.isDebugEnabled()) logger.debug("DBTreeModel.isLeaf("+parent+"): returning "+!((SQLObject) parent).allowsChildren()); return !((SQLObject) parent).allowsChildren(); }
1,111,755
public static void load() throws Exception { List<ApplicationConfig> applications = ApplicationConfigManager.getApplications(); for(ApplicationConfig config : applications) { String appType = config.getType(); if (appType.equals("connector")) { create(config); } } }
public static void load() throws Exception { List<ApplicationConfig> applications = ApplicationConfigManager.getApplications(); for(ApplicationConfig config : applications) { String appType = config.getType(); if (appType.equals("connector")) { create(config); } } }
1,111,756
protected TagScript createStaticTag( String namespaceURI, String localName, String qName, Attributes list) throws SAXException { try { StaticTag tag = new StaticTag( namespaceURI, localName, qName); StaticTagScript script = new StaticTagScript(tag); // now iterate through through the expressions int size = list.getLength(); for (int i = 0; i < size; i++) { String attributeName = list.getLocalName(i); String attributeValue = list.getValue(i); Expression expression = CompositeExpression.parse( attributeValue, getExpressionFactory() ); script.addAttribute(attributeName, expression); } return script; } catch (Exception e) { log.warn( "Could not create static tag for URI: " + namespaceURI + " tag name: " + localName, e); throw createSAXException(e); } }
protected TagScript createStaticTag( String namespaceURI, String localName, String qName, Attributes list) throws SAXException { try { StaticTag tag = new StaticTag( namespaceURI, localName, qName); StaticTagScript script = new StaticTagScript(tag); // now iterate through through the expressions int size = list.getLength(); for (int i = 0; i < size; i++) { String attributeName = list.getLocalName(i); String attributeValue = list.getValue(i); Expression expression = CompositeExpression.parse( attributeValue, getExpressionFactory() ); script.addAttribute(attributeName, expression); } return script; } catch (Exception e) { log.warn( "Could not create static tag for URI: " + namespaceURI + " tag name: " + localName, e); throw createSAXException(e); } }
1,111,757