bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
public void doTag(XMLOutput output) throws Exception { // Try find find the body from the reserved 'org.apache.commons.jelly.body' variable Script script = (Script) context.getVariable("org.apache.commons.jelly.body"); if (script != null) { script.run(context, output); } else { // note this mechanism does not work properly for arbitrarily // nested dynamic tags. A better way is required. Tag tag = findAncestorWithClass(this, DynamicTag.class); if (tag == null) { throw new JellyException("Cannot invoke body, no dynamic tag is defined in this block"); } else { tag.getBody().run(context, output); } } }
public void doTag(XMLOutput output) throws Exception { // Try find find the body from the reserved 'org.apache.commons.jelly.body' variable Script script = (Script) context.getVariable("org.apache.commons.jelly.body"); if (script != null) { script.run(context, output); } else { // note this mechanism does not work properly for arbitrarily // nested dynamic tags. A better way is required. Tag tag = findAncestorWithClass(this, DynamicTag.class); if (tag == null) { throw new JellyException("Cannot invoke body, no dynamic tag is defined in this block"); } else { tag.invokeBody(output); } } }
1,108,599
public void doTag(final XMLOutput output) throws Exception { getGoal(getName()).addPostActionCallback( new PostActionCallback() { public void firePostAction(Goal goal) throws Exception { // lets run the body log.info( "Running post action: " + getName() ); getBody().run( context, output); } } ); }
public void doTag(final XMLOutput output) throws Exception { getGoal(getName()).addPostActionCallback( new PostActionCallback() { public void firePostAction(Goal goal) throws Exception { // lets run the body log.info( "Running post action: " + getName() ); invokeBody( output); } } ); }
1,108,600
public void firePostAction(Goal goal) throws Exception { // lets run the body log.info( "Running post action: " + getName() ); getBody().run( context, output); }
public void firePostAction(Goal goal) throws Exception { // lets run the body log.info( "Running post action: " + getName() ); invokeBody( output); }
1,108,601
HandlerContext(Command command, boolean isAuthRequired){ this.command = command; this.serviceContext = getServiceContext(command, isAuthRequired); }
HandlerContext(Command command, boolean isAuthRequired){ this.command = command; this.serviceContext = getServiceContext(command, isAuthRequired); }
1,108,602
public void writeHeader() { out.println("-- Created by SQLPower Oracle 8i/9i DDL Generator "+GENERATOR_VERSION+" --"); }
public void writeHeader() { println("-- Created by SQLPower Oracle 8i/9i DDL Generator "+GENERATOR_VERSION+" --"); }
1,108,605
public void doTag(XMLOutput output) throws Exception { String message = getBodyText(); Object expectedValue = expected.evaluate(context); Object actualValue = actual.evaluate(context); if (expectedValue == null && actualValue == null) { return; } if (actualValue != null && expectedValue.equals(actualValue)) { return; } String expressions = "\nExpected expression: " + expected.getExpressionText() + "\nActual expression: " + actual.getExpressionText(); failNotEquals(message, expectedValue, actualValue, expressions); }
public void doTag(XMLOutput output) throws JellyTagException { String message = getBodyText(); Object expectedValue = expected.evaluate(context); Object actualValue = actual.evaluate(context); if (expectedValue == null && actualValue == null) { return; } if (actualValue != null && expectedValue.equals(actualValue)) { return; } String expressions = "\nExpected expression: " + expected.getExpressionText() + "\nActual expression: " + actual.getExpressionText(); failNotEquals(message, expectedValue, actualValue, expressions); }
1,108,606
public static void writeKey(EncryptedKey encryptedKey) throws FileNotFoundException, IOException { File file = new File(KEY_FILE_PATH); if(file.exists()){ file.delete(); } file.createNewFile(); FileOutputStream fos = new FileOutputStream(file); fos.write(encryptedKey.get()); fos.flush(); fos.close(); }
public static void writeKey(EncryptedKey encryptedKey) throws FileNotFoundException, IOException { File file = new File(KEY_FILE_PATH); if(file.exists()){ file.renameTo(new File(KEY_FILE_PATH + ".bak")); } file.createNewFile(); FileOutputStream fos = new FileOutputStream(file); fos.write(encryptedKey.get()); fos.flush(); fos.close(); }
1,108,607
private boolean isRotHandleAt( int x, int y ) { int accuracy = 10; int dx = x - rotHandleX[1]; int dy = y - rotHandleY[1]; boolean isHandle = ( dx*dx + dy*dy < accuracy * accuracy ); System.err.println( "Is rot handle? " + isHandle ); return isHandle; }
private boolean isRotHandleAt( int x, int y ) { int accuracy = 10; int dx = x - rotHandleX[1]; int dy = y - rotHandleY[1]; boolean isHandle = ( dx*dx + dy*dy < accuracy * accuracy ); log.debug( "Is rot handle? " + isHandle ); return isHandle; }
1,108,609
public void mousePressed(MouseEvent mouseEvent) { if ( !drawCropped ) { // Check if we clicked on a handle handleMoving = getHandleAt( mouseEvent.getX(), mouseEvent.getY() ); System.err.println( "Moving handle " + handleMoving ); if ( handleMoving < 0 ) { isRotating = isRotHandleAt( mouseEvent.getX(), mouseEvent.getY() ); } } }
public void mousePressed(MouseEvent mouseEvent) { if ( !drawCropped ) { // Check if we clicked on a handle handleMoving = getHandleAt( mouseEvent.getX(), mouseEvent.getY() ); log.debug( "Moving handle " + handleMoving ); if ( handleMoving < 0 ) { isRotating = isRotHandleAt( mouseEvent.getX(), mouseEvent.getY() ); } } }
1,108,610
private void rotateCrop( int newx, int newy ) { // Calculate new rotation double dx = newx-imgX-cropBorderX; double dy = newy-imgY-cropBorderY; if ( Math.abs( dy ) > 0.0001 ) { cropBorderRot = -Math.atan( dx/dy ); } else { cropBorderRot = 0; } if ( dy > 0 ) { cropBorderRot += Math.PI; } System.err.println( "New rotation " + cropBorderRot ); calcCropBorderCoords(); }
private void rotateCrop( int newx, int newy ) { // Calculate new rotation double dx = newx-imgX-cropBorderX; double dy = newy-imgY-cropBorderY; if ( Math.abs( dy ) > 0.0001 ) { cropBorderRot = -Math.atan( dx/dy ); } else { cropBorderRot = 0; } if ( dy > 0 ) { cropBorderRot += Math.PI; } log.debug( "New rotation " + cropBorderRot ); calcCropBorderCoords(); }
1,108,611
public TagLibrary resolveTagLibrary(String uri) { ServiceDiscovery discovery = getServiceDiscovery(); String name = uri; if ( uri.startsWith( "jelly:" ) ) { name = "jelly." + uri.substring(6); } log.info( "Looking up service name: " + name ); ServiceInfo[] infoArray = discovery.findServices(name); if ( infoArray != null && infoArray.length > 0 ) { for (int i = 0; i < infoArray.length; i++ ) { ServiceInfo info = infoArray[i]; try { Class typeClass = info.getLoader().loadClass( info.getImplName() ); if ( typeClass != null ) { return newInstance(uri, typeClass); } } catch (Exception e) { log.error( "Could not load service: " + info.getImplName() + " with loader: " + info.getLoader() ); } } } else { log.info( "Could not find any services for name: " + name ); } return null; }
public TagLibrary resolveTagLibrary(String uri) { DiscoverClasses discovery = getDiscoverClasses(); String name = uri; if ( uri.startsWith( "jelly:" ) ) { name = "jelly." + uri.substring(6); } log.info( "Looking up service name: " + name ); ServiceInfo[] infoArray = discovery.findServices(name); if ( infoArray != null && infoArray.length > 0 ) { for (int i = 0; i < infoArray.length; i++ ) { ServiceInfo info = infoArray[i]; try { Class typeClass = info.getLoader().loadClass( info.getImplName() ); if ( typeClass != null ) { return newInstance(uri, typeClass); } } catch (Exception e) { log.error( "Could not load service: " + info.getImplName() + " with loader: " + info.getLoader() ); } } } else { log.info( "Could not find any services for name: " + name ); } return null; }
1,108,612
public TagLibrary resolveTagLibrary(String uri) { ServiceDiscovery discovery = getServiceDiscovery(); String name = uri; if ( uri.startsWith( "jelly:" ) ) { name = "jelly." + uri.substring(6); } log.info( "Looking up service name: " + name ); ServiceInfo[] infoArray = discovery.findServices(name); if ( infoArray != null && infoArray.length > 0 ) { for (int i = 0; i < infoArray.length; i++ ) { ServiceInfo info = infoArray[i]; try { Class typeClass = info.getLoader().loadClass( info.getImplName() ); if ( typeClass != null ) { return newInstance(uri, typeClass); } } catch (Exception e) { log.error( "Could not load service: " + info.getImplName() + " with loader: " + info.getLoader() ); } } } else { log.info( "Could not find any services for name: " + name ); } return null; }
public TagLibrary resolveTagLibrary(String uri) { ServiceDiscovery discovery = getServiceDiscovery(); String name = uri; if ( uri.startsWith( "jelly:" ) ) { name = "jelly." + uri.substring(6); } log.info( "Looking up service name: " + name ); ServiceInfo[] infoArray = discovery.findServices(name); if ( infoArray != null && infoArray.length > 0 ) { for (int i = 0; i < infoArray.length; i++ ) { ServiceInfo info = infoArray[i]; try { Class typeClass = info.getLoader().loadClass( info.getImplName() ); if ( typeClass != null ) { return newInstance(uri, typeClass); } } catch (Exception e) { log.error( "Could not load service: " + info.getImplName() + " with loader: " + info.getLoader() ); } } } else { log.info( "Could not find any services for name: " + name ); } return null; }
1,108,613
public TagLibrary resolveTagLibrary(String uri) { ServiceDiscovery discovery = getServiceDiscovery(); String name = uri; if ( uri.startsWith( "jelly:" ) ) { name = "jelly." + uri.substring(6); } log.info( "Looking up service name: " + name ); ServiceInfo[] infoArray = discovery.findServices(name); if ( infoArray != null && infoArray.length > 0 ) { for (int i = 0; i < infoArray.length; i++ ) { ServiceInfo info = infoArray[i]; try { Class typeClass = info.getLoader().loadClass( info.getImplName() ); if ( typeClass != null ) { return newInstance(uri, typeClass); } } catch (Exception e) { log.error( "Could not load service: " + info.getImplName() + " with loader: " + info.getLoader() ); } } } else { log.info( "Could not find any services for name: " + name ); } return null; }
public TagLibrary resolveTagLibrary(String uri) { ServiceDiscovery discovery = getServiceDiscovery(); String name = uri; if ( uri.startsWith( "jelly:" ) ) { name = "jelly." + uri.substring(6); } log.info( "Looking up service name: " + name ); ServiceInfo[] infoArray = discovery.findServices(name); if ( infoArray != null && infoArray.length > 0 ) { for (int i = 0; i < infoArray.length; i++ ) { ServiceInfo info = infoArray[i]; try { Class typeClass = info.getLoader().loadClass( info.getImplName() ); if ( typeClass != null ) { return newInstance(uri, typeClass); } } catch (Exception e) { log.error( "Could not load service: " + info.getImplName() + " with loader: " + info.getLoader() ); } } } else { log.info( "Could not find any services for name: " + name ); } return null; }
1,108,614
private ArchitectFrame() throws ArchitectException { synchronized (ArchitectFrame.class) { mainInstance = this; } setIconImage(new ImageIcon(getClass().getResource("/icons/Architect16.png")).getImage()); // close handled by window listener setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); architectSession = ArchitectSession.getInstance(); prefs = PrefsUtils.getUserPrefsNode(architectSession); init(); }
private ArchitectFrame() throws ArchitectException { synchronized (ArchitectFrame.class) { mainInstance = this; } setIconImage(new ImageIcon(getClass().getResource("/icons/Architect16.png")).getImage()); // close handled by window listener setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); architectSession = ArchitectSessionImpl.getInstance(); prefs = PrefsUtils.getUserPrefsNode(architectSession); init(); }
1,108,615
public CoreUserSettings getUserSettings() { return this.userSettings; }
public CoreUserSettings getUserSettings() { return this.userSettings; }
1,108,616
public UserSettings read(ArchitectSession session) throws IOException { logger.debug("reading UserSettings from java.util.prefs."); Preferences prefs = ArchitectFrame.getMainInstance().getPrefs(); UserSettings userSettings = new UserSettings(); int i; for (i = 0; i <= 99; i++) { String jarName = prefs.get(jarFilePrefName(i), null); logger.debug("read Jar File entry: " + jarName); if (jarName == null) { break; } logger.debug("Adding JarName: " + jarName); session.addDriverJar(jarName); } for (; i <= 99; i++) { logger.debug("Pruning dead jar entry " + i); prefs.remove(jarFilePrefName(i)); } userSettings.setPlDotIniPath(prefs.get("PL.INI.PATH", defaultHomeFile("pl.ini"))); SwingUserSettings swingUserSettings = userSettings.getSwingSettings(); swingUserSettings.setBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, prefs.getBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, false)); ETLUserSettings etlUserSettings = userSettings.getETLUserSettings(); etlUserSettings.setPowerLoaderEnginePath( prefs.get(ETLUserSettings.PROP_PL_ENGINE_PATH, "")); etlUserSettings.setETLLogPath( prefs.get(ETLUserSettings.PROP_ETL_LOG_PATH, defaultHomeFile("etl.log"))); DDLUserSettings ddlUserSettings = userSettings.getDDLUserSettings(); ddlUserSettings.setDDLLogPath(prefs.get(DDLUserSettings.PROP_DDL_LOG_PATH, defaultHomeFile("ddl.log"))); PrintUserSettings printUserSettings = userSettings.getPrintUserSettings(); printUserSettings.setDefaultPrinterName( prefs.get(PrintUserSettings.DEFAULT_PRINTER_NAME, "")); return userSettings; }
public UserSettings read(ArchitectSession session) throws IOException { logger.debug("reading UserSettings from java.util.prefs."); Preferences prefs = ArchitectFrame.getMainInstance().getPrefs(); UserSettings userSettings = new UserSettings(); int i; for (i = 0; i <= 99; i++) { String jarName = prefs.get(jarFilePrefName(i), null); logger.debug("read Jar File entry: " + jarName); if (jarName == null) { break; } logger.debug("Adding JarName: " + jarName); session.addDriverJar(jarName); } for (; i <= 99; i++) { prefs.remove(jarFilePrefName(i)); } userSettings.setPlDotIniPath(prefs.get("PL.INI.PATH", defaultHomeFile("pl.ini"))); SwingUserSettings swingUserSettings = userSettings.getSwingSettings(); swingUserSettings.setBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, prefs.getBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, false)); ETLUserSettings etlUserSettings = userSettings.getETLUserSettings(); etlUserSettings.setPowerLoaderEnginePath( prefs.get(ETLUserSettings.PROP_PL_ENGINE_PATH, "")); etlUserSettings.setETLLogPath( prefs.get(ETLUserSettings.PROP_ETL_LOG_PATH, defaultHomeFile("etl.log"))); DDLUserSettings ddlUserSettings = userSettings.getDDLUserSettings(); ddlUserSettings.setDDLLogPath(prefs.get(DDLUserSettings.PROP_DDL_LOG_PATH, defaultHomeFile("ddl.log"))); PrintUserSettings printUserSettings = userSettings.getPrintUserSettings(); printUserSettings.setDefaultPrinterName( prefs.get(PrintUserSettings.DEFAULT_PRINTER_NAME, "")); return userSettings; }
1,108,617
public void setUserSettings(CoreUserSettings argUserSettings) { this.userSettings = argUserSettings; }
public void setUserSettings(CoreUserSettings argUserSettings) { this.userSettings = argUserSettings; }
1,108,618
public HelpAction() { super("Help",ASUtils.createJLFIcon( "general/Help", "Help", ArchitectFrame.getMainInstance().getSprefs().getInt(SwingUserSettings.ICON_SIZE, 24))); putValue(AbstractAction.SHORT_DESCRIPTION, "Help"); editorPane = new JEditorPane(); editorPane.setEditable(false); editorPane.setPreferredSize(new Dimension(600,600)); editorPane.addHyperlinkListener(new Hyperactive()); //kit = (HTMLEditorKit) editorPane.createEditorKitForContentType(null); kit = new HTMLEditorKit(); editorPane.setEditorKit(kit);// doc = (HTMLDocument) kit.createDefaultDocument(); buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); homeAction = new AbstractAction("Home", ASUtils.createJLFIcon( "navigation/Home", "Help", ArchitectFrame.getMainInstance().getSprefs().getInt(SwingUserSettings.ICON_SIZE, 16)) ) { public void actionPerformed(ActionEvent evt) { try { editorPane.setPage(urlStr); history.add(urlStr); } catch (IOException e) { e.printStackTrace(); } resetButtoms(); } }; homeAction.putValue(Action.NAME, "Home"); JButton homeButton = new JButton(homeAction); buttonPanel.add(homeButton); backAction = new AbstractAction("Back", ASUtils.createJLFIcon( "navigation/Back", "Back", ArchitectFrame.getMainInstance().getSprefs().getInt(SwingUserSettings.ICON_SIZE, 16)) ) { public void actionPerformed(ActionEvent evt) { URL url = history.getBack(); if ( url == null ) return; try { editorPane.setPage(url); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } resetButtoms(); } }; backAction.putValue(Action.NAME, "Back"); JButton backButton = new JButton(backAction); buttonPanel.add(backButton); forwardAction = new AbstractAction("Forward", ASUtils.createJLFIcon( "navigation/Forward", "Forward", ArchitectFrame.getMainInstance().getSprefs().getInt(SwingUserSettings.ICON_SIZE, 16)) ) { public void actionPerformed(ActionEvent evt) { URL url = history.getForward(); if ( url == null ) return; try { editorPane.setPage(url); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } resetButtoms(); } }; forwardAction.putValue(Action.NAME, "Forward"); JButton forwardButton = new JButton(forwardAction); buttonPanel.add(forwardButton); printHelpAction = new AbstractAction("Print", ASUtils.createJLFIcon( "general/Print", "Print", ArchitectFrame.getMainInstance().getSprefs().getInt(SwingUserSettings.ICON_SIZE, 16)) ) { public void actionPerformed(ActionEvent evt) { final HelpPrintPanel printPanel = new HelpPrintPanel(editorPane); final JDialog d = ArchitectPanelBuilder.createArchitectPanelDialog( printPanel, ArchitectFrame.getMainInstance(), "Print", "Print"); d.pack(); d.setLocationRelativeTo(ArchitectFrame.getMainInstance()); d.setVisible(true); } }; printHelpAction.putValue(Action.NAME, "Print"); JButton printButton = new JButton(printHelpAction); buttonPanel.add(printButton); history = new URLHistroyList(); }
public HelpAction() { super("Help",ASUtils.createJLFIcon( "general/Help", "Help", ArchitectFrame.getMainInstance().getSprefs().getInt(SwingUserSettings.ICON_SIZE, 24))); putValue(AbstractAction.SHORT_DESCRIPTION, "Help"); editorPane = new JEditorPane(); editorPane.setEditable(false); editorPane.setPreferredSize(new Dimension(600,600)); editorPane.addHyperlinkListener(new Hyperactive()); //kit = (HTMLEditorKit) editorPane.createEditorKitForContentType(null); kit = new HTMLEditorKit(); editorPane.setEditorKit(kit);// doc = (HTMLDocument) kit.createDefaultDocument(); buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); homeAction = new AbstractAction("Home", ASUtils.createJLFIcon( "navigation/Home", "Help", ArchitectFrame.getMainInstance().getSprefs().getInt(SwingUserSettings.ICON_SIZE, 16)) ) { public void actionPerformed(ActionEvent evt) { try { editorPane.setPage(urlStr); history.add(urlStr); } catch (IOException e) { e.printStackTrace(); } resetButtoms(); } }; homeAction.putValue(Action.NAME, "Home"); JButton homeButton = new JButton(homeAction); buttonPanel.add(homeButton); backAction = new AbstractAction("Back", ASUtils.createJLFIcon( "navigation/Back", "Back", ArchitectFrame.getMainInstance().getSprefs().getInt(SwingUserSettings.ICON_SIZE, 16)) ) { public void actionPerformed(ActionEvent evt) { URL url = history.getBack(); if ( url == null ) return; try { editorPane.setPage(url); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } resetButtoms(); } }; backAction.putValue(Action.NAME, "Back"); JButton backButton = new JButton(backAction); buttonPanel.add(backButton); forwardAction = new AbstractAction("Forward", ASUtils.createJLFIcon( "navigation/Forward", "Forward", ArchitectFrame.getMainInstance().getSprefs().getInt(SwingUserSettings.ICON_SIZE, 16)) ) { public void actionPerformed(ActionEvent evt) { URL url = history.getForward(); if ( url == null ) return; try { editorPane.setPage(url); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } resetButtoms(); } }; forwardAction.putValue(Action.NAME, "Forward"); JButton forwardButton = new JButton(forwardAction); buttonPanel.add(forwardButton); printHelpAction = new AbstractAction("Print", ASUtils.createJLFIcon( "general/Print", "Print", ArchitectFrame.getMainInstance().getSprefs().getInt(SwingUserSettings.ICON_SIZE, 16)) ) { public void actionPerformed(ActionEvent evt) { final HelpPrintPanel printPanel = new HelpPrintPanel(editorPane); final JDialog d = ArchitectPanelBuilder.createArchitectPanelDialog( printPanel, ArchitectFrame.getMainInstance(), "Print", "Print"); d.pack(); d.setLocationRelativeTo(ArchitectFrame.getMainInstance()); d.setVisible(true); } }; printHelpAction.putValue(Action.NAME, "Print"); JButton printButton = new JButton(printHelpAction); buttonPanel.add(printButton); history = new URLHistroyList(); }
1,108,619
public Dimension drawHighLevelReport(Graphics2D g, Dimension pageSize) throws ArchitectException { int y = 0; for (Map.Entry<SQLTable, Collection<SQLTable>> entry : mappings.entrySet()) { SQLTable st = entry.getKey(); Collection<SQLTable> targets = entry.getValue(); if (pageSize != null) { int clusterSize = drawSourceTargetCluster(null, panes, maxSourceWidth, maxTargetWidth, y, st, targets); if ((y % pageSize.height)+(clusterSize%pageSize.height) >= pageSize.height){ y += pageSize.height - (y % pageSize.height); } } y = drawSourceTargetCluster(g, panes, maxSourceWidth, maxTargetWidth, y, st, targets); } return new Dimension(maxSourceWidth + sourceTargetGap + maxTargetWidth, y - unrelatedSourcesGap); }
public Dimension drawHighLevelReport(Graphics2D g, Dimension pageSize) throws ArchitectException { int y = 0; for (Map.Entry<SQLTable, Collection<SQLTable>> entry : mappings.entrySet()) { SQLTable st = entry.getKey(); Collection<SQLTable> targets = entry.getValue(); if (pageSize != null) { int clusterSize = drawSourceTargetCluster(null, panes, maxSourceWidth, maxTargetWidth, y, st, targets); if ((y % pageSize.height)+(clusterSize%pageSize.height) >= pageSize.height){ y += pageSize.height - (y % pageSize.height); } } y = drawSourceTargetCluster(g, panes, maxSourceWidth, maxTargetWidth, y, st, targets); } return new Dimension(maxSourceWidth + sourceTargetGap + maxTargetWidth, y ); }
1,108,620
public void setPlayPen(PlayPen newPP) { if (pp != null) { pp.removeSelectionListener(this); } pp = newPP; pp.addSelectionListener(this); }
public void setPlayPen(PlayPen newPP) throws ArchitectException { if (pp != null) { pp.removeSelectionListener(this); } pp = newPP; pp.addSelectionListener(this); }
1,108,621
public void setPlayPen(PlayPen pp) { if (pp != null) { pp.removeSelectionListener(this); } this.pp = pp; this.pp.addSelectionListener(this); }
public void setPlayPen(PlayPen pp) { if (pp != null) { pp.removeSelectionListener(this); } this.pp = pp; this.pp.addSelectionListener(this); }
1,108,623
public void setPlayPen(PlayPen pp) { if (pp != null) { pp.removeSelectionListener(this); } this.pp = pp; this.pp.addSelectionListener(this); }
public void setPlayPen(PlayPen pp) { if (pp != null) { pp.removeSelectionListener(this); } this.pp = pp; this.pp.addSelectionListener(this); }
1,108,624
public void photoCollectionChanged( PhotoCollectionChangeEvent e ) { repaint(); }
public void photoCollectionChanged( PhotoCollectionChangeEvent e ) { repaint(); }
1,108,627
public void setCollection(PhotoCollection v) { if ( photoCollection != null ) { photoCollection.removePhotoCollectionChangeListener( this ); } photoCollection = v; photoCollection.addPhotoCollectionChangeListener( this ); revalidate(); }
public void setCollection(PhotoCollection v) { if ( photoCollection != null ) { photoCollection.removePhotoCollectionChangeListener( this ); } photoCollection = v; photoCollection.addPhotoCollectionChangeListener( this ); revalidate(); }
1,108,628
public WLServerConnection(MBeanServer mbeanServer){ assert mbeanServer != null; this.mbeanServer = mbeanServer; }
public WLServerConnection(MBeanServer mbeanServer){ assert mbeanServer != null; this.mbeanServer = (RemoteMBeanServer)mbeanServer; }
1,108,629
public static void setMaxDistance(int maxDistance) { Options.maxDistance = maxDistance; }
public static void setMaxDistance(int maxDistance) { Options.maxDistance = maxDistance*1000; }
1,108,630
public void appendTo(Appendable app, FilterValues<S> values) throws IOException { mProperty.appendTo(app); app.append(' '); app.append(mOp.toString()); app.append(' '); if (values != null) { Object value = values.getValue(this); if (value != null || values.isAssigned(this)) { app.append(String.valueOf(value)); return; } } if (mBindID == BOUND_CONSTANT) { app.append(String.valueOf(mConstant)); } else { app.append('?'); /* Uncomment for testing if (mBindID != 0) { app.append('[').append(String.valueOf(mBindID)).append(']'); } */ } }
public void appendTo(Appendable app, FilterValues<S> values) throws IOException { mProperty.appendTo(app); app.append(' '); app.append(mOp.toString()); app.append(' '); if (values != null) { Object value = values.getValue(this); if (value != null || values.isAssigned(this)) { app.append(String.valueOf(value)); return; } } if (mBindID == BOUND_CONSTANT) { app.append(String.valueOf(mConstant)); } else { app.append('?'); /* Uncomment for testing if (mBindID != 0) { app.append('[').append(String.valueOf(mBindID)).append(']'); } */ } }
1,108,632
public void appendTo(Appendable app, FilterValues<S> values) throws IOException { mProperty.appendTo(app); app.append(' '); app.append(mOp.toString()); app.append(' '); if (values != null) { Object value = values.getValue(this); if (value != null || values.isAssigned(this)) { app.append(String.valueOf(value)); return; } } if (mBindID == BOUND_CONSTANT) { app.append(String.valueOf(mConstant)); } else { app.append('?'); /* Uncomment for testing if (mBindID != 0) { app.append('[').append(String.valueOf(mBindID)).append(']'); } */ } }
public void appendTo(Appendable app, FilterValues<S> values) throws IOException { mProperty.appendTo(app); app.append(' '); app.append(mOp.toString()); app.append(' '); if (values != null) { Object value = values.getValue(this); if (value != null || values.isAssigned(this)) { app.append(String.valueOf(value)); return; } } if (mBindID == BOUND_CONSTANT) { app.append(String.valueOf(mConstant)); } else { app.append('?'); /* Uncomment for testing if (mBindID != 0) { app.append('[').append(String.valueOf(mBindID)).append(']'); } } }
1,108,633
protected void writeDDLUserSettings(DDLUserSettings ddlprefs) { println("<ddl-user-settings>"); indent++; Properties props = ddlprefs.toPropList(); Iterator it = props.keySet().iterator(); while (it.hasNext()) { String prefName = (String) it.next(); println("<setting name=\""+escape(prefName) +"\" value=\""+escape(props.getProperty(prefName))+"\" />"); } indent--; println("</ddl-user-settings>"); }
protected void writeDDLUserSettings(DDLUserSettings ddlprefs) { println("<ddl-user-settings>"); indent++; Properties props = ddlprefs.toPropList(); Iterator it = props.keySet().iterator(); while (it.hasNext()) { String prefName = (String) it.next(); println("<setting name=\""+escape(prefName) +"\" value=\""+escape(props.getProperty(prefName))+"\" />"); } indent--; println("</ddl-user-settings>"); }
1,108,634
protected void writeETLUserSettings(ETLUserSettings etlprefs) { println("<etl-user-settings>"); indent++; Properties props = etlprefs.toPropList(); Iterator it = props.keySet().iterator(); while (it.hasNext()) { String prefName = (String) it.next(); println("<setting name=\""+escape(prefName) +"\" value=\""+escape(props.getProperty(prefName))+"\" />"); } indent--; println("</etl-user-settings>"); }
protected void writeETLUserSettings(ETLUserSettings etlprefs) { println("<etl-user-settings>"); indent++; Properties props = etlprefs.toPropList(); Iterator it = props.keySet().iterator(); while (it.hasNext()) { String prefName = (String) it.next(); println("<setting name=\""+escape(prefName) +"\" value=\""+escape(props.getProperty(prefName))+"\" />"); } indent--; println("</etl-user-settings>"); }
1,108,635
protected void writePrintUserSettings(PrintUserSettings printPrefs) { println("<print-user-settings>"); indent++; Properties props = printPrefs.toPropList(); Iterator it = props.keySet().iterator(); while (it.hasNext()) { String prefName = (String) it.next(); println("<setting name=\""+escape(prefName) +"\" value=\""+escape(props.getProperty(prefName))+"\" />"); } indent--; println("</print-user-settings>"); }
protected void writePrintUserSettings(PrintUserSettings printPrefs) { println("<print-user-settings>"); indent++; Properties props = printPrefs.toPropList(); Iterator it = props.keySet().iterator(); while (it.hasNext()) { String prefName = (String) it.next(); println("<setting name=\""+escape(prefName) +"\" value=\""+escape(props.getProperty(prefName))+"\" />"); } indent--; println("</print-user-settings>"); }
1,108,636
protected void writeSwingSettings(SwingUserSettings sprefs) { println("<swing-gui-settings>"); indent++; Iterator it = sprefs.getSettingNames().iterator(); while (it.hasNext()) { String prefName = (String) it.next(); Object pref = sprefs.getObject(prefName, ""); println("<setting name=\""+escape(prefName) +"\" class=\""+escape(pref.getClass().getName()) +"\" value=\""+escape(pref.toString())+"\" />"); } indent--; println("</swing-gui-settings>"); }
protected void writeSwingSettings(SwingUserSettings sprefs) { println("<swing-gui-settings>"); indent++; Iterator it = sprefs.getSettingNames().iterator(); while (it.hasNext()) { String prefName = (String) it.next(); Object pref = sprefs.getObject(prefName, ""); println("<setting name=\""+escape(prefName) +"\" class=\""+escape(pref.getClass().getName()) +"\" value=\""+escape(pref.toString())+"\" />"); } indent--; println("</swing-gui-settings>"); }
1,108,637
public List<String> getDriverJarList() { return Collections.unmodifiableList(driverJarList); }
public List<String> getDriverJarList() { return Collections.unmodifiableList(driverJarList); }
1,108,639
public XWikiStoreInterface getStore() { return store; }
public XWikiStoreInterface getStore() { return store; }
1,108,640
public String toXML(XWikiContext context) throws XWikiException { Document doc = toXMLDocument(context); return toXML(doc, context); }
public String toXML(XWikiContext context) throws XWikiException { Document doc = toXMLDocument(context); return toXML(doc, context); }
1,108,641
public XWikiDocumentArchive getDocumentArchive() { // We are using a SoftReference which will allow the archive to be // discarded by the Garbage collector as long as the context is closed (usually during the request) if (archive==null) return null; else return (XWikiDocumentArchive) archive.get(); }
public XWikiDocumentArchive getDocumentArchive() { // We are using a SoftReference which will allow the archive to be // discarded by the Garbage collector as long as the context is closed (usually during the request) if (archive==null) return null; else return (XWikiDocumentArchive) archive.get(); }
1,108,642
public void actionPerformed(ActionEvent e) { logger.debug("event was fired"); ASUtils.LabelValueBean lvb = (ASUtils.LabelValueBean) connectionsBox.getSelectedItem(); if (lvb.getValue() == null) { runPLEngine.setSelected(false); runPLEngine.setEnabled(false); plRepOwner.setText(null); plUserName.setText(null); plPassword.setText(null); } else { runPLEngine.setEnabled(true); PLConnectionSpec pldbcon = (PLConnectionSpec) lvb.getValue(); plRepOwner.setText(pldbcon.getPlsOwner()); plUserName.setText(pldbcon.getUid()); plPassword.setText(pldbcon.getPwd()); } }
public void actionPerformed(ActionEvent e) { logger.debug("event was fired"); ASUtils.LabelValueBean lvb = (ASUtils.LabelValueBean) connectionsBox.getSelectedItem(); if (lvb.getValue() == null) { runPLEngine.setSelected(false); runPLEngine.setEnabled(false); plRepOwner.setText(null); plUserName.setText(null); plPassword.setText(null); } else { runPLEngine.setEnabled(true); PLConnectionSpec pldbcon = (PLConnectionSpec) lvb.getValue(); plRepOwner.setText(pldbcon.getPlsOwner()); plUserName.setText(pldbcon.getUid()); plPassword.setText(pldbcon.getPwd()); } }
1,108,643
public void actionPerformed(ActionEvent e) { logger.debug("event was fired"); ASUtils.LabelValueBean lvb = (ASUtils.LabelValueBean) connectionsBox.getSelectedItem(); if (lvb.getValue() == null) { runPLEngine.setSelected(false); runPLEngine.setEnabled(false); plRepOwner.setText(null); plUserName.setText(null); plPassword.setText(null); } else { runPLEngine.setEnabled(true); PLConnectionSpec pldbcon = (PLConnectionSpec) lvb.getValue(); plRepOwner.setText(pldbcon.getPlsOwner()); plUserName.setText(pldbcon.getUid()); plPassword.setText(pldbcon.getPwd()); } }
public void actionPerformed(ActionEvent e) { logger.debug("event was fired"); ASUtils.LabelValueBean lvb = (ASUtils.LabelValueBean) connectionsBox.getSelectedItem(); if (lvb.getValue() == null) { runPLEngine.setSelected(false); runPLEngine.setEnabled(false); plRepOwner.setText(null); plUserName.setText(null); plPassword.setText(null); } else { runPLEngine.setEnabled(true); PLConnectionSpec pldbcon = (PLConnectionSpec) lvb.getValue(); plRepOwner.setText(pldbcon.getPlsOwner()); plUserName.setText(pldbcon.getUid()); plPassword.setText(pldbcon.getPwd()); } }
1,108,644
private void full_em_breakup( byte[][] input_haplos, int[] block_size, Vector affStatus, Vector kidAffStatus) throws HaploViewException{ int num_poss, iter; double total = 0; int block, start_locus, end_locus, biggest_block_size; int num_indivs = 0; int num_blocks = block_size.length; int num_haplos = input_haplos.length; int num_loci = input_haplos[0].length; Recovery tempRec; if (num_loci > MAXLOCI){ throw new HaploViewException("Too many loci in a single block (> "+MAXLOCI+" non-redundant)"); } //figure out the size of the biggest block biggest_block_size=block_size[0]; for (int i=1; i<num_blocks; i++) { if (block_size[i] > biggest_block_size) biggest_block_size=block_size[i]; } num_poss = two_n[biggest_block_size]; data = new OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) data[i]= new OBS(); superdata = new SUPER_OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) superdata[i]= new SUPER_OBS(num_blocks); double[][] hprob = new double[num_blocks][num_poss]; int[][] hlist = new int[num_blocks][num_poss]; int[] num_hlist = new int[num_blocks]; int[] hint = new int[num_poss]; double[] prob = new double[num_poss]; /*MapWrap probMap = new MapWrap(PSEUDOCOUNT);*/ /* for trio option */ if (Options.getAssocTest() == ASSOC_TRIO) { ambighet = new int[(num_haplos/4)][num_loci]; store_dhet_status(num_haplos,num_loci,input_haplos); } end_locus=-1; //now we loop through the blocks for (block=0; block<num_blocks; block++) { start_locus=end_locus+1; end_locus=start_locus+block_size[block]-1; num_poss=two_n[block_size[block]]; //read_observations initializes the values in data[] (array of OBS) num_indivs=read_observations(num_haplos,num_loci,input_haplos,start_locus,end_locus); prob = estimateProbsSmall(num_indivs,num_poss); int m=0; for(long j=0;j<num_poss; j++){ hint[(int)j]=-1; //if (probMap.get(new Long(j)) > .001) { if(prob[((int) j)] > .001) { // printf("haplo %s p = %.4lf\n",haplo_str(j,block_size[block]),prob[j]); hlist[block][m]=(int)j; /*hprob[block][m]=probMap.get(new Long(j));*/ hprob[block][m] = prob[((int) j)]; hint[(int)j]=m; m++; } } num_hlist[block]=m; // store current block results in super obs structure store_block_haplos(hlist, hprob, hint, block, num_indivs); } /* for each block */ double poss_full=1; for (block=0; block<num_blocks; block++) { poss_full *= num_hlist[block]; } /* LIGATE and finish this mess :) */ create_super_haplos(num_indivs,num_blocks,num_hlist); if(poss_full < Integer.MAX_VALUE) { finishLarge(num_indivs, poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); }else { finishSmall(num_indivs,(int) poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); } if(Options.getAssocTest() == ASSOC_TRIO) { kidConsistentCache = new boolean[numFilteredTrios][][]; for(int i=0;i<numFilteredTrios*2;i+=2) { if (((Integer)kidAffStatus.elementAt(i)).intValue() == 2){ kidConsistentCache[i/2] = new boolean[superdata[i].nsuper][]; for (int n=0; n<superdata[i].nsuper; n++) { kidConsistentCache[i/2][n] = new boolean[superdata[i+1].nsuper]; for (int m=0; m<superdata[i+1].nsuper; m++) { kidConsistentCache[i/2][n][m] = kid_consistent(superdata[i].superposs[n].h1, superdata[i+1].superposs[m].h1,num_blocks, block_size,hlist,num_hlist,i/2,num_loci); } } } } } realAffectedStatus = affStatus; doAssociationTests(affStatus, null, kidAffStatus); /* if (dump_phased_haplos) { if ((fpdump=fopen("emphased.haps","w"))!=NULL) { for (i=0; i<num_indivs; i++) { best=0; for (k=0; k<superdata[i].nsuper; k++) { if (superdata[i].superposs[k].p > superdata[i].superposs[best].p) { best=k; } } h1 = superdata[i].superposs[best].h1; h2 = superdata[i].superposs[best].h2; fprintf(fpdump,"%s\n",decode_haplo_str(h1,num_blocks,block_size,hlist,num_hlist)); fprintf(fpdump,"%s\n",decode_haplo_str(h2,num_blocks,block_size,hlist,num_hlist)); } fclose(fpdump); } } */ //return 0; }
private void full_em_breakup( byte[][] input_haplos, int[] block_size, Vector affStatus, Vector kidAffStatus) throws HaploViewException{ int num_poss, iter; double total = 0; int block, start_locus, end_locus, biggest_block_size; int num_indivs = 0; int num_blocks = block_size.length; int num_haplos = input_haplos.length; int num_loci = input_haplos[0].length; Recovery tempRec; if (num_loci > MAXLOCI){ throw new HaploViewException("Too many loci in a single block (> "+MAXLOCI+" non-redundant)"); } //figure out the size of the biggest block biggest_block_size=block_size[0]; for (int i=1; i<num_blocks; i++) { if (block_size[i] > biggest_block_size) biggest_block_size=block_size[i]; } num_poss = two_n[biggest_block_size]; data = new OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) data[i]= new OBS(); superdata = new SUPER_OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) superdata[i]= new SUPER_OBS(num_blocks); double[][] hprob = new double[num_blocks][num_poss]; int[][] hlist = new int[num_blocks][num_poss]; int[] num_hlist = new int[num_blocks]; int[] hint = new int[num_poss]; MapWrap probMap = new MapWrap(PSEUDOCOUNT); /*MapWrap probMap = new MapWrap(PSEUDOCOUNT);*/ /* for trio option */ if (Options.getAssocTest() == ASSOC_TRIO) { ambighet = new int[(num_haplos/4)][num_loci]; store_dhet_status(num_haplos,num_loci,input_haplos); } end_locus=-1; //now we loop through the blocks for (block=0; block<num_blocks; block++) { start_locus=end_locus+1; end_locus=start_locus+block_size[block]-1; num_poss=two_n[block_size[block]]; //read_observations initializes the values in data[] (array of OBS) num_indivs=read_observations(num_haplos,num_loci,input_haplos,start_locus,end_locus); prob = estimateProbsSmall(num_indivs,num_poss); int m=0; for(long j=0;j<num_poss; j++){ hint[(int)j]=-1; //if (probMap.get(new Long(j)) > .001) { if(prob[((int) j)] > .001) { // printf("haplo %s p = %.4lf\n",haplo_str(j,block_size[block]),prob[j]); hlist[block][m]=(int)j; /*hprob[block][m]=probMap.get(new Long(j));*/ hprob[block][m] = prob[((int) j)]; hint[(int)j]=m; m++; } } num_hlist[block]=m; // store current block results in super obs structure store_block_haplos(hlist, hprob, hint, block, num_indivs); } /* for each block */ double poss_full=1; for (block=0; block<num_blocks; block++) { poss_full *= num_hlist[block]; } /* LIGATE and finish this mess :) */ create_super_haplos(num_indivs,num_blocks,num_hlist); if(poss_full < Integer.MAX_VALUE) { finishLarge(num_indivs, poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); }else { finishSmall(num_indivs,(int) poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); } if(Options.getAssocTest() == ASSOC_TRIO) { kidConsistentCache = new boolean[numFilteredTrios][][]; for(int i=0;i<numFilteredTrios*2;i+=2) { if (((Integer)kidAffStatus.elementAt(i)).intValue() == 2){ kidConsistentCache[i/2] = new boolean[superdata[i].nsuper][]; for (int n=0; n<superdata[i].nsuper; n++) { kidConsistentCache[i/2][n] = new boolean[superdata[i+1].nsuper]; for (int m=0; m<superdata[i+1].nsuper; m++) { kidConsistentCache[i/2][n][m] = kid_consistent(superdata[i].superposs[n].h1, superdata[i+1].superposs[m].h1,num_blocks, block_size,hlist,num_hlist,i/2,num_loci); } } } } } realAffectedStatus = affStatus; doAssociationTests(affStatus, null, kidAffStatus); /* if (dump_phased_haplos) { if ((fpdump=fopen("emphased.haps","w"))!=NULL) { for (i=0; i<num_indivs; i++) { best=0; for (k=0; k<superdata[i].nsuper; k++) { if (superdata[i].superposs[k].p > superdata[i].superposs[best].p) { best=k; } } h1 = superdata[i].superposs[best].h1; h2 = superdata[i].superposs[best].h2; fprintf(fpdump,"%s\n",decode_haplo_str(h1,num_blocks,block_size,hlist,num_hlist)); fprintf(fpdump,"%s\n",decode_haplo_str(h2,num_blocks,block_size,hlist,num_hlist)); } fclose(fpdump); } } */ //return 0; }
1,108,645
private void full_em_breakup( byte[][] input_haplos, int[] block_size, Vector affStatus, Vector kidAffStatus) throws HaploViewException{ int num_poss, iter; double total = 0; int block, start_locus, end_locus, biggest_block_size; int num_indivs = 0; int num_blocks = block_size.length; int num_haplos = input_haplos.length; int num_loci = input_haplos[0].length; Recovery tempRec; if (num_loci > MAXLOCI){ throw new HaploViewException("Too many loci in a single block (> "+MAXLOCI+" non-redundant)"); } //figure out the size of the biggest block biggest_block_size=block_size[0]; for (int i=1; i<num_blocks; i++) { if (block_size[i] > biggest_block_size) biggest_block_size=block_size[i]; } num_poss = two_n[biggest_block_size]; data = new OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) data[i]= new OBS(); superdata = new SUPER_OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) superdata[i]= new SUPER_OBS(num_blocks); double[][] hprob = new double[num_blocks][num_poss]; int[][] hlist = new int[num_blocks][num_poss]; int[] num_hlist = new int[num_blocks]; int[] hint = new int[num_poss]; double[] prob = new double[num_poss]; /*MapWrap probMap = new MapWrap(PSEUDOCOUNT);*/ /* for trio option */ if (Options.getAssocTest() == ASSOC_TRIO) { ambighet = new int[(num_haplos/4)][num_loci]; store_dhet_status(num_haplos,num_loci,input_haplos); } end_locus=-1; //now we loop through the blocks for (block=0; block<num_blocks; block++) { start_locus=end_locus+1; end_locus=start_locus+block_size[block]-1; num_poss=two_n[block_size[block]]; //read_observations initializes the values in data[] (array of OBS) num_indivs=read_observations(num_haplos,num_loci,input_haplos,start_locus,end_locus); prob = estimateProbsSmall(num_indivs,num_poss); int m=0; for(long j=0;j<num_poss; j++){ hint[(int)j]=-1; //if (probMap.get(new Long(j)) > .001) { if(prob[((int) j)] > .001) { // printf("haplo %s p = %.4lf\n",haplo_str(j,block_size[block]),prob[j]); hlist[block][m]=(int)j; /*hprob[block][m]=probMap.get(new Long(j));*/ hprob[block][m] = prob[((int) j)]; hint[(int)j]=m; m++; } } num_hlist[block]=m; // store current block results in super obs structure store_block_haplos(hlist, hprob, hint, block, num_indivs); } /* for each block */ double poss_full=1; for (block=0; block<num_blocks; block++) { poss_full *= num_hlist[block]; } /* LIGATE and finish this mess :) */ create_super_haplos(num_indivs,num_blocks,num_hlist); if(poss_full < Integer.MAX_VALUE) { finishLarge(num_indivs, poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); }else { finishSmall(num_indivs,(int) poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); } if(Options.getAssocTest() == ASSOC_TRIO) { kidConsistentCache = new boolean[numFilteredTrios][][]; for(int i=0;i<numFilteredTrios*2;i+=2) { if (((Integer)kidAffStatus.elementAt(i)).intValue() == 2){ kidConsistentCache[i/2] = new boolean[superdata[i].nsuper][]; for (int n=0; n<superdata[i].nsuper; n++) { kidConsistentCache[i/2][n] = new boolean[superdata[i+1].nsuper]; for (int m=0; m<superdata[i+1].nsuper; m++) { kidConsistentCache[i/2][n][m] = kid_consistent(superdata[i].superposs[n].h1, superdata[i+1].superposs[m].h1,num_blocks, block_size,hlist,num_hlist,i/2,num_loci); } } } } } realAffectedStatus = affStatus; doAssociationTests(affStatus, null, kidAffStatus); /* if (dump_phased_haplos) { if ((fpdump=fopen("emphased.haps","w"))!=NULL) { for (i=0; i<num_indivs; i++) { best=0; for (k=0; k<superdata[i].nsuper; k++) { if (superdata[i].superposs[k].p > superdata[i].superposs[best].p) { best=k; } } h1 = superdata[i].superposs[best].h1; h2 = superdata[i].superposs[best].h2; fprintf(fpdump,"%s\n",decode_haplo_str(h1,num_blocks,block_size,hlist,num_hlist)); fprintf(fpdump,"%s\n",decode_haplo_str(h2,num_blocks,block_size,hlist,num_hlist)); } fclose(fpdump); } } */ //return 0; }
private void full_em_breakup( byte[][] input_haplos, int[] block_size, Vector affStatus, Vector kidAffStatus) throws HaploViewException{ int num_poss, iter; double total = 0; int block, start_locus, end_locus, biggest_block_size; int num_indivs = 0; int num_blocks = block_size.length; int num_haplos = input_haplos.length; int num_loci = input_haplos[0].length; Recovery tempRec; if (num_loci > MAXLOCI){ throw new HaploViewException("Too many loci in a single block (> "+MAXLOCI+" non-redundant)"); } //figure out the size of the biggest block biggest_block_size=block_size[0]; for (int i=1; i<num_blocks; i++) { if (block_size[i] > biggest_block_size) biggest_block_size=block_size[i]; } num_poss = two_n[biggest_block_size]; data = new OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) data[i]= new OBS(); superdata = new SUPER_OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) superdata[i]= new SUPER_OBS(num_blocks); double[][] hprob = new double[num_blocks][num_poss]; int[][] hlist = new int[num_blocks][num_poss]; int[] num_hlist = new int[num_blocks]; int[] hint = new int[num_poss]; double[] prob = new double[num_poss]; /*MapWrap probMap = new MapWrap(PSEUDOCOUNT);*/ /* for trio option */ if (Options.getAssocTest() == ASSOC_TRIO) { ambighet = new int[(num_haplos/4)][num_loci]; store_dhet_status(num_haplos,num_loci,input_haplos); } end_locus=-1; //now we loop through the blocks for (block=0; block<num_blocks; block++) { start_locus=end_locus+1; end_locus=start_locus+block_size[block]-1; num_poss=two_n[block_size[block]]; //read_observations initializes the values in data[] (array of OBS) num_indivs=read_observations(num_haplos,num_loci,input_haplos,start_locus,end_locus); total=(double)num_poss; total *= PSEUDOCOUNT; for (int i=0; i<num_indivs; i++) { if (data[i].nposs==1) { tempRec = (Recovery)data[i].poss.elementAt(0); probMap.put(new Long(tempRec.h1), probMap.get(new Long(tempRec.h1)) + 1.0); probMap.put(new Long(tempRec.h2), probMap.get(new Long(tempRec.h2)) + 1.0); total+=2.0; } } probMap.normalize(total); iter=0; while (iter<20) { for (int i=0; i<num_indivs; i++) { total=0.0; for (int k=0; k<data[i].nposs; k++) { tempRec = (Recovery) data[i].poss.elementAt(k); tempRec.p = (float)(probMap.get(new Long(tempRec.h1))*probMap.get(new Long(tempRec.h2))); total+=tempRec.p; } for (int k=0; k<data[i].nposs; k++) { tempRec = (Recovery) data[i].poss.elementAt(k); tempRec.p /= total; } } probMap = new MapWrap(1e-10); total=num_poss*1e-10; for (int i=0; i<num_indivs; i++) { for (int k=0; k<data[i].nposs; k++) { tempRec = (Recovery) data[i].poss.elementAt(k); probMap.put(new Long(tempRec.h1),probMap.get(new Long(tempRec.h1)) + tempRec.p); probMap.put(new Long(tempRec.h2),probMap.get(new Long(tempRec.h2)) + tempRec.p); total+=(2.0*(tempRec.p)); } } probMap.normalize(total); iter++; } int m=0; for(long j=0;j<num_poss; j++){ hint[(int)j]=-1; //if (probMap.get(new Long(j)) > .001) { if(prob[((int) j)] > .001) { // printf("haplo %s p = %.4lf\n",haplo_str(j,block_size[block]),prob[j]); hlist[block][m]=(int)j; /*hprob[block][m]=probMap.get(new Long(j));*/ hprob[block][m] = prob[((int) j)]; hint[(int)j]=m; m++; } } num_hlist[block]=m; // store current block results in super obs structure store_block_haplos(hlist, hprob, hint, block, num_indivs); } /* for each block */ double poss_full=1; for (block=0; block<num_blocks; block++) { poss_full *= num_hlist[block]; } /* LIGATE and finish this mess :) */ create_super_haplos(num_indivs,num_blocks,num_hlist); if(poss_full < Integer.MAX_VALUE) { finishLarge(num_indivs, poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); }else { finishSmall(num_indivs,(int) poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); } if(Options.getAssocTest() == ASSOC_TRIO) { kidConsistentCache = new boolean[numFilteredTrios][][]; for(int i=0;i<numFilteredTrios*2;i+=2) { if (((Integer)kidAffStatus.elementAt(i)).intValue() == 2){ kidConsistentCache[i/2] = new boolean[superdata[i].nsuper][]; for (int n=0; n<superdata[i].nsuper; n++) { kidConsistentCache[i/2][n] = new boolean[superdata[i+1].nsuper]; for (int m=0; m<superdata[i+1].nsuper; m++) { kidConsistentCache[i/2][n][m] = kid_consistent(superdata[i].superposs[n].h1, superdata[i+1].superposs[m].h1,num_blocks, block_size,hlist,num_hlist,i/2,num_loci); } } } } } realAffectedStatus = affStatus; doAssociationTests(affStatus, null, kidAffStatus); /* if (dump_phased_haplos) { if ((fpdump=fopen("emphased.haps","w"))!=NULL) { for (i=0; i<num_indivs; i++) { best=0; for (k=0; k<superdata[i].nsuper; k++) { if (superdata[i].superposs[k].p > superdata[i].superposs[best].p) { best=k; } } h1 = superdata[i].superposs[best].h1; h2 = superdata[i].superposs[best].h2; fprintf(fpdump,"%s\n",decode_haplo_str(h1,num_blocks,block_size,hlist,num_hlist)); fprintf(fpdump,"%s\n",decode_haplo_str(h2,num_blocks,block_size,hlist,num_hlist)); } fclose(fpdump); } } */ //return 0; }
1,108,646
private void full_em_breakup( byte[][] input_haplos, int[] block_size, Vector affStatus, Vector kidAffStatus) throws HaploViewException{ int num_poss, iter; double total = 0; int block, start_locus, end_locus, biggest_block_size; int num_indivs = 0; int num_blocks = block_size.length; int num_haplos = input_haplos.length; int num_loci = input_haplos[0].length; Recovery tempRec; if (num_loci > MAXLOCI){ throw new HaploViewException("Too many loci in a single block (> "+MAXLOCI+" non-redundant)"); } //figure out the size of the biggest block biggest_block_size=block_size[0]; for (int i=1; i<num_blocks; i++) { if (block_size[i] > biggest_block_size) biggest_block_size=block_size[i]; } num_poss = two_n[biggest_block_size]; data = new OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) data[i]= new OBS(); superdata = new SUPER_OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) superdata[i]= new SUPER_OBS(num_blocks); double[][] hprob = new double[num_blocks][num_poss]; int[][] hlist = new int[num_blocks][num_poss]; int[] num_hlist = new int[num_blocks]; int[] hint = new int[num_poss]; double[] prob = new double[num_poss]; /*MapWrap probMap = new MapWrap(PSEUDOCOUNT);*/ /* for trio option */ if (Options.getAssocTest() == ASSOC_TRIO) { ambighet = new int[(num_haplos/4)][num_loci]; store_dhet_status(num_haplos,num_loci,input_haplos); } end_locus=-1; //now we loop through the blocks for (block=0; block<num_blocks; block++) { start_locus=end_locus+1; end_locus=start_locus+block_size[block]-1; num_poss=two_n[block_size[block]]; //read_observations initializes the values in data[] (array of OBS) num_indivs=read_observations(num_haplos,num_loci,input_haplos,start_locus,end_locus); prob = estimateProbsSmall(num_indivs,num_poss); int m=0; for(long j=0;j<num_poss; j++){ hint[(int)j]=-1; //if (probMap.get(new Long(j)) > .001) { if(prob[((int) j)] > .001) { // printf("haplo %s p = %.4lf\n",haplo_str(j,block_size[block]),prob[j]); hlist[block][m]=(int)j; /*hprob[block][m]=probMap.get(new Long(j));*/ hprob[block][m] = prob[((int) j)]; hint[(int)j]=m; m++; } } num_hlist[block]=m; // store current block results in super obs structure store_block_haplos(hlist, hprob, hint, block, num_indivs); } /* for each block */ double poss_full=1; for (block=0; block<num_blocks; block++) { poss_full *= num_hlist[block]; } /* LIGATE and finish this mess :) */ create_super_haplos(num_indivs,num_blocks,num_hlist); if(poss_full < Integer.MAX_VALUE) { finishLarge(num_indivs, poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); }else { finishSmall(num_indivs,(int) poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); } if(Options.getAssocTest() == ASSOC_TRIO) { kidConsistentCache = new boolean[numFilteredTrios][][]; for(int i=0;i<numFilteredTrios*2;i+=2) { if (((Integer)kidAffStatus.elementAt(i)).intValue() == 2){ kidConsistentCache[i/2] = new boolean[superdata[i].nsuper][]; for (int n=0; n<superdata[i].nsuper; n++) { kidConsistentCache[i/2][n] = new boolean[superdata[i+1].nsuper]; for (int m=0; m<superdata[i+1].nsuper; m++) { kidConsistentCache[i/2][n][m] = kid_consistent(superdata[i].superposs[n].h1, superdata[i+1].superposs[m].h1,num_blocks, block_size,hlist,num_hlist,i/2,num_loci); } } } } } realAffectedStatus = affStatus; doAssociationTests(affStatus, null, kidAffStatus); /* if (dump_phased_haplos) { if ((fpdump=fopen("emphased.haps","w"))!=NULL) { for (i=0; i<num_indivs; i++) { best=0; for (k=0; k<superdata[i].nsuper; k++) { if (superdata[i].superposs[k].p > superdata[i].superposs[best].p) { best=k; } } h1 = superdata[i].superposs[best].h1; h2 = superdata[i].superposs[best].h2; fprintf(fpdump,"%s\n",decode_haplo_str(h1,num_blocks,block_size,hlist,num_hlist)); fprintf(fpdump,"%s\n",decode_haplo_str(h2,num_blocks,block_size,hlist,num_hlist)); } fclose(fpdump); } } */ //return 0; }
private void full_em_breakup( byte[][] input_haplos, int[] block_size, Vector affStatus, Vector kidAffStatus) throws HaploViewException{ int num_poss, iter; double total = 0; int block, start_locus, end_locus, biggest_block_size; int num_indivs = 0; int num_blocks = block_size.length; int num_haplos = input_haplos.length; int num_loci = input_haplos[0].length; Recovery tempRec; if (num_loci > MAXLOCI){ throw new HaploViewException("Too many loci in a single block (> "+MAXLOCI+" non-redundant)"); } //figure out the size of the biggest block biggest_block_size=block_size[0]; for (int i=1; i<num_blocks; i++) { if (block_size[i] > biggest_block_size) biggest_block_size=block_size[i]; } num_poss = two_n[biggest_block_size]; data = new OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) data[i]= new OBS(); superdata = new SUPER_OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) superdata[i]= new SUPER_OBS(num_blocks); double[][] hprob = new double[num_blocks][num_poss]; int[][] hlist = new int[num_blocks][num_poss]; int[] num_hlist = new int[num_blocks]; int[] hint = new int[num_poss]; double[] prob = new double[num_poss]; /*MapWrap probMap = new MapWrap(PSEUDOCOUNT);*/ /* for trio option */ if (Options.getAssocTest() == ASSOC_TRIO) { ambighet = new int[(num_haplos/4)][num_loci]; store_dhet_status(num_haplos,num_loci,input_haplos); } end_locus=-1; //now we loop through the blocks for (block=0; block<num_blocks; block++) { start_locus=end_locus+1; end_locus=start_locus+block_size[block]-1; num_poss=two_n[block_size[block]]; //read_observations initializes the values in data[] (array of OBS) num_indivs=read_observations(num_haplos,num_loci,input_haplos,start_locus,end_locus); prob = estimateProbsSmall(num_indivs,num_poss); int m=0; for(long j=0;j<num_poss; j++){ hint[(int)j]=-1; //if (probMap.get(new Long(j)) > .001) { if (probMap.get(new Long(j)) > .001) { // printf("haplo %s p = %.4lf\n",haplo_str(j,block_size[block]),prob[j]); hlist[block][m]=(int)j; /*hprob[block][m]=probMap.get(new Long(j));*/ hprob[block][m] = prob[((int) j)]; hint[(int)j]=m; m++; } } num_hlist[block]=m; // store current block results in super obs structure store_block_haplos(hlist, hprob, hint, block, num_indivs); } /* for each block */ double poss_full=1; for (block=0; block<num_blocks; block++) { poss_full *= num_hlist[block]; } /* LIGATE and finish this mess :) */ create_super_haplos(num_indivs,num_blocks,num_hlist); if(poss_full < Integer.MAX_VALUE) { finishLarge(num_indivs, poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); }else { finishSmall(num_indivs,(int) poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); } if(Options.getAssocTest() == ASSOC_TRIO) { kidConsistentCache = new boolean[numFilteredTrios][][]; for(int i=0;i<numFilteredTrios*2;i+=2) { if (((Integer)kidAffStatus.elementAt(i)).intValue() == 2){ kidConsistentCache[i/2] = new boolean[superdata[i].nsuper][]; for (int n=0; n<superdata[i].nsuper; n++) { kidConsistentCache[i/2][n] = new boolean[superdata[i+1].nsuper]; for (int m=0; m<superdata[i+1].nsuper; m++) { kidConsistentCache[i/2][n][m] = kid_consistent(superdata[i].superposs[n].h1, superdata[i+1].superposs[m].h1,num_blocks, block_size,hlist,num_hlist,i/2,num_loci); } } } } } realAffectedStatus = affStatus; doAssociationTests(affStatus, null, kidAffStatus); /* if (dump_phased_haplos) { if ((fpdump=fopen("emphased.haps","w"))!=NULL) { for (i=0; i<num_indivs; i++) { best=0; for (k=0; k<superdata[i].nsuper; k++) { if (superdata[i].superposs[k].p > superdata[i].superposs[best].p) { best=k; } } h1 = superdata[i].superposs[best].h1; h2 = superdata[i].superposs[best].h2; fprintf(fpdump,"%s\n",decode_haplo_str(h1,num_blocks,block_size,hlist,num_hlist)); fprintf(fpdump,"%s\n",decode_haplo_str(h2,num_blocks,block_size,hlist,num_hlist)); } fclose(fpdump); } } */ //return 0; }
1,108,647
private void full_em_breakup( byte[][] input_haplos, int[] block_size, Vector affStatus, Vector kidAffStatus) throws HaploViewException{ int num_poss, iter; double total = 0; int block, start_locus, end_locus, biggest_block_size; int num_indivs = 0; int num_blocks = block_size.length; int num_haplos = input_haplos.length; int num_loci = input_haplos[0].length; Recovery tempRec; if (num_loci > MAXLOCI){ throw new HaploViewException("Too many loci in a single block (> "+MAXLOCI+" non-redundant)"); } //figure out the size of the biggest block biggest_block_size=block_size[0]; for (int i=1; i<num_blocks; i++) { if (block_size[i] > biggest_block_size) biggest_block_size=block_size[i]; } num_poss = two_n[biggest_block_size]; data = new OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) data[i]= new OBS(); superdata = new SUPER_OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) superdata[i]= new SUPER_OBS(num_blocks); double[][] hprob = new double[num_blocks][num_poss]; int[][] hlist = new int[num_blocks][num_poss]; int[] num_hlist = new int[num_blocks]; int[] hint = new int[num_poss]; double[] prob = new double[num_poss]; /*MapWrap probMap = new MapWrap(PSEUDOCOUNT);*/ /* for trio option */ if (Options.getAssocTest() == ASSOC_TRIO) { ambighet = new int[(num_haplos/4)][num_loci]; store_dhet_status(num_haplos,num_loci,input_haplos); } end_locus=-1; //now we loop through the blocks for (block=0; block<num_blocks; block++) { start_locus=end_locus+1; end_locus=start_locus+block_size[block]-1; num_poss=two_n[block_size[block]]; //read_observations initializes the values in data[] (array of OBS) num_indivs=read_observations(num_haplos,num_loci,input_haplos,start_locus,end_locus); prob = estimateProbsSmall(num_indivs,num_poss); int m=0; for(long j=0;j<num_poss; j++){ hint[(int)j]=-1; //if (probMap.get(new Long(j)) > .001) { if(prob[((int) j)] > .001) { // printf("haplo %s p = %.4lf\n",haplo_str(j,block_size[block]),prob[j]); hlist[block][m]=(int)j; /*hprob[block][m]=probMap.get(new Long(j));*/ hprob[block][m] = prob[((int) j)]; hint[(int)j]=m; m++; } } num_hlist[block]=m; // store current block results in super obs structure store_block_haplos(hlist, hprob, hint, block, num_indivs); } /* for each block */ double poss_full=1; for (block=0; block<num_blocks; block++) { poss_full *= num_hlist[block]; } /* LIGATE and finish this mess :) */ create_super_haplos(num_indivs,num_blocks,num_hlist); if(poss_full < Integer.MAX_VALUE) { finishLarge(num_indivs, poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); }else { finishSmall(num_indivs,(int) poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); } if(Options.getAssocTest() == ASSOC_TRIO) { kidConsistentCache = new boolean[numFilteredTrios][][]; for(int i=0;i<numFilteredTrios*2;i+=2) { if (((Integer)kidAffStatus.elementAt(i)).intValue() == 2){ kidConsistentCache[i/2] = new boolean[superdata[i].nsuper][]; for (int n=0; n<superdata[i].nsuper; n++) { kidConsistentCache[i/2][n] = new boolean[superdata[i+1].nsuper]; for (int m=0; m<superdata[i+1].nsuper; m++) { kidConsistentCache[i/2][n][m] = kid_consistent(superdata[i].superposs[n].h1, superdata[i+1].superposs[m].h1,num_blocks, block_size,hlist,num_hlist,i/2,num_loci); } } } } } realAffectedStatus = affStatus; doAssociationTests(affStatus, null, kidAffStatus); /* if (dump_phased_haplos) { if ((fpdump=fopen("emphased.haps","w"))!=NULL) { for (i=0; i<num_indivs; i++) { best=0; for (k=0; k<superdata[i].nsuper; k++) { if (superdata[i].superposs[k].p > superdata[i].superposs[best].p) { best=k; } } h1 = superdata[i].superposs[best].h1; h2 = superdata[i].superposs[best].h2; fprintf(fpdump,"%s\n",decode_haplo_str(h1,num_blocks,block_size,hlist,num_hlist)); fprintf(fpdump,"%s\n",decode_haplo_str(h2,num_blocks,block_size,hlist,num_hlist)); } fclose(fpdump); } } */ //return 0; }
private void full_em_breakup( byte[][] input_haplos, int[] block_size, Vector affStatus, Vector kidAffStatus) throws HaploViewException{ int num_poss, iter; double total = 0; int block, start_locus, end_locus, biggest_block_size; int num_indivs = 0; int num_blocks = block_size.length; int num_haplos = input_haplos.length; int num_loci = input_haplos[0].length; Recovery tempRec; if (num_loci > MAXLOCI){ throw new HaploViewException("Too many loci in a single block (> "+MAXLOCI+" non-redundant)"); } //figure out the size of the biggest block biggest_block_size=block_size[0]; for (int i=1; i<num_blocks; i++) { if (block_size[i] > biggest_block_size) biggest_block_size=block_size[i]; } num_poss = two_n[biggest_block_size]; data = new OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) data[i]= new OBS(); superdata = new SUPER_OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) superdata[i]= new SUPER_OBS(num_blocks); double[][] hprob = new double[num_blocks][num_poss]; int[][] hlist = new int[num_blocks][num_poss]; int[] num_hlist = new int[num_blocks]; int[] hint = new int[num_poss]; double[] prob = new double[num_poss]; /*MapWrap probMap = new MapWrap(PSEUDOCOUNT);*/ /* for trio option */ if (Options.getAssocTest() == ASSOC_TRIO) { ambighet = new int[(num_haplos/4)][num_loci]; store_dhet_status(num_haplos,num_loci,input_haplos); } end_locus=-1; //now we loop through the blocks for (block=0; block<num_blocks; block++) { start_locus=end_locus+1; end_locus=start_locus+block_size[block]-1; num_poss=two_n[block_size[block]]; //read_observations initializes the values in data[] (array of OBS) num_indivs=read_observations(num_haplos,num_loci,input_haplos,start_locus,end_locus); prob = estimateProbsSmall(num_indivs,num_poss); int m=0; for(long j=0;j<num_poss; j++){ hint[(int)j]=-1; //if (probMap.get(new Long(j)) > .001) { if(prob[((int) j)] > .001) { // printf("haplo %s p = %.4lf\n",haplo_str(j,block_size[block]),prob[j]); hlist[block][m]=(int)j; /*hprob[block][m]=probMap.get(new Long(j));*/ hprob[block][m]=probMap.get(new Long(j)); hint[(int)j]=m; m++; } } num_hlist[block]=m; // store current block results in super obs structure store_block_haplos(hlist, hprob, hint, block, num_indivs); } /* for each block */ double poss_full=1; for (block=0; block<num_blocks; block++) { poss_full *= num_hlist[block]; } /* LIGATE and finish this mess :) */ create_super_haplos(num_indivs,num_blocks,num_hlist); if(poss_full < Integer.MAX_VALUE) { finishLarge(num_indivs, poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); }else { finishSmall(num_indivs,(int) poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); } if(Options.getAssocTest() == ASSOC_TRIO) { kidConsistentCache = new boolean[numFilteredTrios][][]; for(int i=0;i<numFilteredTrios*2;i+=2) { if (((Integer)kidAffStatus.elementAt(i)).intValue() == 2){ kidConsistentCache[i/2] = new boolean[superdata[i].nsuper][]; for (int n=0; n<superdata[i].nsuper; n++) { kidConsistentCache[i/2][n] = new boolean[superdata[i+1].nsuper]; for (int m=0; m<superdata[i+1].nsuper; m++) { kidConsistentCache[i/2][n][m] = kid_consistent(superdata[i].superposs[n].h1, superdata[i+1].superposs[m].h1,num_blocks, block_size,hlist,num_hlist,i/2,num_loci); } } } } } realAffectedStatus = affStatus; doAssociationTests(affStatus, null, kidAffStatus); /* if (dump_phased_haplos) { if ((fpdump=fopen("emphased.haps","w"))!=NULL) { for (i=0; i<num_indivs; i++) { best=0; for (k=0; k<superdata[i].nsuper; k++) { if (superdata[i].superposs[k].p > superdata[i].superposs[best].p) { best=k; } } h1 = superdata[i].superposs[best].h1; h2 = superdata[i].superposs[best].h2; fprintf(fpdump,"%s\n",decode_haplo_str(h1,num_blocks,block_size,hlist,num_hlist)); fprintf(fpdump,"%s\n",decode_haplo_str(h2,num_blocks,block_size,hlist,num_hlist)); } fclose(fpdump); } } */ //return 0; }
1,108,648
private void full_em_breakup( byte[][] input_haplos, int[] block_size, Vector affStatus, Vector kidAffStatus) throws HaploViewException{ int num_poss, iter; double total = 0; int block, start_locus, end_locus, biggest_block_size; int num_indivs = 0; int num_blocks = block_size.length; int num_haplos = input_haplos.length; int num_loci = input_haplos[0].length; Recovery tempRec; if (num_loci > MAXLOCI){ throw new HaploViewException("Too many loci in a single block (> "+MAXLOCI+" non-redundant)"); } //figure out the size of the biggest block biggest_block_size=block_size[0]; for (int i=1; i<num_blocks; i++) { if (block_size[i] > biggest_block_size) biggest_block_size=block_size[i]; } num_poss = two_n[biggest_block_size]; data = new OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) data[i]= new OBS(); superdata = new SUPER_OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) superdata[i]= new SUPER_OBS(num_blocks); double[][] hprob = new double[num_blocks][num_poss]; int[][] hlist = new int[num_blocks][num_poss]; int[] num_hlist = new int[num_blocks]; int[] hint = new int[num_poss]; double[] prob = new double[num_poss]; /*MapWrap probMap = new MapWrap(PSEUDOCOUNT);*/ /* for trio option */ if (Options.getAssocTest() == ASSOC_TRIO) { ambighet = new int[(num_haplos/4)][num_loci]; store_dhet_status(num_haplos,num_loci,input_haplos); } end_locus=-1; //now we loop through the blocks for (block=0; block<num_blocks; block++) { start_locus=end_locus+1; end_locus=start_locus+block_size[block]-1; num_poss=two_n[block_size[block]]; //read_observations initializes the values in data[] (array of OBS) num_indivs=read_observations(num_haplos,num_loci,input_haplos,start_locus,end_locus); prob = estimateProbsSmall(num_indivs,num_poss); int m=0; for(long j=0;j<num_poss; j++){ hint[(int)j]=-1; //if (probMap.get(new Long(j)) > .001) { if(prob[((int) j)] > .001) { // printf("haplo %s p = %.4lf\n",haplo_str(j,block_size[block]),prob[j]); hlist[block][m]=(int)j; /*hprob[block][m]=probMap.get(new Long(j));*/ hprob[block][m] = prob[((int) j)]; hint[(int)j]=m; m++; } } num_hlist[block]=m; // store current block results in super obs structure store_block_haplos(hlist, hprob, hint, block, num_indivs); } /* for each block */ double poss_full=1; for (block=0; block<num_blocks; block++) { poss_full *= num_hlist[block]; } /* LIGATE and finish this mess :) */ create_super_haplos(num_indivs,num_blocks,num_hlist); if(poss_full < Integer.MAX_VALUE) { finishLarge(num_indivs, poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); }else { finishSmall(num_indivs,(int) poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); } if(Options.getAssocTest() == ASSOC_TRIO) { kidConsistentCache = new boolean[numFilteredTrios][][]; for(int i=0;i<numFilteredTrios*2;i+=2) { if (((Integer)kidAffStatus.elementAt(i)).intValue() == 2){ kidConsistentCache[i/2] = new boolean[superdata[i].nsuper][]; for (int n=0; n<superdata[i].nsuper; n++) { kidConsistentCache[i/2][n] = new boolean[superdata[i+1].nsuper]; for (int m=0; m<superdata[i+1].nsuper; m++) { kidConsistentCache[i/2][n][m] = kid_consistent(superdata[i].superposs[n].h1, superdata[i+1].superposs[m].h1,num_blocks, block_size,hlist,num_hlist,i/2,num_loci); } } } } } realAffectedStatus = affStatus; doAssociationTests(affStatus, null, kidAffStatus); /* if (dump_phased_haplos) { if ((fpdump=fopen("emphased.haps","w"))!=NULL) { for (i=0; i<num_indivs; i++) { best=0; for (k=0; k<superdata[i].nsuper; k++) { if (superdata[i].superposs[k].p > superdata[i].superposs[best].p) { best=k; } } h1 = superdata[i].superposs[best].h1; h2 = superdata[i].superposs[best].h2; fprintf(fpdump,"%s\n",decode_haplo_str(h1,num_blocks,block_size,hlist,num_hlist)); fprintf(fpdump,"%s\n",decode_haplo_str(h2,num_blocks,block_size,hlist,num_hlist)); } fclose(fpdump); } } */ //return 0; }
private void full_em_breakup( byte[][] input_haplos, int[] block_size, Vector affStatus, Vector kidAffStatus) throws HaploViewException{ int num_poss, iter; double total = 0; int block, start_locus, end_locus, biggest_block_size; int num_indivs = 0; int num_blocks = block_size.length; int num_haplos = input_haplos.length; int num_loci = input_haplos[0].length; Recovery tempRec; if (num_loci > MAXLOCI){ throw new HaploViewException("Too many loci in a single block (> "+MAXLOCI+" non-redundant)"); } //figure out the size of the biggest block biggest_block_size=block_size[0]; for (int i=1; i<num_blocks; i++) { if (block_size[i] > biggest_block_size) biggest_block_size=block_size[i]; } num_poss = two_n[biggest_block_size]; data = new OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) data[i]= new OBS(); superdata = new SUPER_OBS[num_haplos/2]; for (int i=0; i<num_haplos/2; i++) superdata[i]= new SUPER_OBS(num_blocks); double[][] hprob = new double[num_blocks][num_poss]; int[][] hlist = new int[num_blocks][num_poss]; int[] num_hlist = new int[num_blocks]; int[] hint = new int[num_poss]; double[] prob = new double[num_poss]; /*MapWrap probMap = new MapWrap(PSEUDOCOUNT);*/ /* for trio option */ if (Options.getAssocTest() == ASSOC_TRIO) { ambighet = new int[(num_haplos/4)][num_loci]; store_dhet_status(num_haplos,num_loci,input_haplos); } end_locus=-1; //now we loop through the blocks for (block=0; block<num_blocks; block++) { start_locus=end_locus+1; end_locus=start_locus+block_size[block]-1; num_poss=two_n[block_size[block]]; //read_observations initializes the values in data[] (array of OBS) num_indivs=read_observations(num_haplos,num_loci,input_haplos,start_locus,end_locus); prob = estimateProbsSmall(num_indivs,num_poss); int m=0; for(long j=0;j<num_poss; j++){ hint[(int)j]=-1; //if (probMap.get(new Long(j)) > .001) { if(prob[((int) j)] > .001) { // printf("haplo %s p = %.4lf\n",haplo_str(j,block_size[block]),prob[j]); hlist[block][m]=(int)j; /*hprob[block][m]=probMap.get(new Long(j));*/ hprob[block][m] = prob[((int) j)]; hint[(int)j]=m; m++; } } num_hlist[block]=m; // store current block results in super obs structure store_block_haplos(hlist, hprob, hint, block, num_indivs); } /* for each block */ double poss_full=1; for (block=0; block<num_blocks; block++) { poss_full *= num_hlist[block]; } /* LIGATE and finish this mess :) */ create_super_haplos(num_indivs,num_blocks,num_hlist); if(poss_full < Integer.MAX_VALUE) { finishLarge(num_indivs, poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); }else { finishSmall(num_indivs,(int) poss_full,kidAffStatus, num_blocks,block_size,num_hlist,hlist, num_loci); } if(Options.getAssocTest() == ASSOC_TRIO) { kidConsistentCache = new boolean[numFilteredTrios][][]; for(int i=0;i<numFilteredTrios*2;i+=2) { if (((Integer)kidAffStatus.elementAt(i)).intValue() == 2){ kidConsistentCache[i/2] = new boolean[superdata[i].nsuper][]; for (int n=0; n<superdata[i].nsuper; n++) { kidConsistentCache[i/2][n] = new boolean[superdata[i+1].nsuper]; for (int m=0; m<superdata[i+1].nsuper; m++) { kidConsistentCache[i/2][n][m] = kid_consistent(superdata[i].superposs[n].h1, superdata[i+1].superposs[m].h1,num_blocks, block_size,hlist,num_hlist,i/2,num_loci); } } } } } realAffectedStatus = affStatus; doAssociationTests(affStatus, null, kidAffStatus); /* if (dump_phased_haplos) { if ((fpdump=fopen("emphased.haps","w"))!=NULL) { for (i=0; i<num_indivs; i++) { best=0; for (k=0; k<superdata[i].nsuper; k++) { if (superdata[i].superposs[k].p > superdata[i].superposs[best].p) { best=k; } } h1 = superdata[i].superposs[best].h1; h2 = superdata[i].superposs[best].h2; fprintf(fpdump,"%s\n",decode_haplo_str(h1,num_blocks,block_size,hlist,num_hlist)); fprintf(fpdump,"%s\n",decode_haplo_str(h2,num_blocks,block_size,hlist,num_hlist)); } fclose(fpdump); } } */ //return 0; }
1,108,649
public String getAttachmentURL(String filename, String action, XWikiContext context) { URL url = context.getURLFactory().createAttachmentURL(filename, getWeb(), getName(), action, null, getDatabase(), context); return context.getURLFactory().getURL(url, context); }
public String getAttachmentURL(String filename, String action, XWikiContext context) { URL url = context.getURLFactory().createAttachmentURL(filename, getWeb(), getName(), action, null, getDatabase(), context); return context.getURLFactory().getURL(url, context); }
1,108,651
public String getURL(String action, XWikiContext context) { return getURL(action, false, context); }
public String getURL(String action, XWikiContext context) { return getURL(action, false, context); }
1,108,652
public XWikiPluginManager(String classList, XWikiContext context) { String[] classNames = StringUtils.split(classList, " ,"); addPlugins(classNames, context); }
public XWikiPluginManager(String classList, XWikiContext context) { String[] classNames = StringUtils.split(classList, " ,"); addPlugins(classNames, context); }
1,108,653
public String toIdentifier(String name) { if (name == null) return null; else return name.replace(' ', '_'); }
public String toIdentifier(String name) { if (name == null) return null; else return name.replace(' ', '_'); }
1,108,655
public PLExportPanel() { setLayout(new GridLayout(1,2)); ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); projName = new String(project.getName()); newConnButton= new JButton("New"); newConnButton.addActionListener(new NewConnectionListener()); List connectionHistory = af.getUserSettings().getConnections(); String plIniPath = af.getUserSettings().getETLUserSettings().getPlDotIniPath(); List plOdbcCon = new ArrayList(); try { if (plIniPath != null) { plOdbcCon = getPLDBConnection(plIniPath); } else { JOptionPane.showMessageDialog (this, "Warning: You have not set the PL.INI file location." +"\nThe PL Connection box will be empty."); } } catch (FileNotFoundException ie) { JOptionPane.showMessageDialog (this, "PL database config file not found in specified path:\n" +plIniPath+"\nThe PL Connection box will be empty."); } catch (IOException ie){ JOptionPane.showMessageDialog(this, "Error reading PL.ini file "+plIniPath +"\nThe PL Connection box will be empty."); } history = new Vector(); history.add(ASUtils.lvb("(Select PL Connection)", null)); Iterator it = connectionHistory.iterator(); while (it.hasNext()) { DBConnectionSpec spec = (DBConnectionSpec) it.next(); history.add(ASUtils.lvb(spec.getDisplayName(), spec)); } historyBox = new JComboBox(history); historyBox.addActionListener(new HistoryBoxListener()); plodbc = new Vector(); plodbc.add(ASUtils.lvb("(Select PL ODBC Connection)", null)); Iterator itO = plOdbcCon.iterator(); while (itO.hasNext()) { PLdbConn plcon = (PLdbConn) itO.next(); plodbc.add(ASUtils.lvb(plcon.getLogical(), plcon)); } plODBCSourceBox = new JComboBox(plodbc); plODBCSourceBox.addActionListener(new ODBCSourceListener()); runPLEngine = new JCheckBox(); runPLEngine.setEnabled(false); plFolderName = new JTextField(toPLIdentifier(projName)+"_Folder"); plJobId = new JTextField(toPLIdentifier(projName)+"_Job"); JPanel jdbcPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); jdbcPanel.add(historyBox); jdbcPanel.add(newConnButton); JComponent[] jdbcFields = new JComponent[] {jdbcPanel, plRepOwner = new JTextField(), plFolderName, plJobId, plJobDescription = new JTextField(), plJobComment = new JTextField(), plOutputTableOwner = new JTextField()}; String[] jdbcLabels = new String[] {"Architect Connection Name", "PL Repository Owner", "PL Folder Name", "PL Job Id", "PL Job Description", "PL Job Comment", "Target Schema Owner"}; char[] jdbcMnemonics = new char[] {'t', 'r', 'f', 'i', 'd', 'c', 'o'}; int[] jdbcWidths = new int[] {18, 18, 18, 18, 18, 18, 18, 18,10}; String[] jdbcTips = new String[] {"Target database and PL repository", "Owner of PL Repository", "The folder name for transactions", "The Job unique Id", "The Job Description", "Comment about the Job", "Owner (Schema) for output transaction tables"}; TextPanel jdbcForm = new TextPanel(jdbcFields, jdbcLabels, jdbcMnemonics, jdbcWidths, jdbcTips); JComponent[] engineFields = new JComponent[] {plODBCSourceBox, plUserName = new JTextField(), plPassword = new JPasswordField(), runPLEngine}; String[] engineLabels = new String[] {"PL.INI Logical Database Name", "PL User Name", "PL Password", "Run Engine"}; char[] engineMnemonics = new char[] {'l', 'u', 'p', 'e'}; int[] engineWidths = new int[] {18, 18, 18, 10}; String[] engineTips = new String[] {"ODBC Source Name connection for PL", "PowerLoader User Name", "PowerLoader Password", "Run PL Engine immediately?"}; TextPanel engineForm = new TextPanel(engineFields, engineLabels, engineMnemonics, engineWidths, engineTips); add(jdbcForm); add(engineForm); }
public PLExportPanel() { setLayout(new GridLayout(1,2)); ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); projName = new String(project.getName()); newConnButton= new JButton("New"); newConnButton.addActionListener(new NewConnectionListener()); String plIniPath = af.getUserSettings().getETLUserSettings().getPlDotIniPath(); List plOdbcCon = new ArrayList(); try { if (plIniPath != null) { plOdbcCon = getPLDBConnection(plIniPath); } else { JOptionPane.showMessageDialog (this, "Warning: You have not set the PL.INI file location." +"\nThe PL Connection box will be empty."); } } catch (FileNotFoundException ie) { JOptionPane.showMessageDialog (this, "PL database config file not found in specified path:\n" +plIniPath+"\nThe PL Connection box will be empty."); } catch (IOException ie){ JOptionPane.showMessageDialog(this, "Error reading PL.ini file "+plIniPath +"\nThe PL Connection box will be empty."); } history = new Vector(); history.add(ASUtils.lvb("(Select PL Connection)", null)); Iterator it = connectionHistory.iterator(); while (it.hasNext()) { DBConnectionSpec spec = (DBConnectionSpec) it.next(); history.add(ASUtils.lvb(spec.getDisplayName(), spec)); } historyBox = new JComboBox(history); historyBox.addActionListener(new HistoryBoxListener()); plodbc = new Vector(); plodbc.add(ASUtils.lvb("(Select PL ODBC Connection)", null)); Iterator itO = plOdbcCon.iterator(); while (itO.hasNext()) { PLdbConn plcon = (PLdbConn) itO.next(); plodbc.add(ASUtils.lvb(plcon.getLogical(), plcon)); } plODBCSourceBox = new JComboBox(plodbc); plODBCSourceBox.addActionListener(new ODBCSourceListener()); runPLEngine = new JCheckBox(); runPLEngine.setEnabled(false); plFolderName = new JTextField(toPLIdentifier(projName)+"_Folder"); plJobId = new JTextField(toPLIdentifier(projName)+"_Job"); JPanel jdbcPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); jdbcPanel.add(historyBox); jdbcPanel.add(newConnButton); JComponent[] jdbcFields = new JComponent[] {jdbcPanel, plRepOwner = new JTextField(), plFolderName, plJobId, plJobDescription = new JTextField(), plJobComment = new JTextField(), plOutputTableOwner = new JTextField()}; String[] jdbcLabels = new String[] {"Architect Connection Name", "PL Repository Owner", "PL Folder Name", "PL Job Id", "PL Job Description", "PL Job Comment", "Target Schema Owner"}; char[] jdbcMnemonics = new char[] {'t', 'r', 'f', 'i', 'd', 'c', 'o'}; int[] jdbcWidths = new int[] {18, 18, 18, 18, 18, 18, 18, 18,10}; String[] jdbcTips = new String[] {"Target database and PL repository", "Owner of PL Repository", "The folder name for transactions", "The Job unique Id", "The Job Description", "Comment about the Job", "Owner (Schema) for output transaction tables"}; TextPanel jdbcForm = new TextPanel(jdbcFields, jdbcLabels, jdbcMnemonics, jdbcWidths, jdbcTips); JComponent[] engineFields = new JComponent[] {plODBCSourceBox, plUserName = new JTextField(), plPassword = new JPasswordField(), runPLEngine}; String[] engineLabels = new String[] {"PL.INI Logical Database Name", "PL User Name", "PL Password", "Run Engine"}; char[] engineMnemonics = new char[] {'l', 'u', 'p', 'e'}; int[] engineWidths = new int[] {18, 18, 18, 10}; String[] engineTips = new String[] {"ODBC Source Name connection for PL", "PowerLoader User Name", "PowerLoader Password", "Run PL Engine immediately?"}; TextPanel engineForm = new TextPanel(engineFields, engineLabels, engineMnemonics, engineWidths, engineTips); add(jdbcForm); add(engineForm); }
1,108,656
public PLExportPanel() { setLayout(new GridLayout(1,2)); ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); projName = new String(project.getName()); newConnButton= new JButton("New"); newConnButton.addActionListener(new NewConnectionListener()); List connectionHistory = af.getUserSettings().getConnections(); String plIniPath = af.getUserSettings().getETLUserSettings().getPlDotIniPath(); List plOdbcCon = new ArrayList(); try { if (plIniPath != null) { plOdbcCon = getPLDBConnection(plIniPath); } else { JOptionPane.showMessageDialog (this, "Warning: You have not set the PL.INI file location." +"\nThe PL Connection box will be empty."); } } catch (FileNotFoundException ie) { JOptionPane.showMessageDialog (this, "PL database config file not found in specified path:\n" +plIniPath+"\nThe PL Connection box will be empty."); } catch (IOException ie){ JOptionPane.showMessageDialog(this, "Error reading PL.ini file "+plIniPath +"\nThe PL Connection box will be empty."); } history = new Vector(); history.add(ASUtils.lvb("(Select PL Connection)", null)); Iterator it = connectionHistory.iterator(); while (it.hasNext()) { DBConnectionSpec spec = (DBConnectionSpec) it.next(); history.add(ASUtils.lvb(spec.getDisplayName(), spec)); } historyBox = new JComboBox(history); historyBox.addActionListener(new HistoryBoxListener()); plodbc = new Vector(); plodbc.add(ASUtils.lvb("(Select PL ODBC Connection)", null)); Iterator itO = plOdbcCon.iterator(); while (itO.hasNext()) { PLdbConn plcon = (PLdbConn) itO.next(); plodbc.add(ASUtils.lvb(plcon.getLogical(), plcon)); } plODBCSourceBox = new JComboBox(plodbc); plODBCSourceBox.addActionListener(new ODBCSourceListener()); runPLEngine = new JCheckBox(); runPLEngine.setEnabled(false); plFolderName = new JTextField(toPLIdentifier(projName)+"_Folder"); plJobId = new JTextField(toPLIdentifier(projName)+"_Job"); JPanel jdbcPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); jdbcPanel.add(historyBox); jdbcPanel.add(newConnButton); JComponent[] jdbcFields = new JComponent[] {jdbcPanel, plRepOwner = new JTextField(), plFolderName, plJobId, plJobDescription = new JTextField(), plJobComment = new JTextField(), plOutputTableOwner = new JTextField()}; String[] jdbcLabels = new String[] {"Architect Connection Name", "PL Repository Owner", "PL Folder Name", "PL Job Id", "PL Job Description", "PL Job Comment", "Target Schema Owner"}; char[] jdbcMnemonics = new char[] {'t', 'r', 'f', 'i', 'd', 'c', 'o'}; int[] jdbcWidths = new int[] {18, 18, 18, 18, 18, 18, 18, 18,10}; String[] jdbcTips = new String[] {"Target database and PL repository", "Owner of PL Repository", "The folder name for transactions", "The Job unique Id", "The Job Description", "Comment about the Job", "Owner (Schema) for output transaction tables"}; TextPanel jdbcForm = new TextPanel(jdbcFields, jdbcLabels, jdbcMnemonics, jdbcWidths, jdbcTips); JComponent[] engineFields = new JComponent[] {plODBCSourceBox, plUserName = new JTextField(), plPassword = new JPasswordField(), runPLEngine}; String[] engineLabels = new String[] {"PL.INI Logical Database Name", "PL User Name", "PL Password", "Run Engine"}; char[] engineMnemonics = new char[] {'l', 'u', 'p', 'e'}; int[] engineWidths = new int[] {18, 18, 18, 10}; String[] engineTips = new String[] {"ODBC Source Name connection for PL", "PowerLoader User Name", "PowerLoader Password", "Run PL Engine immediately?"}; TextPanel engineForm = new TextPanel(engineFields, engineLabels, engineMnemonics, engineWidths, engineTips); add(jdbcForm); add(engineForm); }
public PLExportPanel() { setLayout(new GridLayout(1,2)); ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); projName = new String(project.getName()); newConnButton= new JButton("New"); newConnButton.addActionListener(new NewConnectionListener()); List connectionHistory = af.getUserSettings().getConnections(); String plIniPath = af.getUserSettings().getETLUserSettings().getPlDotIniPath(); List plOdbcCon = new ArrayList(); try { if (plIniPath != null) { plOdbcCon = parsePlDotIni(plIniPath); } else { JOptionPane.showMessageDialog (this, "Warning: You have not set the PL.INI file location." +"\nThe PL Connection box will be empty."); } } catch (FileNotFoundException ie) { JOptionPane.showMessageDialog (this, "PL database config file not found in specified path:\n" +plIniPath+"\nThe PL Connection box will be empty."); } catch (IOException ie){ JOptionPane.showMessageDialog(this, "Error reading PL.ini file "+plIniPath +"\nThe PL Connection box will be empty."); } history = new Vector(); history.add(ASUtils.lvb("(Select PL Connection)", null)); Iterator it = connectionHistory.iterator(); while (it.hasNext()) { DBConnectionSpec spec = (DBConnectionSpec) it.next(); history.add(ASUtils.lvb(spec.getDisplayName(), spec)); } historyBox = new JComboBox(history); historyBox.addActionListener(new HistoryBoxListener()); plodbc = new Vector(); plodbc.add(ASUtils.lvb("(Select PL ODBC Connection)", null)); Iterator itO = plOdbcCon.iterator(); while (itO.hasNext()) { PLdbConn plcon = (PLdbConn) itO.next(); plodbc.add(ASUtils.lvb(plcon.getLogical(), plcon)); } plODBCSourceBox = new JComboBox(plodbc); plODBCSourceBox.addActionListener(new ODBCSourceListener()); runPLEngine = new JCheckBox(); runPLEngine.setEnabled(false); plFolderName = new JTextField(toPLIdentifier(projName)+"_Folder"); plJobId = new JTextField(toPLIdentifier(projName)+"_Job"); JPanel jdbcPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); jdbcPanel.add(historyBox); jdbcPanel.add(newConnButton); JComponent[] jdbcFields = new JComponent[] {jdbcPanel, plRepOwner = new JTextField(), plFolderName, plJobId, plJobDescription = new JTextField(), plJobComment = new JTextField(), plOutputTableOwner = new JTextField()}; String[] jdbcLabels = new String[] {"Architect Connection Name", "PL Repository Owner", "PL Folder Name", "PL Job Id", "PL Job Description", "PL Job Comment", "Target Schema Owner"}; char[] jdbcMnemonics = new char[] {'t', 'r', 'f', 'i', 'd', 'c', 'o'}; int[] jdbcWidths = new int[] {18, 18, 18, 18, 18, 18, 18, 18,10}; String[] jdbcTips = new String[] {"Target database and PL repository", "Owner of PL Repository", "The folder name for transactions", "The Job unique Id", "The Job Description", "Comment about the Job", "Owner (Schema) for output transaction tables"}; TextPanel jdbcForm = new TextPanel(jdbcFields, jdbcLabels, jdbcMnemonics, jdbcWidths, jdbcTips); JComponent[] engineFields = new JComponent[] {plODBCSourceBox, plUserName = new JTextField(), plPassword = new JPasswordField(), runPLEngine}; String[] engineLabels = new String[] {"PL.INI Logical Database Name", "PL User Name", "PL Password", "Run Engine"}; char[] engineMnemonics = new char[] {'l', 'u', 'p', 'e'}; int[] engineWidths = new int[] {18, 18, 18, 10}; String[] engineTips = new String[] {"ODBC Source Name connection for PL", "PowerLoader User Name", "PowerLoader Password", "Run PL Engine immediately?"}; TextPanel engineForm = new TextPanel(engineFields, engineLabels, engineMnemonics, engineWidths, engineTips); add(jdbcForm); add(engineForm); }
1,108,657
public PLExportPanel() { setLayout(new GridLayout(1,2)); ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); projName = new String(project.getName()); newConnButton= new JButton("New"); newConnButton.addActionListener(new NewConnectionListener()); List connectionHistory = af.getUserSettings().getConnections(); String plIniPath = af.getUserSettings().getETLUserSettings().getPlDotIniPath(); List plOdbcCon = new ArrayList(); try { if (plIniPath != null) { plOdbcCon = getPLDBConnection(plIniPath); } else { JOptionPane.showMessageDialog (this, "Warning: You have not set the PL.INI file location." +"\nThe PL Connection box will be empty."); } } catch (FileNotFoundException ie) { JOptionPane.showMessageDialog (this, "PL database config file not found in specified path:\n" +plIniPath+"\nThe PL Connection box will be empty."); } catch (IOException ie){ JOptionPane.showMessageDialog(this, "Error reading PL.ini file "+plIniPath +"\nThe PL Connection box will be empty."); } history = new Vector(); history.add(ASUtils.lvb("(Select PL Connection)", null)); Iterator it = connectionHistory.iterator(); while (it.hasNext()) { DBConnectionSpec spec = (DBConnectionSpec) it.next(); history.add(ASUtils.lvb(spec.getDisplayName(), spec)); } historyBox = new JComboBox(history); historyBox.addActionListener(new HistoryBoxListener()); plodbc = new Vector(); plodbc.add(ASUtils.lvb("(Select PL ODBC Connection)", null)); Iterator itO = plOdbcCon.iterator(); while (itO.hasNext()) { PLdbConn plcon = (PLdbConn) itO.next(); plodbc.add(ASUtils.lvb(plcon.getLogical(), plcon)); } plODBCSourceBox = new JComboBox(plodbc); plODBCSourceBox.addActionListener(new ODBCSourceListener()); runPLEngine = new JCheckBox(); runPLEngine.setEnabled(false); plFolderName = new JTextField(toPLIdentifier(projName)+"_Folder"); plJobId = new JTextField(toPLIdentifier(projName)+"_Job"); JPanel jdbcPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); jdbcPanel.add(historyBox); jdbcPanel.add(newConnButton); JComponent[] jdbcFields = new JComponent[] {jdbcPanel, plRepOwner = new JTextField(), plFolderName, plJobId, plJobDescription = new JTextField(), plJobComment = new JTextField(), plOutputTableOwner = new JTextField()}; String[] jdbcLabels = new String[] {"Architect Connection Name", "PL Repository Owner", "PL Folder Name", "PL Job Id", "PL Job Description", "PL Job Comment", "Target Schema Owner"}; char[] jdbcMnemonics = new char[] {'t', 'r', 'f', 'i', 'd', 'c', 'o'}; int[] jdbcWidths = new int[] {18, 18, 18, 18, 18, 18, 18, 18,10}; String[] jdbcTips = new String[] {"Target database and PL repository", "Owner of PL Repository", "The folder name for transactions", "The Job unique Id", "The Job Description", "Comment about the Job", "Owner (Schema) for output transaction tables"}; TextPanel jdbcForm = new TextPanel(jdbcFields, jdbcLabels, jdbcMnemonics, jdbcWidths, jdbcTips); JComponent[] engineFields = new JComponent[] {plODBCSourceBox, plUserName = new JTextField(), plPassword = new JPasswordField(), runPLEngine}; String[] engineLabels = new String[] {"PL.INI Logical Database Name", "PL User Name", "PL Password", "Run Engine"}; char[] engineMnemonics = new char[] {'l', 'u', 'p', 'e'}; int[] engineWidths = new int[] {18, 18, 18, 10}; String[] engineTips = new String[] {"ODBC Source Name connection for PL", "PowerLoader User Name", "PowerLoader Password", "Run PL Engine immediately?"}; TextPanel engineForm = new TextPanel(engineFields, engineLabels, engineMnemonics, engineWidths, engineTips); add(jdbcForm); add(engineForm); }
public PLExportPanel() { setLayout(new GridLayout(1,2)); ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); projName = new String(project.getName()); newConnButton= new JButton("New"); newConnButton.addActionListener(new NewConnectionListener()); List connectionHistory = af.getUserSettings().getConnections(); String plIniPath = af.getUserSettings().getETLUserSettings().getPlDotIniPath(); List plOdbcCon = new ArrayList(); try { if (plIniPath != null) { plOdbcCon = getPLDBConnection(plIniPath); } else { JOptionPane.showMessageDialog (this, "Warning: You have not set the PL.INI file location." +"\nThe PL Connection box will be empty."); } } catch (FileNotFoundException ie) { JOptionPane.showMessageDialog (this, "PL database config file not found in specified path:\n" +plIniPath+"\nThe PL Connection box will be empty."); } catch (IOException ie){ JOptionPane.showMessageDialog(this, "Error reading PL.ini file "+plIniPath +"\nThe PL Connection box will be empty."); } history = new Vector(); history.add(ASUtils.lvb("(Select PL Connection)", null)); Iterator it = connectionHistory.iterator(); while (it.hasNext()) { DBConnectionSpec spec = (DBConnectionSpec) it.next(); history.add(ASUtils.lvb(spec.getDisplayName(), spec)); } historyBox = new JComboBox(history); historyBox.addActionListener(new HistoryBoxListener()); plodbc = new Vector(); plodbc.add(ASUtils.lvb("(Select PL ODBC Connection)", null)); Iterator itO = plOdbcCon.iterator(); while (itO.hasNext()) { PLdbConn plcon = (PLdbConn) itO.next(); plodbc.add(ASUtils.lvb(plcon.getLogical(), plcon)); } plODBCSourceBox = new JComboBox(plodbc); plODBCSourceBox.addActionListener(new ODBCSourceListener()); runPLEngine = new JCheckBox(); runPLEngine.setEnabled(false); plFolderName = new JTextField(toPLIdentifier(projName)+"_Folder"); plJobId = new JTextField(toPLIdentifier(projName)+"_Job"); JPanel jdbcPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); jdbcPanel.add(historyBox); jdbcPanel.add(newConnButton); JComponent[] jdbcFields = new JComponent[] {jdbcPanel, plRepOwner = new JTextField(), plFolderName, plJobId, plJobDescription = new JTextField(), plJobComment = new JTextField(), plOutputTableOwner = new JTextField()}; String[] jdbcLabels = new String[] {"Architect Connection Name", "PL Repository Owner", "PL Folder Name", "PL Job Id", "PL Job Description", "PL Job Comment", "Target Schema Owner"}; char[] jdbcMnemonics = new char[] {'t', 'r', 'f', 'i', 'd', 'c', 'o'}; int[] jdbcWidths = new int[] {18, 18, 18, 18, 18, 18, 18, 18,10}; String[] jdbcTips = new String[] {"Target database and PL repository", "Owner of PL Repository", "The folder name for transactions", "The Job unique Id", "The Job Description", "Comment about the Job", "Owner (Schema) for output transaction tables"}; TextPanel jdbcForm = new TextPanel(jdbcFields, jdbcLabels, jdbcMnemonics, jdbcWidths, jdbcTips); JComponent[] engineFields = new JComponent[] {plODBCSourceBox, plUserName = new JTextField(), plPassword = new JPasswordField(), runPLEngine}; String[] engineLabels = new String[] {"PL.INI Logical Database Name", "PL User Name", "PL Password", "Run Engine"}; char[] engineMnemonics = new char[] {'l', 'u', 'p', 'e'}; int[] engineWidths = new int[] {18, 18, 18, 10}; String[] engineTips = new String[] {"ODBC Source Name connection for PL", "PowerLoader User Name", "PowerLoader Password", "Run PL Engine immediately?"}; TextPanel engineForm = new TextPanel(engineFields, engineLabels, engineMnemonics, engineWidths, engineTips); add(jdbcForm); add(engineForm); }
1,108,658
public PLExportPanel() { setLayout(new GridLayout(1,2)); ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); projName = new String(project.getName()); newConnButton= new JButton("New"); newConnButton.addActionListener(new NewConnectionListener()); List connectionHistory = af.getUserSettings().getConnections(); String plIniPath = af.getUserSettings().getETLUserSettings().getPlDotIniPath(); List plOdbcCon = new ArrayList(); try { if (plIniPath != null) { plOdbcCon = getPLDBConnection(plIniPath); } else { JOptionPane.showMessageDialog (this, "Warning: You have not set the PL.INI file location." +"\nThe PL Connection box will be empty."); } } catch (FileNotFoundException ie) { JOptionPane.showMessageDialog (this, "PL database config file not found in specified path:\n" +plIniPath+"\nThe PL Connection box will be empty."); } catch (IOException ie){ JOptionPane.showMessageDialog(this, "Error reading PL.ini file "+plIniPath +"\nThe PL Connection box will be empty."); } history = new Vector(); history.add(ASUtils.lvb("(Select PL Connection)", null)); Iterator it = connectionHistory.iterator(); while (it.hasNext()) { DBConnectionSpec spec = (DBConnectionSpec) it.next(); history.add(ASUtils.lvb(spec.getDisplayName(), spec)); } historyBox = new JComboBox(history); historyBox.addActionListener(new HistoryBoxListener()); plodbc = new Vector(); plodbc.add(ASUtils.lvb("(Select PL ODBC Connection)", null)); Iterator itO = plOdbcCon.iterator(); while (itO.hasNext()) { PLdbConn plcon = (PLdbConn) itO.next(); plodbc.add(ASUtils.lvb(plcon.getLogical(), plcon)); } plODBCSourceBox = new JComboBox(plodbc); plODBCSourceBox.addActionListener(new ODBCSourceListener()); runPLEngine = new JCheckBox(); runPLEngine.setEnabled(false); plFolderName = new JTextField(toPLIdentifier(projName)+"_Folder"); plJobId = new JTextField(toPLIdentifier(projName)+"_Job"); JPanel jdbcPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); jdbcPanel.add(historyBox); jdbcPanel.add(newConnButton); JComponent[] jdbcFields = new JComponent[] {jdbcPanel, plRepOwner = new JTextField(), plFolderName, plJobId, plJobDescription = new JTextField(), plJobComment = new JTextField(), plOutputTableOwner = new JTextField()}; String[] jdbcLabels = new String[] {"Architect Connection Name", "PL Repository Owner", "PL Folder Name", "PL Job Id", "PL Job Description", "PL Job Comment", "Target Schema Owner"}; char[] jdbcMnemonics = new char[] {'t', 'r', 'f', 'i', 'd', 'c', 'o'}; int[] jdbcWidths = new int[] {18, 18, 18, 18, 18, 18, 18, 18,10}; String[] jdbcTips = new String[] {"Target database and PL repository", "Owner of PL Repository", "The folder name for transactions", "The Job unique Id", "The Job Description", "Comment about the Job", "Owner (Schema) for output transaction tables"}; TextPanel jdbcForm = new TextPanel(jdbcFields, jdbcLabels, jdbcMnemonics, jdbcWidths, jdbcTips); JComponent[] engineFields = new JComponent[] {plODBCSourceBox, plUserName = new JTextField(), plPassword = new JPasswordField(), runPLEngine}; String[] engineLabels = new String[] {"PL.INI Logical Database Name", "PL User Name", "PL Password", "Run Engine"}; char[] engineMnemonics = new char[] {'l', 'u', 'p', 'e'}; int[] engineWidths = new int[] {18, 18, 18, 10}; String[] engineTips = new String[] {"ODBC Source Name connection for PL", "PowerLoader User Name", "PowerLoader Password", "Run PL Engine immediately?"}; TextPanel engineForm = new TextPanel(engineFields, engineLabels, engineMnemonics, engineWidths, engineTips); add(jdbcForm); add(engineForm); }
public PLExportPanel() { setLayout(new GridLayout(1,2)); ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); projName = new String(project.getName()); newConnButton= new JButton("New"); newConnButton.addActionListener(new NewConnectionListener()); List connectionHistory = af.getUserSettings().getConnections(); String plIniPath = af.getUserSettings().getETLUserSettings().getPlDotIniPath(); List plOdbcCon = new ArrayList(); try { if (plIniPath != null) { plOdbcCon = getPLDBConnection(plIniPath); } else { JOptionPane.showMessageDialog (this, "Warning: You have not set the PL.INI file location." +"\nThe PL Connection box will be empty."); } } catch (FileNotFoundException ie) { JOptionPane.showMessageDialog (this, "PL database config file not found in specified path:\n" +plIniPath+"\nThe PL Connection box will be empty."); } catch (IOException ie){ JOptionPane.showMessageDialog(this, "Error reading PL.ini file "+plIniPath +"\nThe PL Connection box will be empty."); } history = new Vector(); history.add(ASUtils.lvb("(Select PL Connection)", null)); Iterator it = connectionHistory.iterator(); while (it.hasNext()) { DBConnectionSpec spec = (DBConnectionSpec) it.next(); connections.add(ASUtils.lvb(spec.getDisplayName(), spec)); } historyBox = new JComboBox(history); historyBox.addActionListener(new HistoryBoxListener()); plodbc = new Vector(); plodbc.add(ASUtils.lvb("(Select PL ODBC Connection)", null)); Iterator itO = plOdbcCon.iterator(); while (itO.hasNext()) { PLdbConn plcon = (PLdbConn) itO.next(); plodbc.add(ASUtils.lvb(plcon.getLogical(), plcon)); } plODBCSourceBox = new JComboBox(plodbc); plODBCSourceBox.addActionListener(new ODBCSourceListener()); runPLEngine = new JCheckBox(); runPLEngine.setEnabled(false); plFolderName = new JTextField(toPLIdentifier(projName)+"_Folder"); plJobId = new JTextField(toPLIdentifier(projName)+"_Job"); JPanel jdbcPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); jdbcPanel.add(historyBox); jdbcPanel.add(newConnButton); JComponent[] jdbcFields = new JComponent[] {jdbcPanel, plRepOwner = new JTextField(), plFolderName, plJobId, plJobDescription = new JTextField(), plJobComment = new JTextField(), plOutputTableOwner = new JTextField()}; String[] jdbcLabels = new String[] {"Architect Connection Name", "PL Repository Owner", "PL Folder Name", "PL Job Id", "PL Job Description", "PL Job Comment", "Target Schema Owner"}; char[] jdbcMnemonics = new char[] {'t', 'r', 'f', 'i', 'd', 'c', 'o'}; int[] jdbcWidths = new int[] {18, 18, 18, 18, 18, 18, 18, 18,10}; String[] jdbcTips = new String[] {"Target database and PL repository", "Owner of PL Repository", "The folder name for transactions", "The Job unique Id", "The Job Description", "Comment about the Job", "Owner (Schema) for output transaction tables"}; TextPanel jdbcForm = new TextPanel(jdbcFields, jdbcLabels, jdbcMnemonics, jdbcWidths, jdbcTips); JComponent[] engineFields = new JComponent[] {plODBCSourceBox, plUserName = new JTextField(), plPassword = new JPasswordField(), runPLEngine}; String[] engineLabels = new String[] {"PL.INI Logical Database Name", "PL User Name", "PL Password", "Run Engine"}; char[] engineMnemonics = new char[] {'l', 'u', 'p', 'e'}; int[] engineWidths = new int[] {18, 18, 18, 10}; String[] engineTips = new String[] {"ODBC Source Name connection for PL", "PowerLoader User Name", "PowerLoader Password", "Run PL Engine immediately?"}; TextPanel engineForm = new TextPanel(engineFields, engineLabels, engineMnemonics, engineWidths, engineTips); add(jdbcForm); add(engineForm); }
1,108,659
public PLExportPanel() { setLayout(new GridLayout(1,2)); ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); projName = new String(project.getName()); newConnButton= new JButton("New"); newConnButton.addActionListener(new NewConnectionListener()); List connectionHistory = af.getUserSettings().getConnections(); String plIniPath = af.getUserSettings().getETLUserSettings().getPlDotIniPath(); List plOdbcCon = new ArrayList(); try { if (plIniPath != null) { plOdbcCon = getPLDBConnection(plIniPath); } else { JOptionPane.showMessageDialog (this, "Warning: You have not set the PL.INI file location." +"\nThe PL Connection box will be empty."); } } catch (FileNotFoundException ie) { JOptionPane.showMessageDialog (this, "PL database config file not found in specified path:\n" +plIniPath+"\nThe PL Connection box will be empty."); } catch (IOException ie){ JOptionPane.showMessageDialog(this, "Error reading PL.ini file "+plIniPath +"\nThe PL Connection box will be empty."); } history = new Vector(); history.add(ASUtils.lvb("(Select PL Connection)", null)); Iterator it = connectionHistory.iterator(); while (it.hasNext()) { DBConnectionSpec spec = (DBConnectionSpec) it.next(); history.add(ASUtils.lvb(spec.getDisplayName(), spec)); } historyBox = new JComboBox(history); historyBox.addActionListener(new HistoryBoxListener()); plodbc = new Vector(); plodbc.add(ASUtils.lvb("(Select PL ODBC Connection)", null)); Iterator itO = plOdbcCon.iterator(); while (itO.hasNext()) { PLdbConn plcon = (PLdbConn) itO.next(); plodbc.add(ASUtils.lvb(plcon.getLogical(), plcon)); } plODBCSourceBox = new JComboBox(plodbc); plODBCSourceBox.addActionListener(new ODBCSourceListener()); runPLEngine = new JCheckBox(); runPLEngine.setEnabled(false); plFolderName = new JTextField(toPLIdentifier(projName)+"_Folder"); plJobId = new JTextField(toPLIdentifier(projName)+"_Job"); JPanel jdbcPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); jdbcPanel.add(historyBox); jdbcPanel.add(newConnButton); JComponent[] jdbcFields = new JComponent[] {jdbcPanel, plRepOwner = new JTextField(), plFolderName, plJobId, plJobDescription = new JTextField(), plJobComment = new JTextField(), plOutputTableOwner = new JTextField()}; String[] jdbcLabels = new String[] {"Architect Connection Name", "PL Repository Owner", "PL Folder Name", "PL Job Id", "PL Job Description", "PL Job Comment", "Target Schema Owner"}; char[] jdbcMnemonics = new char[] {'t', 'r', 'f', 'i', 'd', 'c', 'o'}; int[] jdbcWidths = new int[] {18, 18, 18, 18, 18, 18, 18, 18,10}; String[] jdbcTips = new String[] {"Target database and PL repository", "Owner of PL Repository", "The folder name for transactions", "The Job unique Id", "The Job Description", "Comment about the Job", "Owner (Schema) for output transaction tables"}; TextPanel jdbcForm = new TextPanel(jdbcFields, jdbcLabels, jdbcMnemonics, jdbcWidths, jdbcTips); JComponent[] engineFields = new JComponent[] {plODBCSourceBox, plUserName = new JTextField(), plPassword = new JPasswordField(), runPLEngine}; String[] engineLabels = new String[] {"PL.INI Logical Database Name", "PL User Name", "PL Password", "Run Engine"}; char[] engineMnemonics = new char[] {'l', 'u', 'p', 'e'}; int[] engineWidths = new int[] {18, 18, 18, 10}; String[] engineTips = new String[] {"ODBC Source Name connection for PL", "PowerLoader User Name", "PowerLoader Password", "Run PL Engine immediately?"}; TextPanel engineForm = new TextPanel(engineFields, engineLabels, engineMnemonics, engineWidths, engineTips); add(jdbcForm); add(engineForm); }
public PLExportPanel() { setLayout(new GridLayout(1,2)); ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); projName = new String(project.getName()); newConnButton= new JButton("New"); newConnButton.addActionListener(new NewConnectionListener()); List connectionHistory = af.getUserSettings().getConnections(); String plIniPath = af.getUserSettings().getETLUserSettings().getPlDotIniPath(); List plOdbcCon = new ArrayList(); try { if (plIniPath != null) { plOdbcCon = getPLDBConnection(plIniPath); } else { JOptionPane.showMessageDialog (this, "Warning: You have not set the PL.INI file location." +"\nThe PL Connection box will be empty."); } } catch (FileNotFoundException ie) { JOptionPane.showMessageDialog (this, "PL database config file not found in specified path:\n" +plIniPath+"\nThe PL Connection box will be empty."); } catch (IOException ie){ JOptionPane.showMessageDialog(this, "Error reading PL.ini file "+plIniPath +"\nThe PL Connection box will be empty."); } history = new Vector(); history.add(ASUtils.lvb("(Select PL Connection)", null)); Iterator it = connectionHistory.iterator(); while (it.hasNext()) { DBConnectionSpec spec = (DBConnectionSpec) it.next(); history.add(ASUtils.lvb(spec.getDisplayName(), spec)); } historyBox = new JComboBox(history); historyBox.addActionListener(new HistoryBoxListener()); plodbc = new Vector(); plodbc.add(ASUtils.lvb("(Select PL ODBC Connection)", null)); Iterator itO = plOdbcCon.iterator(); while (itO.hasNext()) { PLdbConn plcon = (PLdbConn) itO.next(); plodbc.add(ASUtils.lvb(plcon.getLogical(), plcon)); } plODBCSourceBox = new JComboBox(plodbc); plODBCSourceBox.addActionListener(new ODBCSourceListener()); runPLEngine = new JCheckBox(); runPLEngine.setEnabled(false); plFolderName = new JTextField(toPLIdentifier(projName)+"_Folder"); plJobId = new JTextField(toPLIdentifier(projName)+"_Job"); JPanel jdbcPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); jdbcPanel.add(historyBox); jdbcPanel.add(newConnButton); JComponent[] jdbcFields = new JComponent[] {jdbcPanel, plRepOwner = new JTextField(), plFolderName, plJobId, plJobDescription = new JTextField(), plJobComment = new JTextField(), plOutputTableOwner = new JTextField()}; String[] jdbcLabels = new String[] {"Architect Connection Name", "PL Repository Owner", "PL Folder Name", "PL Job Id", "PL Job Description", "PL Job Comment", "Target Schema Owner"}; char[] jdbcMnemonics = new char[] {'t', 'r', 'f', 'i', 'd', 'c', 'o'}; int[] jdbcWidths = new int[] {18, 18, 18, 18, 18, 18, 18, 18,10}; String[] jdbcTips = new String[] {"Target database and PL repository", "Owner of PL Repository", "The folder name for transactions", "The Job unique Id", "The Job Description", "Comment about the Job", "Owner (Schema) for output transaction tables"}; TextPanel jdbcForm = new TextPanel(jdbcFields, jdbcLabels, jdbcMnemonics, jdbcWidths, jdbcTips); JComponent[] engineFields = new JComponent[] {plODBCSourceBox, plUserName = new JTextField(), plPassword = new JPasswordField(), runPLEngine}; String[] engineLabels = new String[] {"PL.INI Logical Database Name", "PL User Name", "PL Password", "Run Engine"}; char[] engineMnemonics = new char[] {'l', 'u', 'p', 'e'}; int[] engineWidths = new int[] {18, 18, 18, 10}; String[] engineTips = new String[] {"ODBC Source Name connection for PL", "PowerLoader User Name", "PowerLoader Password", "Run PL Engine immediately?"}; TextPanel engineForm = new TextPanel(engineFields, engineLabels, engineMnemonics, engineWidths, engineTips); add(jdbcForm); add(engineForm); }
1,108,660
public PLExportPanel() { setLayout(new GridLayout(1,2)); ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); projName = new String(project.getName()); newConnButton= new JButton("New"); newConnButton.addActionListener(new NewConnectionListener()); List connectionHistory = af.getUserSettings().getConnections(); String plIniPath = af.getUserSettings().getETLUserSettings().getPlDotIniPath(); List plOdbcCon = new ArrayList(); try { if (plIniPath != null) { plOdbcCon = getPLDBConnection(plIniPath); } else { JOptionPane.showMessageDialog (this, "Warning: You have not set the PL.INI file location." +"\nThe PL Connection box will be empty."); } } catch (FileNotFoundException ie) { JOptionPane.showMessageDialog (this, "PL database config file not found in specified path:\n" +plIniPath+"\nThe PL Connection box will be empty."); } catch (IOException ie){ JOptionPane.showMessageDialog(this, "Error reading PL.ini file "+plIniPath +"\nThe PL Connection box will be empty."); } history = new Vector(); history.add(ASUtils.lvb("(Select PL Connection)", null)); Iterator it = connectionHistory.iterator(); while (it.hasNext()) { DBConnectionSpec spec = (DBConnectionSpec) it.next(); history.add(ASUtils.lvb(spec.getDisplayName(), spec)); } historyBox = new JComboBox(history); historyBox.addActionListener(new HistoryBoxListener()); plodbc = new Vector(); plodbc.add(ASUtils.lvb("(Select PL ODBC Connection)", null)); Iterator itO = plOdbcCon.iterator(); while (itO.hasNext()) { PLdbConn plcon = (PLdbConn) itO.next(); plodbc.add(ASUtils.lvb(plcon.getLogical(), plcon)); } plODBCSourceBox = new JComboBox(plodbc); plODBCSourceBox.addActionListener(new ODBCSourceListener()); runPLEngine = new JCheckBox(); runPLEngine.setEnabled(false); plFolderName = new JTextField(toPLIdentifier(projName)+"_Folder"); plJobId = new JTextField(toPLIdentifier(projName)+"_Job"); JPanel jdbcPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); jdbcPanel.add(historyBox); jdbcPanel.add(newConnButton); JComponent[] jdbcFields = new JComponent[] {jdbcPanel, plRepOwner = new JTextField(), plFolderName, plJobId, plJobDescription = new JTextField(), plJobComment = new JTextField(), plOutputTableOwner = new JTextField()}; String[] jdbcLabels = new String[] {"Architect Connection Name", "PL Repository Owner", "PL Folder Name", "PL Job Id", "PL Job Description", "PL Job Comment", "Target Schema Owner"}; char[] jdbcMnemonics = new char[] {'t', 'r', 'f', 'i', 'd', 'c', 'o'}; int[] jdbcWidths = new int[] {18, 18, 18, 18, 18, 18, 18, 18,10}; String[] jdbcTips = new String[] {"Target database and PL repository", "Owner of PL Repository", "The folder name for transactions", "The Job unique Id", "The Job Description", "Comment about the Job", "Owner (Schema) for output transaction tables"}; TextPanel jdbcForm = new TextPanel(jdbcFields, jdbcLabels, jdbcMnemonics, jdbcWidths, jdbcTips); JComponent[] engineFields = new JComponent[] {plODBCSourceBox, plUserName = new JTextField(), plPassword = new JPasswordField(), runPLEngine}; String[] engineLabels = new String[] {"PL.INI Logical Database Name", "PL User Name", "PL Password", "Run Engine"}; char[] engineMnemonics = new char[] {'l', 'u', 'p', 'e'}; int[] engineWidths = new int[] {18, 18, 18, 10}; String[] engineTips = new String[] {"ODBC Source Name connection for PL", "PowerLoader User Name", "PowerLoader Password", "Run PL Engine immediately?"}; TextPanel engineForm = new TextPanel(engineFields, engineLabels, engineMnemonics, engineWidths, engineTips); add(jdbcForm); add(engineForm); }
public PLExportPanel() { setLayout(new GridLayout(1,2)); ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); projName = new String(project.getName()); newConnButton= new JButton("New"); newConnButton.addActionListener(new NewConnectionListener()); List connectionHistory = af.getUserSettings().getConnections(); String plIniPath = af.getUserSettings().getETLUserSettings().getPlDotIniPath(); List plOdbcCon = new ArrayList(); try { if (plIniPath != null) { plOdbcCon = getPLDBConnection(plIniPath); } else { JOptionPane.showMessageDialog (this, "Warning: You have not set the PL.INI file location." +"\nThe PL Connection box will be empty."); } } catch (FileNotFoundException ie) { JOptionPane.showMessageDialog (this, "PL database config file not found in specified path:\n" +plIniPath+"\nThe PL Connection box will be empty."); } catch (IOException ie){ JOptionPane.showMessageDialog(this, "Error reading PL.ini file "+plIniPath +"\nThe PL Connection box will be empty."); } history = new Vector(); history.add(ASUtils.lvb("(Select PL Connection)", null)); Iterator it = connectionHistory.iterator(); while (it.hasNext()) { DBConnectionSpec spec = (DBConnectionSpec) it.next(); history.add(ASUtils.lvb(spec.getDisplayName(), spec)); } historyBox = new JComboBox(history); historyBox.addActionListener(new HistoryBoxListener()); plodbc = new Vector(); plodbc.add(ASUtils.lvb("(Select PL ODBC Connection)", null)); Iterator itO = plOdbcCon.iterator(); while (itO.hasNext()) { PLdbConn plcon = (PLdbConn) itO.next(); plodbc.add(ASUtils.lvb(plcon.getLogical(), plcon)); } plODBCSourceBox = new JComboBox(plodbc); plODBCSourceBox.addActionListener(new ODBCSourceListener()); runPLEngine = new JCheckBox(); runPLEngine.setEnabled(false); plFolderName = new JTextField(toPLIdentifier(projName)+"_Folder"); plJobId = new JTextField(toPLIdentifier(projName)+"_Job"); JPanel jdbcPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); jdbcPanel.add(connectionsBox); jdbcPanel.add(newConnButton); JComponent[] jdbcFields = new JComponent[] {jdbcPanel, plRepOwner = new JTextField(), plFolderName, plJobId, plJobDescription = new JTextField(), plJobComment = new JTextField(), plOutputTableOwner = new JTextField()}; String[] jdbcLabels = new String[] {"Architect Connection Name", "PL Repository Owner", "PL Folder Name", "PL Job Id", "PL Job Description", "PL Job Comment", "Target Schema Owner"}; char[] jdbcMnemonics = new char[] {'t', 'r', 'f', 'i', 'd', 'c', 'o'}; int[] jdbcWidths = new int[] {18, 18, 18, 18, 18, 18, 18, 18,10}; String[] jdbcTips = new String[] {"Target database and PL repository", "Owner of PL Repository", "The folder name for transactions", "The Job unique Id", "The Job Description", "Comment about the Job", "Owner (Schema) for output transaction tables"}; TextPanel jdbcForm = new TextPanel(jdbcFields, jdbcLabels, jdbcMnemonics, jdbcWidths, jdbcTips); JComponent[] engineFields = new JComponent[] {plODBCSourceBox, plUserName = new JTextField(), plPassword = new JPasswordField(), runPLEngine}; String[] engineLabels = new String[] {"PL.INI Logical Database Name", "PL User Name", "PL Password", "Run Engine"}; char[] engineMnemonics = new char[] {'l', 'u', 'p', 'e'}; int[] engineWidths = new int[] {18, 18, 18, 10}; String[] engineTips = new String[] {"ODBC Source Name connection for PL", "PowerLoader User Name", "PowerLoader Password", "Run PL Engine immediately?"}; TextPanel engineForm = new TextPanel(engineFields, engineLabels, engineMnemonics, engineWidths, engineTips); add(jdbcForm); add(engineForm); }
1,108,661
public void applyChanges() { String name = plFolderName.getText(); }
public void applyChanges() { }
1,108,662
private FilterValues<S> transferValues(FilterValues<T> values) { if (values == null) { return null; } // FIXME: throws exception if not all values supplied return mOuterLoopFilterValues.withValues(values.getValuesFor(mSourceFilterAsFromTarget)); }
private FilterValues<S> transferValues(FilterValues<T> values) { if (values == null) { return null; } // FIXME: throws exception if not all values supplied return mOuterLoopFilterValues .withValues(values.getSuppliedValuesFor(mSourceFilterAsFromTarget)); }
1,108,663
public static PhotoInfo addToDB( File imgFile ) throws PhotoNotFoundException { VolumeBase vol = null; try { vol = VolumeBase.getVolumeOfFile( imgFile ); } catch (IOException ex) { throw new PhotoNotFoundException(); } // Determine the fle that will be added as an instance File instanceFile = null; if ( vol == null ) { /* The "normal" case: we are adding a photo that is not part of any volume. Copy the file to the archive. */ vol = VolumeBase.getDefaultVolume(); instanceFile = vol.getFilingFname( imgFile ); // try { FileInputStream in = new FileInputStream( imgFile ); FileOutputStream out = new FileOutputStream( instanceFile ); byte buf[] = new byte[1024]; int nRead = 0; int offset = 0; while ( (nRead = in.read( buf )) > 0 ) { out.write( buf, 0, nRead ); offset += nRead; } out.close(); in.close(); } catch ( Exception e ) { log.warn( "Error copying file: " + e.getMessage() ); throw new PhotoNotFoundException(); } } else if ( vol instanceof ExternalVolume ) { // Thisfile is in an external volume so we do not need a copy instanceFile = imgFile; } else if ( vol instanceof Volume ) { // Adding file from normal volume is not permitted throw new PhotoNotFoundException(); } else { throw new java.lang.Error( "Unknown subclass of VolumeBase: " + vol.getClass().getName() ); } // Create the image ODMGXAWrapper txw = new ODMGXAWrapper(); PhotoInfo photo = PhotoInfo.create(); txw.lock( photo, Transaction.WRITE ); photo.addInstance( vol, instanceFile, ImageInstance.INSTANCE_TYPE_ORIGINAL ); photo.setOrigFname( imgFile.getName() ); java.util.Date shootTime = new java.util.Date( imgFile.lastModified() ); photo.setShootTime( shootTime ); photo.setCropBounds( new Rectangle2D.Float( 0.0F, 0.0F, 1.0F, 1.0F ) ); photo.updateFromFileMetadata( instanceFile ); txw.commit(); return photo; }
public static PhotoInfo addToDB( File imgFile ) throws PhotoNotFoundException { VolumeBase vol = null; try { vol = VolumeBase.getVolumeOfFile( imgFile ); } catch (IOException ex) { throw new PhotoNotFoundException(); } // Determine the fle that will be added as an instance File instanceFile = null; if ( vol == null ) { /* The "normal" case: we are adding a photo that is not part of any volume. Copy the file to the archive. */ vol = VolumeBase.getDefaultVolume(); instanceFile = vol.getFilingFname( imgFile ); // try { FileInputStream in = new FileInputStream( imgFile ); FileOutputStream out = new FileOutputStream( instanceFile ); byte buf[] = new byte[1024]; int nRead = 0; int offset = 0; while ( (nRead = in.read( buf )) > 0 ) { out.write( buf, 0, nRead ); offset += nRead; } out.close(); in.close(); } catch ( Exception e ) { log.warn( "Error copying file: " + e.getMessage() ); throw new PhotoNotFoundException(); } } else if ( vol instanceof ExternalVolume ) { // Thisfile is in an external volume so we do not need a copy instanceFile = imgFile; } else if ( vol instanceof Volume ) { // Adding file from normal volume is not permitted throw new PhotoNotFoundException(); } else { throw new java.lang.Error( "Unknown subclass of VolumeBase: " + vol.getClass().getName() ); } // Create the image ODMGXAWrapper txw = new ODMGXAWrapper(); PhotoInfo photo = PhotoInfo.create(); txw.lock( photo, Transaction.WRITE ); photo.addInstance( vol, instanceFile, ImageInstance.INSTANCE_TYPE_ORIGINAL ); photo.setOrigFname( imgFile.getName() ); java.util.Date shootTime = new java.util.Date( imgFile.lastModified() ); photo.setShootTime( shootTime ); photo.setCropBounds( new Rectangle2D.Float( 0.0F, 0.0F, 1.0F, 1.0F ) ); photo.updateFromFileMetadata( instanceFile ); txw.commit(); return photo; }
1,108,665
static public PhotoInfo[] retrieveByOrigHash(byte[] hash) { ODMGXAWrapper txw = new ODMGXAWrapper(); Implementation odmg = ODMG.getODMGImplementation(); Transaction tx = odmg.currentTransaction(); PhotoInfo photos[] = null; try { PersistenceBroker broker = ((HasBroker) tx).getBroker(); Criteria crit = new Criteria(); crit.addEqualTo( "hash", hash ); QueryByCriteria q = new QueryByCriteria( PhotoInfo.class, crit ); Collection result = broker.getCollectionByQuery( q ); if ( result.size() > 0 ) { photos = (PhotoInfo[]) result.toArray( new PhotoInfo[0] ); } txw.commit(); } catch ( Exception e ) { log.warn( "Error executing query: " + e.getMessage() ); e.printStackTrace( System.out ); txw.abort(); } return photos; }
static public PhotoInfo[] retrieveByOrigHash(byte[] hash) { ODMGXAWrapper txw = new ODMGXAWrapper(); Implementation odmg = ODMG.getODMGImplementation(); Transaction tx = odmg.currentTransaction(); PhotoInfo photos[] = null; try { PersistenceBroker broker = ((HasBroker) tx).getBroker(); Criteria crit = new Criteria(); crit.addEqualTo( "hash", hash ); QueryByCriteria q = new QueryByCriteria( PhotoInfo.class, crit ); Collection result = broker.getCollectionByQuery( q ); if ( result.size() > 0 ) { photos = (PhotoInfo[]) result.toArray( new PhotoInfo[result.size()] ); } txw.commit(); } catch ( Exception e ) { log.warn( "Error executing query: " + e.getMessage() ); e.printStackTrace( System.out ); txw.abort(); } return photos; }
1,108,666
public void stateChanged(ChangeEvent e) { if (tabs.getSelectedIndex() != -1){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); int tabNum = tabs.getSelectedIndex(); if (tabNum == VIEW_D_NUM || tabNum == VIEW_HAP_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(true); }else if (tabNum == VIEW_ASSOC_NUM || tabNum == VIEW_CHECK_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } //if we've adjusted the haps display thresh we need to change the haps ass panel if (tabNum == VIEW_ASSOC_NUM){ //todo: this is borken /* JTabbedPane metaAssoc= (JTabbedPane)tabs.getComponentAt(tabNum); //this is the haps ass tab inside the assoc super-tab HaploAssocPanel htp = (HaploAssocPanel) metaAssoc.getComponent(1); if (htp.initialHaplotypeDisplayThreshold != Options.getHaplotypeDisplayThreshold()){ htp.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } }*/ } if (tabNum == VIEW_D_NUM){ keyMenu.setEnabled(true); }else{ keyMenu.setEnabled(false); } viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel != null && checkPanel.changed){ //first store up the current blocks Vector currentBlocks = new Vector(); for (int blocks = 0; blocks < theData.blocks.size(); blocks++){ int thisBlock[] = (int[]) theData.blocks.elementAt(blocks); int thisBlockReal[] = new int[thisBlock.length]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlockReal[marker] = Chromosome.realIndex[thisBlock[marker]]; } currentBlocks.add(thisBlockReal); } Chromosome.doFilter(checkPanel.getMarkerResults()); //after editing the filtered marker list, needs to be prodded into //resizing correctly dPrimeDisplay.computePreferredSize(); dPrimeDisplay.colorDPrime(); hapDisplay.theData = theData; if (currentBlockDef != BLOX_CUSTOM){ changeBlocks(currentBlockDef); }else{ //adjust the blocks Vector theBlocks = new Vector(); for (int x = 0; x < currentBlocks.size(); x++){ Vector goodies = new Vector(); int currentBlock[] = (int[])currentBlocks.elementAt(x); for (int marker = 0; marker < currentBlock.length; marker++){ for (int y = 0; y < Chromosome.realIndex.length; y++){ //we only keep markers from the input that are "good" from checkdata //we also realign the input file to the current "good" subset since input is //indexed of all possible markers in the dataset if (Chromosome.realIndex[y] == currentBlock[marker]){ goodies.add(new Integer(y)); } } } int thisBlock[] = new int[goodies.size()]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlock[marker] = ((Integer)goodies.elementAt(marker)).intValue(); } if (thisBlock.length > 1){ theBlocks.add(thisBlock); } } theData.guessBlocks(BLOX_CUSTOM, theBlocks); } if (tdtPanel != null){ tdtPanel.refreshTable(); } if (taggerConfigPanel != null){ taggerConfigPanel.refreshTable(); } if(permutationPanel != null) { permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ try{ hapDisplay.getHaps(); if(Options.getAssocTest() != ASSOC_NONE) { //this is the haps ass tab inside the assoc super-tab hapAssocPanel.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); theData.blocksChanged = false; } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
public void stateChanged(ChangeEvent e) { if (tabs.getSelectedIndex() != -1){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); int tabNum = tabs.getSelectedIndex(); if (tabNum == VIEW_D_NUM || tabNum == VIEW_HAP_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(true); }else if (tabNum == VIEW_ASSOC_NUM || tabNum == VIEW_CHECK_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } //if we've adjusted the haps display thresh we need to change the haps ass panel if (tabNum == VIEW_ASSOC_NUM){ //todo: this is borken JTabbedPane metaAssoc= (JTabbedPane)tabs.getComponentAt(tabNum); //this is the haps ass tab inside the assoc super-tab HaploAssocPanel htp = (HaploAssocPanel) metaAssoc.getComponent(1); if (htp.initialHaplotypeDisplayThreshold != Options.getHaplotypeDisplayThreshold()){ htp.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } }*/ } if (tabNum == VIEW_D_NUM){ keyMenu.setEnabled(true); }else{ keyMenu.setEnabled(false); } viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel != null && checkPanel.changed){ //first store up the current blocks Vector currentBlocks = new Vector(); for (int blocks = 0; blocks < theData.blocks.size(); blocks++){ int thisBlock[] = (int[]) theData.blocks.elementAt(blocks); int thisBlockReal[] = new int[thisBlock.length]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlockReal[marker] = Chromosome.realIndex[thisBlock[marker]]; } currentBlocks.add(thisBlockReal); } Chromosome.doFilter(checkPanel.getMarkerResults()); //after editing the filtered marker list, needs to be prodded into //resizing correctly dPrimeDisplay.computePreferredSize(); dPrimeDisplay.colorDPrime(); hapDisplay.theData = theData; if (currentBlockDef != BLOX_CUSTOM){ changeBlocks(currentBlockDef); }else{ //adjust the blocks Vector theBlocks = new Vector(); for (int x = 0; x < currentBlocks.size(); x++){ Vector goodies = new Vector(); int currentBlock[] = (int[])currentBlocks.elementAt(x); for (int marker = 0; marker < currentBlock.length; marker++){ for (int y = 0; y < Chromosome.realIndex.length; y++){ //we only keep markers from the input that are "good" from checkdata //we also realign the input file to the current "good" subset since input is //indexed of all possible markers in the dataset if (Chromosome.realIndex[y] == currentBlock[marker]){ goodies.add(new Integer(y)); } } } int thisBlock[] = new int[goodies.size()]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlock[marker] = ((Integer)goodies.elementAt(marker)).intValue(); } if (thisBlock.length > 1){ theBlocks.add(thisBlock); } } theData.guessBlocks(BLOX_CUSTOM, theBlocks); } if (tdtPanel != null){ tdtPanel.refreshTable(); } if (taggerConfigPanel != null){ taggerConfigPanel.refreshTable(); } if(permutationPanel != null) { permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ try{ hapDisplay.getHaps(); if(Options.getAssocTest() != ASSOC_NONE) { //this is the haps ass tab inside the assoc super-tab hapAssocPanel.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); theData.blocksChanged = false; } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
1,108,667
public void stateChanged(ChangeEvent e) { if (tabs.getSelectedIndex() != -1){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); int tabNum = tabs.getSelectedIndex(); if (tabNum == VIEW_D_NUM || tabNum == VIEW_HAP_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(true); }else if (tabNum == VIEW_ASSOC_NUM || tabNum == VIEW_CHECK_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } //if we've adjusted the haps display thresh we need to change the haps ass panel if (tabNum == VIEW_ASSOC_NUM){ //todo: this is borken /* JTabbedPane metaAssoc= (JTabbedPane)tabs.getComponentAt(tabNum); //this is the haps ass tab inside the assoc super-tab HaploAssocPanel htp = (HaploAssocPanel) metaAssoc.getComponent(1); if (htp.initialHaplotypeDisplayThreshold != Options.getHaplotypeDisplayThreshold()){ htp.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } }*/ } if (tabNum == VIEW_D_NUM){ keyMenu.setEnabled(true); }else{ keyMenu.setEnabled(false); } viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel != null && checkPanel.changed){ //first store up the current blocks Vector currentBlocks = new Vector(); for (int blocks = 0; blocks < theData.blocks.size(); blocks++){ int thisBlock[] = (int[]) theData.blocks.elementAt(blocks); int thisBlockReal[] = new int[thisBlock.length]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlockReal[marker] = Chromosome.realIndex[thisBlock[marker]]; } currentBlocks.add(thisBlockReal); } Chromosome.doFilter(checkPanel.getMarkerResults()); //after editing the filtered marker list, needs to be prodded into //resizing correctly dPrimeDisplay.computePreferredSize(); dPrimeDisplay.colorDPrime(); hapDisplay.theData = theData; if (currentBlockDef != BLOX_CUSTOM){ changeBlocks(currentBlockDef); }else{ //adjust the blocks Vector theBlocks = new Vector(); for (int x = 0; x < currentBlocks.size(); x++){ Vector goodies = new Vector(); int currentBlock[] = (int[])currentBlocks.elementAt(x); for (int marker = 0; marker < currentBlock.length; marker++){ for (int y = 0; y < Chromosome.realIndex.length; y++){ //we only keep markers from the input that are "good" from checkdata //we also realign the input file to the current "good" subset since input is //indexed of all possible markers in the dataset if (Chromosome.realIndex[y] == currentBlock[marker]){ goodies.add(new Integer(y)); } } } int thisBlock[] = new int[goodies.size()]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlock[marker] = ((Integer)goodies.elementAt(marker)).intValue(); } if (thisBlock.length > 1){ theBlocks.add(thisBlock); } } theData.guessBlocks(BLOX_CUSTOM, theBlocks); } if (tdtPanel != null){ tdtPanel.refreshTable(); } if (taggerConfigPanel != null){ taggerConfigPanel.refreshTable(); } if(permutationPanel != null) { permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ try{ hapDisplay.getHaps(); if(Options.getAssocTest() != ASSOC_NONE) { //this is the haps ass tab inside the assoc super-tab hapAssocPanel.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); theData.blocksChanged = false; } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
public void stateChanged(ChangeEvent e) { if (tabs.getSelectedIndex() != -1){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); int tabNum = tabs.getSelectedIndex(); if (tabNum == VIEW_D_NUM || tabNum == VIEW_HAP_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(true); }else if (tabNum == VIEW_ASSOC_NUM || tabNum == VIEW_CHECK_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } //if we've adjusted the haps display thresh we need to change the haps ass panel if (tabNum == VIEW_ASSOC_NUM){ //todo: this is borken /* JTabbedPane metaAssoc= (JTabbedPane)tabs.getComponentAt(tabNum); //this is the haps ass tab inside the assoc super-tab HaploAssocPanel htp = (HaploAssocPanel) metaAssoc.getComponent(1); if (htp.initialHaplotypeDisplayThreshold != Options.getHaplotypeDisplayThreshold()){ htp.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } } if (tabNum == VIEW_D_NUM){ keyMenu.setEnabled(true); }else{ keyMenu.setEnabled(false); } viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel != null && checkPanel.changed){ //first store up the current blocks Vector currentBlocks = new Vector(); for (int blocks = 0; blocks < theData.blocks.size(); blocks++){ int thisBlock[] = (int[]) theData.blocks.elementAt(blocks); int thisBlockReal[] = new int[thisBlock.length]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlockReal[marker] = Chromosome.realIndex[thisBlock[marker]]; } currentBlocks.add(thisBlockReal); } Chromosome.doFilter(checkPanel.getMarkerResults()); //after editing the filtered marker list, needs to be prodded into //resizing correctly dPrimeDisplay.computePreferredSize(); dPrimeDisplay.colorDPrime(); hapDisplay.theData = theData; if (currentBlockDef != BLOX_CUSTOM){ changeBlocks(currentBlockDef); }else{ //adjust the blocks Vector theBlocks = new Vector(); for (int x = 0; x < currentBlocks.size(); x++){ Vector goodies = new Vector(); int currentBlock[] = (int[])currentBlocks.elementAt(x); for (int marker = 0; marker < currentBlock.length; marker++){ for (int y = 0; y < Chromosome.realIndex.length; y++){ //we only keep markers from the input that are "good" from checkdata //we also realign the input file to the current "good" subset since input is //indexed of all possible markers in the dataset if (Chromosome.realIndex[y] == currentBlock[marker]){ goodies.add(new Integer(y)); } } } int thisBlock[] = new int[goodies.size()]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlock[marker] = ((Integer)goodies.elementAt(marker)).intValue(); } if (thisBlock.length > 1){ theBlocks.add(thisBlock); } } theData.guessBlocks(BLOX_CUSTOM, theBlocks); } if (tdtPanel != null){ tdtPanel.refreshTable(); } if (taggerConfigPanel != null){ taggerConfigPanel.refreshTable(); } if(permutationPanel != null) { permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ try{ hapDisplay.getHaps(); if(Options.getAssocTest() != ASSOC_NONE) { //this is the haps ass tab inside the assoc super-tab hapAssocPanel.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); theData.blocksChanged = false; } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
1,108,668
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 || format == COMPRESSED_PNG_MODE){ BufferedImage image = null; if (tabNum == VIEW_D_NUM){ try { if (format == PNG_MODE){ image = dPrimeDisplay.export(start, stop, false); }else{ image = dPrimeDisplay.export(start, stop, true); } } catch(HaploViewException hve) { JOptionPane.showMessageDialog(this, hve.getMessage(), "Export Error", JOptionPane.ERROR_MESSAGE); } }else if (tabNum == VIEW_HAP_NUM){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } if (image != null){ 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){ checkPanel.printTable(outfile); }else if (tabNum == VIEW_ASSOC_NUM){ StringBuffer header = new StringBuffer(); Component selectedTab = ((JTabbedPane)tabs.getComponent(tabNum)).getSelectedComponent(); if(selectedTab == tdtPanel){ tdtPanel.getTestSet().saveSNPsToText(outfile); }else if (selectedTab == hapAssocPanel){ hapAssocPanel.getTestSet().saveHapsToText(outfile); }else if (selectedTab == permutationPanel){ permutationPanel.export(outfile); }else if (selectedTab == custAssocPanel){ custAssocPanel.getTestSet().saveResultsToText(outfile); } } }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 || format == COMPRESSED_PNG_MODE){ BufferedImage image = null; if (tabNum == VIEW_D_NUM){ try { if (format == PNG_MODE){ image = dPrimeDisplay.export(start, stop, false); }else{ image = dPrimeDisplay.export(start, stop, true); } } catch(HaploViewException hve) { JOptionPane.showMessageDialog(this, hve.getMessage(), "Export Error", JOptionPane.ERROR_MESSAGE); } }else if (tabNum == VIEW_HAP_NUM){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } if (image != null){ 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){ checkPanel.printTable(outfile); }else if (tabNum == VIEW_ASSOC_NUM){ Component selectedTab = ((JTabbedPane)tabs.getComponent(tabNum)).getSelectedComponent(); if(selectedTab == tdtPanel){ tdtPanel.getTestSet().saveSNPsToText(outfile); }else if (selectedTab == hapAssocPanel){ hapAssocPanel.getTestSet().saveHapsToText(outfile); }else if (selectedTab == permutationPanel){ permutationPanel.export(outfile); }else if (selectedTab == custAssocPanel){ custAssocPanel.getTestSet().saveResultsToText(outfile); } } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }
1,108,669
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet)); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } //tagger display //if(Options.isUseTagger()) { //TaggerController tagControl = new TaggerController(theData,null,null,null); taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab("Tagger",tagTabs); //} tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet)); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } //tagger display //if(Options.isUseTagger()) { //TaggerController tagControl = new TaggerController(theData,null,null,null); taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab("Tagger",tagTabs); //} tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
1,108,670
public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet)); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } //tagger display //if(Options.isUseTagger()) { //TaggerController tagControl = new TaggerController(theData,null,null,null); taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab("Tagger",tagTabs); //} tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; }
public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet)); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } //tagger display //if(Options.isUseTagger()) { //TaggerController tagControl = new TaggerController(theData,null,null,null); taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab("Tagger",tagTabs); //} tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; }
1,108,671
public void paintComponent(Graphics g){ PairwiseLinkage[][] dPrimeTable = theData.filteredDPrimeTable; if (dPrimeTable.length == 0){ //if there are no valid markers, but info is known we don't want //to paint any of that stuff. printDPrimeValues = false; printMarkerNames = false; } Vector blocks = theData.blocks; Rectangle visRect = getVisibleRect(); //deal with zooming if (chartSize.getWidth() > (3*visRect.width)){ showWM = true; }else{ showWM = false; } if (zoomLevel != 0 || currentScheme == WMF_SCHEME || currentScheme == RSQ_SCHEME){ printDPrimeValues = false; } else{ printDPrimeValues = true; } if (zoomLevel == 0){ printMarkerNames = true; } else{ printMarkerNames = false; } Graphics2D g2 = (Graphics2D) g; Dimension size = getSize(); Dimension pref = getPreferredSize(); g2.setColor(BG_GREY); //if it's a big dataset, resize properly, if it's small make sure to fill whole background if (size.height < pref.height){ g2.fillRect(0,0,pref.width,pref.height); setSize(pref); }else{ g2.fillRect(0,0,size.width, size.height); } g2.setColor(Color.black); //okay so this dumb if block is to prevent the ugly repainting //bug when loading markers after the data are already being displayed, //results in a little off-centering for small datasets, but not too bad. if (!forExport){ if (!theData.infoKnown){ g2.translate((size.width - pref.width) / 2, (size.height - pref.height) / 2); } else { g2.translate((size.width - pref.width) / 2, 0); } } FontMetrics boxFontMetrics = g2.getFontMetrics(boxFont); int diamondX[] = new int[4]; int diamondY[] = new int[4]; Polygon diamond; left = H_BORDER; top = V_BORDER; if (forExport){ left -= exportStart * boxSize; } FontMetrics metrics; int ascent; g2.setFont(boldMarkerNameFont); metrics = g2.getFontMetrics(); ascent = metrics.getAscent(); //TODO: finish implementing scaling gizmo /*//deal with adding some space to better display data with large gaps int cumulativeGap[] = new int[Chromosome.getFilteredSize()]; for (int i = 0; i < cumulativeGap.length; i++){ cumulativeGap[i] = 0; } if (theData.infoKnown){ double mean = (((SNP)Chromosome.markers[Chromosome.markers.length-1]).getPosition() - ((SNP)Chromosome.markers[0]).getPosition())/Chromosome.markers.length-1; for (int i = 1; i < cumulativeGap.length; i++){ double sep = Chromosome.getMarker(i).getPosition() - Chromosome.getMarker(i-1).getPosition(); if (sep > mean*10){ cumulativeGap[i] = cumulativeGap[i-1] + (int)(sep/mean)*4; }else{ cumulativeGap[i] = cumulativeGap[i-1]; } } } */ //the following values are the bounds on the boxes we want to //display given that the current window is 'visRect' lowX = (visRect.x-clickXShift-(visRect.y + visRect.height-clickYShift))/boxSize; if (lowX < 0) { lowX = 0; } highX = ((visRect.x + visRect.width)/boxSize)+1; if (highX > dPrimeTable.length-1){ highX = dPrimeTable.length-1; } lowY = ((visRect.x-clickXShift)+(visRect.y-clickYShift))/boxSize; if (lowY < lowX+1){ lowY = lowX+1; } highY = (((visRect.x-clickXShift+visRect.width) + (visRect.y-clickYShift+visRect.height))/boxSize)+1; if (highY > dPrimeTable.length){ highY = dPrimeTable.length; } if (forExport){ lowX = exportStart; lowY = exportStart; highX = exportStop; highY = exportStop; } int lineSpan = (dPrimeTable.length-1) * boxSize; long minpos = Chromosome.getMarker(0).getPosition(); long maxpos = Chromosome.getMarker(Chromosome.getSize()-1).getPosition(); double spanpos = maxpos - minpos; if (theData.trackExists){ //draw the analysis track above where the marker positions will be marked g2.setColor(Color.white); g2.fillRect(left, top, lineSpan, TRACK_HEIGHT); g2.setColor(Color.black); g2.drawRect(left, top, lineSpan, TRACK_HEIGHT); //get the data into an easier format double positions[] = new double[theData.analysisPositions.size()]; double values[] = new double[theData.analysisPositions.size()]; for (int x = 0; x < positions.length; x++){ positions[x] = ((Double)theData.analysisPositions.elementAt(x)).doubleValue(); values[x] = ((Double)theData.analysisValues.elementAt(x)).doubleValue(); } g2.setColor(Color.black); double min = Double.MAX_VALUE; double max = -min; for (int x = 0; x < positions.length; x++){ if(values[x] < min){ min = values[x]; } if (values[x] > max){ max = values[x]; } } double range = max-min; //todo: this is kinda hideous for (int x = 0; x < positions.length - 1; x++){ if (positions[x] >= minpos && positions[x+1] <= maxpos){ g2.draw(new Line2D.Double(lineSpan * Math.abs((positions[x] - minpos)/spanpos) + left, top + TRACK_PALETTE + TRACK_BUMPER - (TRACK_PALETTE * Math.abs((values[x] - min)/range)), lineSpan * Math.abs((positions[x+1] - minpos)/spanpos) + left, top + TRACK_PALETTE + TRACK_BUMPER - (TRACK_PALETTE * Math.abs((values[x+1] - min)/range)))); } } top += TRACK_HEIGHT + TRACK_GAP; } if (theData.infoKnown) { Color green = new Color(0, 127, 0); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //// draw the marker locations g2.setStroke(thinnerStroke); g2.setColor(Color.white); g2.fillRect(left+1, top+1, lineSpan-1, TICK_HEIGHT-1); g2.setColor(Color.black); g2.drawRect(left, top, lineSpan, TICK_HEIGHT); for (int i = 0; i < Chromosome.getFilteredSize(); i++){ double pos = (Chromosome.getFilteredMarker(i).getPosition() - minpos) / spanpos; int xx = (int) (left + lineSpan*pos); // if we're zoomed, use the line color to indicate whether there is extra data available // (since the marker names are not displayed when zoomed) if (Chromosome.getFilteredMarker(i).getExtra() != null && zoomLevel != 0) g2.setColor(green); g2.setStroke(thickerStroke); g2.drawLine(xx, top, xx, top + TICK_HEIGHT); if (Chromosome.getFilteredMarker(i).getExtra() != null && zoomLevel != 0) g2.setStroke(thickerStroke); else g2.setStroke(thinnerStroke); g2.drawLine(xx, top + TICK_HEIGHT, left + i*boxSize, top+TICK_BOTTOM); if (Chromosome.getFilteredMarker(i).getExtra() != null && zoomLevel != 0) g2.setColor(Color.black); } top += TICK_BOTTOM + TICK_HEIGHT; //// draw the marker names if (printMarkerNames){ widestMarkerName = metrics.stringWidth(Chromosome.getFilteredMarker(0).getName()); for (int x = 1; x < dPrimeTable.length; x++) { int thiswide = metrics.stringWidth(Chromosome.getFilteredMarker(x).getName()); if (thiswide > widestMarkerName) widestMarkerName = thiswide; } g2.translate(left, top + widestMarkerName); g2.rotate(-Math.PI / 2.0); for (int x = 0; x < dPrimeTable.length; x++) { if (theData.isInBlock[x]){ g2.setFont(boldMarkerNameFont); }else{ g2.setFont(markerNameFont); } if (Chromosome.getFilteredMarker(x).getExtra() != null) g2.setColor(green); g2.drawString(Chromosome.getFilteredMarker(x).getName(),TEXT_GAP, x*boxSize + ascent/3); if (Chromosome.getFilteredMarker(x).getExtra() != null) g2.setColor(Color.black); } g2.rotate(Math.PI / 2.0); g2.translate(-left, -(top + widestMarkerName)); // move everybody down top += widestMarkerName + TEXT_GAP; } g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } top += blockDispHeight; //// draw the marker numbers if (printMarkerNames){ g2.setFont(markerNumFont); metrics = g2.getFontMetrics(); ascent = metrics.getAscent(); for (int x = 0; x < dPrimeTable.length; x++) { String mark = String.valueOf(Chromosome.realIndex[x] + 1); g2.drawString(mark, left + x*boxSize - metrics.stringWidth(mark)/2, top + ascent); } top += boxRadius/2; // give a little space between numbers and boxes } //clickxshift and clickyshift are used later to translate from x,y coords //to the pair of markers comparison at those coords if (!(theData.infoKnown)){ clickXShift = left + (size.width-pref.width)/2; clickYShift = top + (size.height - pref.height)/2; } else { clickXShift = left + (size.width-pref.width)/2; clickYShift = top; } // draw table column by column for (int x = lowX; x < highX; x++) { //always draw the fewest possible boxes if (lowY < x+1){ lowY = x+1; } for (int y = lowY; y < highY; y++) { if (dPrimeTable[x][y] == null){ continue; } double d = dPrimeTable[x][y].getDPrime(); //double l = dPrimeTable[x][y].getLOD(); Color boxColor = dPrimeTable[x][y].getColor(); // draw markers above int xx = left + (x + y) * boxSize / 2; int yy = top + (y - x) * boxSize / 2; diamondX[0] = xx; diamondY[0] = yy - boxRadius; diamondX[1] = xx + boxRadius; diamondY[1] = yy; diamondX[2] = xx; diamondY[2] = yy + boxRadius; diamondX[3] = xx - boxRadius; diamondY[3] = yy; diamond = new Polygon(diamondX, diamondY, 4); g2.setColor(boxColor); g2.fillPolygon(diamond); if(printDPrimeValues){ g2.setFont(boxFont); ascent = boxFontMetrics.getAscent(); int val = (int) (d * 100); g2.setColor((val < 50) ? Color.gray : Color.black); if (boxColor == Color.darkGray){ g2.setColor(Color.white); } if (val != 100) { String valu = String.valueOf(val); int widf = boxFontMetrics.stringWidth(valu); g.drawString(valu, xx - widf/2, yy + ascent/2); } } } } boolean even = true; //highlight blocks g2.setFont(markerNameFont); ascent = g2.getFontMetrics().getAscent(); //g.setColor(new Color(153,255,153)); g2.setColor(Color.black); //g.setColor(new Color(51,153,51)); for (int i = 0; i < blocks.size(); i++){ int[] theBlock = (int[])blocks.elementAt(i); int first = theBlock[0]; int last = theBlock[theBlock.length-1]; //big vee around whole thing g2.setStroke(fatStroke); g2.drawLine(left + (2*first) * boxSize/2 - boxRadius, top, left + (first + last) * boxSize/2, top + (last - first) * boxSize/2 + boxRadius); g2.drawLine(left + (first + last) * boxSize/2, top + (last - first) * boxSize/2 + boxRadius, left + (2*last) * boxSize/2+boxRadius, top); for (int j = first; j <= last; j++){ if (theData.isInBlock[j]){ g2.setStroke(fatStroke); }else{ g2.setStroke(dashedFatStroke); } g2.drawLine(left+j*boxSize-boxSize/2, top-blockDispHeight, left+j*boxSize+boxSize/2, top-blockDispHeight); } //lines to connect to block display g2.setStroke(fatStroke); g2.drawLine(left + first*boxSize-boxSize/2, top-1, left+first*boxSize-boxSize/2, top-blockDispHeight); g2.drawLine(left+last*boxSize+boxSize/2, top-1, left+last*boxSize+boxSize/2, top-blockDispHeight); if (printMarkerNames){ String labelString = new String ("Block " + (i+1)); if (theData.infoKnown){ long blockSize = Chromosome.getFilteredMarker(last).getPosition() - Chromosome.getFilteredMarker(first).getPosition(); labelString += " (" + blockSize/1000 + " kb)"; } g2.drawString(labelString, left+first*boxSize-boxSize/2+TEXT_GAP, top-boxSize/3); } } g2.setStroke(thickerStroke); //see if the user has right-clicked to popup some marker info if(popupExists){ int smallDatasetSlopH = 0; int smallDatasetSlopV = 0; if (pref.getWidth() < visRect.width){ //dumb bug where little datasets popup the box in the wrong place smallDatasetSlopH = (int)(visRect.width - pref.getWidth())/2; smallDatasetSlopV = (int)(visRect.height - pref.getHeight())/2; } g2.setColor(Color.white); g2.fillRect(popupDrawRect.x+1-smallDatasetSlopH, popupDrawRect.y+1-smallDatasetSlopV, popupDrawRect.width-1, popupDrawRect.height-1); g2.setColor(Color.black); g2.drawRect(popupDrawRect.x-smallDatasetSlopH, popupDrawRect.y-smallDatasetSlopV, popupDrawRect.width, popupDrawRect.height); for (int x = 0; x < displayStrings.length; x++){ g.drawString(displayStrings[x],popupDrawRect.x + popupLeftMargin-smallDatasetSlopH, popupDrawRect.y+((x+1)*metrics.getHeight())-smallDatasetSlopV); } } if (showWM && !forExport){ //dataset is big enough to require worldmap final int WM_BD_GAP = 1; final int WM_BD_HEIGHT = 2; final int WM_BD_TOTAL = WM_BD_HEIGHT + 2*WM_BD_GAP; CompoundBorder wmBorder = new CompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder()); if (wmMaxWidth == 0){ wmMaxWidth = visRect.width/3; } double scalefactor; scalefactor = (double)(chartSize.width)/wmMaxWidth; double prefBoxSize = boxSize/(scalefactor*((double)wmMaxWidth/(double)(wmMaxWidth-WM_BD_TOTAL))); if (noImage){ //first time through draw a worldmap if dataset is big: worldmap = new BufferedImage((int)(chartSize.width/scalefactor)+wmBorder.getBorderInsets(this).left*2, (int)(chartSize.height/scalefactor)+wmBorder.getBorderInsets(this).top*2+WM_BD_TOTAL, BufferedImage.TYPE_3BYTE_BGR); Graphics gw = worldmap.getGraphics(); Graphics2D gw2 = (Graphics2D)(gw); gw2.setColor(BG_GREY); gw2.fillRect(1,1,worldmap.getWidth()-1,worldmap.getHeight()-1); //make a pretty border gw2.setColor(Color.black); wmBorder.paintBorder(this,gw2,0,0,worldmap.getWidth(),worldmap.getHeight()); wmInteriorRect = wmBorder.getInteriorRectangle(this,0,0,worldmap.getWidth(), worldmap.getHeight()); float[] smallDiamondX = new float[4]; float[] smallDiamondY = new float[4]; GeneralPath gp; for (int x = 0; x < dPrimeTable.length-1; x++){ for (int y = x+1; y < dPrimeTable.length; y++){ if (dPrimeTable[x][y] == null){ continue; } double xx = (x + y)*prefBoxSize/2+wmBorder.getBorderInsets(this).left; double yy = (y - x)*prefBoxSize/2+wmBorder.getBorderInsets(this).top + WM_BD_TOTAL; smallDiamondX[0] = (float)xx; smallDiamondY[0] = (float)(yy - prefBoxSize/2); smallDiamondX[1] = (float)(xx + prefBoxSize/2); smallDiamondY[1] = (float)yy; smallDiamondX[2] = (float)xx; smallDiamondY[2] = (float)(yy + prefBoxSize/2); smallDiamondX[3] = (float)(xx - prefBoxSize/2); smallDiamondY[3] = (float)yy; gp = new GeneralPath(GeneralPath.WIND_EVEN_ODD, smallDiamondX.length); gp.moveTo(smallDiamondX[0],smallDiamondY[0]); for (int i = 1; i < smallDiamondX.length; i++){ gp.lineTo(smallDiamondX[i], smallDiamondY[i]); } gp.closePath(); gw2.setColor(dPrimeTable[x][y].getColor()); gw2.fill(gp); } } noImage = false; } //draw block display in worldmap Graphics gw = worldmap.getGraphics(); Graphics2D gw2 = (Graphics2D)(gw); gw2.setColor(BG_GREY); gw2.fillRect(wmBorder.getBorderInsets(this).left, wmBorder.getBorderInsets(this).top+WM_BD_GAP, wmInteriorRect.width, WM_BD_HEIGHT); gw2.setColor(Color.black); even = true; for (int i = 0; i < blocks.size(); i++){ int first = ((int[])blocks.elementAt(i))[0]; int last = ((int[])blocks.elementAt(i))[((int[])blocks.elementAt(i)).length-1]; int voffset; if (even){ voffset = 0; }else{ voffset = WM_BD_HEIGHT/2; } gw2.fillRect(wmBorder.getBorderInsets(this).left+(int)(prefBoxSize*first), wmBorder.getBorderInsets(this).top+voffset+WM_BD_GAP, (int)((last-first+1)*prefBoxSize), WM_BD_HEIGHT/2); even = !even; } wmResizeCorner = new Rectangle(visRect.x + worldmap.getWidth() - (worldmap.getWidth()-wmInteriorRect.width)/2, visRect.y + visRect.height - worldmap.getHeight(), (worldmap.getWidth()-wmInteriorRect.width)/2, (worldmap.getHeight() -wmInteriorRect.height)/2); g2.drawImage(worldmap,visRect.x, visRect.y + visRect.height - worldmap.getHeight(), this); wmInteriorRect.x = visRect.x + (worldmap.getWidth() - wmInteriorRect.width)/2; wmInteriorRect.y = visRect.y+visRect.height-worldmap.getHeight() + (worldmap.getHeight() - wmInteriorRect.height)/2; //draw the outline of the viewport g2.setColor(Color.black); double hRatio = wmInteriorRect.getWidth()/pref.getWidth(); double vRatio = wmInteriorRect.getHeight()/pref.getHeight(); int hBump = worldmap.getWidth()-wmInteriorRect.width; int vBump = worldmap.getHeight()-wmInteriorRect.height; //bump a few pixels to avoid drawing on the border g2.drawRect((int)(visRect.x*hRatio)+hBump/2+visRect.x, (int)(visRect.y*vRatio)+vBump/2+(visRect.y + visRect.height - worldmap.getHeight()), (int)(visRect.width*hRatio), (int)(visRect.height*vRatio)); } //see if we're drawing a worldmap resize rect if (resizeRectExists){ g2.setColor(Color.black); g2.drawRect(resizeWMRect.x, resizeWMRect.y, resizeWMRect.width, resizeWMRect.height); } //see if we're drawing a block selector rect if (blockRectExists){ g2.setColor(Color.black); g2.setStroke(dashedThinStroke); g2.drawRect(blockRect.x, blockRect.y, blockRect.width, blockRect.height); } }
public void paintComponent(Graphics g){ PairwiseLinkage[][] dPrimeTable = theData.filteredDPrimeTable; if (dPrimeTable.length == 0){ //if there are no valid markers, but info is known we don't want //to paint any of that stuff. printDPrimeValues = false; printMarkerNames = false; } Vector blocks = theData.blocks; Rectangle visRect = getVisibleRect(); //deal with zooming if (chartSize.getWidth() > (3*visRect.width)){ showWM = true; }else{ showWM = false; } if (zoomLevel != 0 || currentScheme == WMF_SCHEME || currentScheme == RSQ_SCHEME){ printDPrimeValues = false; } else{ printDPrimeValues = true; } if (zoomLevel == 0){ printMarkerNames = true; } else{ printMarkerNames = false; } Graphics2D g2 = (Graphics2D) g; Dimension size = getSize(); Dimension pref = getPreferredSize(); g2.setColor(BG_GREY); //if it's a big dataset, resize properly, if it's small make sure to fill whole background if (size.height < pref.height){ g2.fillRect(0,0,pref.width,pref.height); setSize(pref); }else{ g2.fillRect(0,0,size.width, size.height); } g2.setColor(Color.black); //okay so this dumb if block is to prevent the ugly repainting //bug when loading markers after the data are already being displayed, //results in a little off-centering for small datasets, but not too bad. if (!forExport){ if (!theData.infoKnown){ g2.translate((size.width - pref.width) / 2, (size.height - pref.height) / 2); } else { g2.translate((size.width - pref.width) / 2, 0); } } FontMetrics boxFontMetrics = g2.getFontMetrics(boxFont); int diamondX[] = new int[4]; int diamondY[] = new int[4]; Polygon diamond; left = H_BORDER; top = V_BORDER; if (forExport){ left -= exportStart * boxSize; } FontMetrics metrics; int ascent; g2.setFont(boldMarkerNameFont); metrics = g2.getFontMetrics(); ascent = metrics.getAscent(); //TODO: finish implementing scaling gizmo /*//deal with adding some space to better display data with large gaps int cumulativeGap[] = new int[Chromosome.getFilteredSize()]; for (int i = 0; i < cumulativeGap.length; i++){ cumulativeGap[i] = 0; } if (theData.infoKnown){ double mean = (((SNP)Chromosome.markers[Chromosome.markers.length-1]).getPosition() - ((SNP)Chromosome.markers[0]).getPosition())/Chromosome.markers.length-1; for (int i = 1; i < cumulativeGap.length; i++){ double sep = Chromosome.getMarker(i).getPosition() - Chromosome.getMarker(i-1).getPosition(); if (sep > mean*10){ cumulativeGap[i] = cumulativeGap[i-1] + (int)(sep/mean)*4; }else{ cumulativeGap[i] = cumulativeGap[i-1]; } } } */ //the following values are the bounds on the boxes we want to //display given that the current window is 'visRect' lowX = (visRect.x-clickXShift-(visRect.y + visRect.height-clickYShift))/boxSize; if (lowX < 0) { lowX = 0; } highX = ((visRect.x + visRect.width)/boxSize)+1; if (highX > dPrimeTable.length-1){ highX = dPrimeTable.length-1; } lowY = ((visRect.x-clickXShift)+(visRect.y-clickYShift))/boxSize; if (lowY < lowX+1){ lowY = lowX+1; } highY = (((visRect.x-clickXShift+visRect.width) + (visRect.y-clickYShift+visRect.height))/boxSize)+1; if (highY > dPrimeTable.length){ highY = dPrimeTable.length; } if (forExport){ lowX = exportStart; lowY = exportStart; highX = exportStop; highY = exportStop; } int lineSpan = (dPrimeTable.length-1) * boxSize; long minpos = Chromosome.getMarker(0).getPosition(); long maxpos = Chromosome.getMarker(Chromosome.getSize()-1).getPosition(); double spanpos = maxpos - minpos; if (theData.trackExists){ //draw the analysis track above where the marker positions will be marked g2.setColor(Color.white); g2.fillRect(left, top, lineSpan, TRACK_HEIGHT); g2.setColor(Color.black); g2.drawRect(left, top, lineSpan, TRACK_HEIGHT); //get the data into an easier format double positions[] = new double[theData.analysisPositions.size()]; double values[] = new double[theData.analysisPositions.size()]; for (int x = 0; x < positions.length; x++){ positions[x] = ((Double)theData.analysisPositions.elementAt(x)).doubleValue(); values[x] = ((Double)theData.analysisValues.elementAt(x)).doubleValue(); } g2.setColor(Color.black); double min = Double.MAX_VALUE; double max = -min; for (int x = 0; x < positions.length; x++){ if(values[x] < min){ min = values[x]; } if (values[x] > max){ max = values[x]; } } double range = max-min; //todo: this is kinda hideous for (int x = 0; x < positions.length - 1; x++){ if (positions[x] >= minpos && positions[x+1] <= maxpos){ g2.draw(new Line2D.Double(lineSpan * Math.abs((positions[x] - minpos)/spanpos) + left, top + TRACK_PALETTE + TRACK_BUMPER - (TRACK_PALETTE * Math.abs((values[x] - min)/range)), lineSpan * Math.abs((positions[x+1] - minpos)/spanpos) + left, top + TRACK_PALETTE + TRACK_BUMPER - (TRACK_PALETTE * Math.abs((values[x+1] - min)/range)))); } } top += TRACK_HEIGHT + TRACK_GAP; } if (theData.infoKnown) { Color green = new Color(0, 127, 0); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //// draw the marker locations g2.setStroke(thinnerStroke); g2.setColor(Color.white); g2.fillRect(left+1, top+1, lineSpan-1, TICK_HEIGHT-1); g2.setColor(Color.black); g2.drawRect(left, top, lineSpan, TICK_HEIGHT); for (int i = 0; i < Chromosome.getFilteredSize(); i++){ double pos = (Chromosome.getFilteredMarker(i).getPosition() - minpos) / spanpos; int xx = (int) (left + lineSpan*pos); // if we're zoomed, use the line color to indicate whether there is extra data available // (since the marker names are not displayed when zoomed) if (Chromosome.getFilteredMarker(i).getExtra() != null && zoomLevel != 0) g2.setColor(green); g2.setStroke(thickerStroke); g2.drawLine(xx, top, xx, top + TICK_HEIGHT); if (Chromosome.getFilteredMarker(i).getExtra() != null && zoomLevel != 0) g2.setStroke(thickerStroke); else g2.setStroke(thinnerStroke); g2.drawLine(xx, top + TICK_HEIGHT, left + i*boxSize, top+TICK_BOTTOM); if (Chromosome.getFilteredMarker(i).getExtra() != null && zoomLevel != 0) g2.setColor(Color.black); } top += TICK_BOTTOM + TICK_HEIGHT; //// draw the marker names if (printMarkerNames){ widestMarkerName = metrics.stringWidth(Chromosome.getFilteredMarker(0).getName()); for (int x = 1; x < dPrimeTable.length; x++) { int thiswide = metrics.stringWidth(Chromosome.getFilteredMarker(x).getName()); if (thiswide > widestMarkerName) widestMarkerName = thiswide; } g2.translate(left, top + widestMarkerName); g2.rotate(-Math.PI / 2.0); for (int x = 0; x < dPrimeTable.length; x++) { if (theData.isInBlock[x]){ g2.setFont(boldMarkerNameFont); }else{ g2.setFont(markerNameFont); } if (Chromosome.getFilteredMarker(x).getExtra() != null) g2.setColor(green); g2.drawString(Chromosome.getFilteredMarker(x).getName(),TEXT_GAP, x*boxSize + ascent/3); if (Chromosome.getFilteredMarker(x).getExtra() != null) g2.setColor(Color.black); } g2.rotate(Math.PI / 2.0); g2.translate(-left, -(top + widestMarkerName)); // move everybody down top += widestMarkerName + TEXT_GAP; } g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } top += blockDispHeight; //// draw the marker numbers if (printMarkerNames){ g2.setFont(markerNumFont); metrics = g2.getFontMetrics(); ascent = metrics.getAscent(); for (int x = 0; x < dPrimeTable.length; x++) { String mark = String.valueOf(Chromosome.realIndex[x] + 1); g2.drawString(mark, left + x*boxSize - metrics.stringWidth(mark)/2, top + ascent); } top += boxRadius/2; // give a little space between numbers and boxes } //clickxshift and clickyshift are used later to translate from x,y coords //to the pair of markers comparison at those coords if (!(theData.infoKnown)){ clickXShift = left + (size.width-pref.width)/2; clickYShift = top + (size.height - pref.height)/2; } else { clickXShift = left + (size.width-pref.width)/2; clickYShift = top; } // draw table column by column for (int x = lowX; x < highX; x++) { //always draw the fewest possible boxes if (lowY < x+1){ lowY = x+1; } for (int y = lowY; y < highY; y++) { if (dPrimeTable[x][y] == null){ continue; } double d = dPrimeTable[x][y].getDPrime(); //double l = dPrimeTable[x][y].getLOD(); Color boxColor = dPrimeTable[x][y].getColor(); // draw markers above int xx = left + (x + y) * boxSize / 2; int yy = top + (y - x) * boxSize / 2; diamondX[0] = xx; diamondY[0] = yy - boxRadius; diamondX[1] = xx + boxRadius; diamondY[1] = yy; diamondX[2] = xx; diamondY[2] = yy + boxRadius; diamondX[3] = xx - boxRadius; diamondY[3] = yy; diamond = new Polygon(diamondX, diamondY, 4); g2.setColor(boxColor); g2.fillPolygon(diamond); if(printDPrimeValues){ g2.setFont(boxFont); ascent = boxFontMetrics.getAscent(); int val = (int) (d * 100); g2.setColor((val < 50) ? Color.gray : Color.black); if (boxColor == Color.darkGray){ g2.setColor(Color.white); } if (val != 100) { String valu = String.valueOf(val); int widf = boxFontMetrics.stringWidth(valu); g.drawString(valu, xx - widf/2, yy + ascent/2); } } } } boolean even = true; //highlight blocks g2.setFont(markerNameFont); ascent = g2.getFontMetrics().getAscent(); //g.setColor(new Color(153,255,153)); g2.setColor(Color.black); //g.setColor(new Color(51,153,51)); for (int i = 0; i < blocks.size(); i++){ int[] theBlock = (int[])blocks.elementAt(i); int first = theBlock[0]; int last = theBlock[theBlock.length-1]; //big vee around whole thing g2.setStroke(fatStroke); g2.drawLine(left + (2*first) * boxSize/2 - boxRadius, top, left + (first + last) * boxSize/2, top + (last - first) * boxSize/2 + boxRadius); g2.drawLine(left + (first + last) * boxSize/2, top + (last - first) * boxSize/2 + boxRadius, left + (2*last) * boxSize/2+boxRadius, top); for (int j = first; j <= last; j++){ if (theData.isInBlock[j]){ g2.setStroke(fatStroke); }else{ g2.setStroke(dashedFatStroke); } g2.drawLine(left+j*boxSize-boxSize/2, top-blockDispHeight, left+j*boxSize+boxSize/2, top-blockDispHeight); } //lines to connect to block display g2.setStroke(fatStroke); g2.drawLine(left + first*boxSize-boxSize/2, top-1, left+first*boxSize-boxSize/2, top-blockDispHeight); g2.drawLine(left+last*boxSize+boxSize/2, top-1, left+last*boxSize+boxSize/2, top-blockDispHeight); if (printMarkerNames){ String labelString = new String ("Block " + (i+1)); if (theData.infoKnown){ long blockSize = Chromosome.getFilteredMarker(last).getPosition() - Chromosome.getFilteredMarker(first).getPosition(); labelString += " (" + blockSize/1000 + " kb)"; } g2.drawString(labelString, left+first*boxSize-boxSize/2+TEXT_GAP, top-boxSize/3); } } g2.setStroke(thickerStroke); //see if the user has right-clicked to popup some marker info if(popupExists){ int smallDatasetSlopH = 0; int smallDatasetSlopV = 0; if (pref.getWidth() < visRect.width){ //dumb bug where little datasets popup the box in the wrong place smallDatasetSlopH = (int)(visRect.width - pref.getWidth())/2; smallDatasetSlopV = (int)(visRect.height - pref.getHeight())/2; } g2.setColor(Color.white); g2.fillRect(popupDrawRect.x+1-smallDatasetSlopH, popupDrawRect.y+1-smallDatasetSlopV, popupDrawRect.width-1, popupDrawRect.height-1); g2.setColor(Color.black); g2.drawRect(popupDrawRect.x-smallDatasetSlopH, popupDrawRect.y-smallDatasetSlopV, popupDrawRect.width, popupDrawRect.height); for (int x = 0; x < displayStrings.length; x++){ g.drawString(displayStrings[x],popupDrawRect.x + popupLeftMargin-smallDatasetSlopH, popupDrawRect.y+((x+1)*metrics.getHeight())-smallDatasetSlopV); } } if (showWM && !forExport){ //dataset is big enough to require worldmap final int WM_BD_GAP = 1; final int WM_BD_HEIGHT = 2; final int WM_BD_TOTAL = WM_BD_HEIGHT + 2*WM_BD_GAP; CompoundBorder wmBorder = new CompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder()); if (wmMaxWidth == 0){ wmMaxWidth = visRect.width/3; } double scalefactor; scalefactor = (double)(chartSize.width)/wmMaxWidth; double prefBoxSize = boxSize/(scalefactor*((double)wmMaxWidth/(double)(wmMaxWidth-WM_BD_TOTAL))); if (noImage){ //first time through draw a worldmap if dataset is big: worldmap = new BufferedImage((int)(chartSize.width/scalefactor)+wmBorder.getBorderInsets(this).left*2, (int)(chartSize.height/scalefactor)+wmBorder.getBorderInsets(this).top*2+WM_BD_TOTAL, BufferedImage.TYPE_3BYTE_BGR); Graphics gw = worldmap.getGraphics(); Graphics2D gw2 = (Graphics2D)(gw); gw2.setColor(BG_GREY); gw2.fillRect(1,1,worldmap.getWidth()-1,worldmap.getHeight()-1); //make a pretty border gw2.setColor(Color.black); wmBorder.paintBorder(this,gw2,0,0,worldmap.getWidth(),worldmap.getHeight()); wmInteriorRect = wmBorder.getInteriorRectangle(this,0,0,worldmap.getWidth(), worldmap.getHeight()); float[] smallDiamondX = new float[4]; float[] smallDiamondY = new float[4]; GeneralPath gp; for (int x = 0; x < dPrimeTable.length-1; x++){ for (int y = x+1; y < dPrimeTable.length; y++){ if (dPrimeTable[x][y] == null){ continue; } double xx = (x + y)*prefBoxSize/2+wmBorder.getBorderInsets(this).left; double yy = (y - x)*prefBoxSize/2+wmBorder.getBorderInsets(this).top + WM_BD_TOTAL; smallDiamondX[0] = (float)xx; smallDiamondY[0] = (float)(yy - prefBoxSize/2); smallDiamondX[1] = (float)(xx + prefBoxSize/2); smallDiamondY[1] = (float)yy; smallDiamondX[2] = (float)xx; smallDiamondY[2] = (float)(yy + prefBoxSize/2); smallDiamondX[3] = (float)(xx - prefBoxSize/2); smallDiamondY[3] = (float)yy; gp = new GeneralPath(GeneralPath.WIND_EVEN_ODD, smallDiamondX.length); gp.moveTo(smallDiamondX[0],smallDiamondY[0]); for (int i = 1; i < smallDiamondX.length; i++){ gp.lineTo(smallDiamondX[i], smallDiamondY[i]); } gp.closePath(); gw2.setColor(dPrimeTable[x][y].getColor()); gw2.fill(gp); } } noImage = false; } //draw block display in worldmap Graphics gw = worldmap.getGraphics(); Graphics2D gw2 = (Graphics2D)(gw); gw2.setColor(BG_GREY); gw2.fillRect(wmBorder.getBorderInsets(this).left, wmBorder.getBorderInsets(this).top+WM_BD_GAP, wmInteriorRect.width, WM_BD_HEIGHT); gw2.setColor(Color.black); even = true; for (int i = 0; i < blocks.size(); i++){ int first = ((int[])blocks.elementAt(i))[0]; int last = ((int[])blocks.elementAt(i))[((int[])blocks.elementAt(i)).length-1]; int voffset; if (even){ voffset = 0; }else{ voffset = WM_BD_HEIGHT/2; } gw2.fillRect(wmBorder.getBorderInsets(this).left+(int)(prefBoxSize*first), wmBorder.getBorderInsets(this).top+voffset+WM_BD_GAP, (int)((last-first+1)*prefBoxSize), WM_BD_HEIGHT/2); even = !even; } wmResizeCorner = new Rectangle(visRect.x + worldmap.getWidth() - (worldmap.getWidth()-wmInteriorRect.width)/2, visRect.y + visRect.height - worldmap.getHeight(), (worldmap.getWidth()-wmInteriorRect.width)/2, (worldmap.getHeight() -wmInteriorRect.height)/2); g2.drawImage(worldmap,visRect.x, visRect.y + visRect.height - worldmap.getHeight(), this); wmInteriorRect.x = visRect.x + (worldmap.getWidth() - wmInteriorRect.width)/2; wmInteriorRect.y = visRect.y+visRect.height-worldmap.getHeight() + (worldmap.getHeight() - wmInteriorRect.height)/2; //draw the outline of the viewport g2.setColor(Color.black); double hRatio = wmInteriorRect.getWidth()/pref.getWidth(); double vRatio = wmInteriorRect.getHeight()/pref.getHeight(); int hBump = worldmap.getWidth()-wmInteriorRect.width; int vBump = worldmap.getHeight()-wmInteriorRect.height; //bump a few pixels to avoid drawing on the border g2.drawRect((int)(visRect.x*hRatio)+hBump/2+visRect.x, (int)(visRect.y*vRatio)+vBump/2+(visRect.y + visRect.height - worldmap.getHeight()), (int)(visRect.width*hRatio), (int)(visRect.height*vRatio)); } //see if we're drawing a worldmap resize rect if (resizeRectExists){ g2.setColor(Color.black); g2.drawRect(resizeWMRect.x, resizeWMRect.y, resizeWMRect.width, resizeWMRect.height); } //see if we're drawing a block selector rect if (blockRectExists){ g2.setColor(Color.black); g2.setStroke(dashedThinStroke); g2.drawRect(blockRect.x, blockRect.y, blockRect.width, blockRect.height); } }
1,108,673
private void buildXformImage() { // ParameterBlock pbRen = new ParameterBlock();// pbRen.addSource( origImage );// pbRen.add(null).add(null).add(null).add(null).add(null); // RenderableImage renSrc = JAI.createRenderable( "renderable", pbRen ); float scale = 1.0f; imgRot = newRotDegrees; if ( fitSize ) { log.debug( "fitSize" ); float widthScale = ((float)maxWidth)/origImage.getWidth(); float heightScale = ((float)maxHeight)/origImage.getHeight(); scale = widthScale; if ( heightScale < scale ) { scale = heightScale; } log.debug( "scale: " + scale ); } else { scale = (float) imgScale; log.debug( "scale: " + scale ); } // Set the hourglass cursor Cursor oldCursor = getCursor(); setCursor( new Cursor( Cursor.WAIT_CURSOR ) ); Rectangle2D cropUsed = newCrop; if ( !drawCropped ) { cropUsed = new Rectangle2D.Double( 0.0, 0.0, 1.0, 1.0 ); } else { crop = newCrop; } // Create the zoom xform AffineTransform at = null; if ( fitSize ) { at = org.photovault.image.ImageXform.getFittingXform( (int)maxWidth, (int)maxHeight, imgRot, (int)( origImage.getWidth() * cropUsed.getWidth() ), (int)(( cropUsed.getHeight()* origImage.getHeight() ) ) ); } else { at = org.photovault.image.ImageXform.getScaleXform( imgScale, imgRot, (int)( origImage.getWidth() * cropUsed.getWidth() ), (int)(( cropUsed.getHeight()* origImage.getHeight() ) ) ); } // Create a ParameterBlock and specify the source and // parameters ParameterBlockJAI scaleParams = new ParameterBlockJAI( "affine" ); scaleParams.addSource( origImage ); scaleParams.setParameter( "transform", at ); scaleParams.setParameter( "interpolation", new InterpolationBilinear()); // Create the scale operation RenderedOp tmp = JAI.create( "affine", scaleParams, null ); ParameterBlockJAI cropParams = new ParameterBlockJAI( "crop" ); cropParams.addSource( tmp ); float cropX = (float)( Math.rint( tmp.getMinX() + cropUsed.getMinX() * tmp.getWidth() )); float cropY = (float)( Math.rint( tmp.getMinY() + cropUsed.getMinY() * tmp.getHeight() )); float cropW = (float)( Math.rint( cropUsed.getWidth() * tmp.getWidth() )); float cropH = (float) ( Math.rint( cropUsed.getHeight() * tmp.getHeight() )); cropParams.setParameter( "x", cropX ); cropParams.setParameter( "y", cropY ); cropParams.setParameter( "width", cropW ); cropParams.setParameter( "height", cropH ); RenderedOp cropped = JAI.create("crop", cropParams, null); // Translate the image so that it begins in origo ParameterBlockJAI pbXlate = new ParameterBlockJAI( "translate" ); pbXlate.addSource( cropped ); pbXlate.setParameter( "xTrans", (float) (-cropped.getMinX() ) ); pbXlate.setParameter( "yTrans", (float) (-cropped.getMinY() ) ); xformImage = JAI.create( "translate", pbXlate ); // We need to update also the crop border since image size & orientation // has changed cropBorderXpoints = null; cropBorderYpoints = null; setCursor( oldCursor ); }
private void buildXformImage() { // ParameterBlock pbRen = new ParameterBlock();// pbRen.addSource( origImage );// pbRen.add(null).add(null).add(null).add(null).add(null); // RenderableImage renSrc = JAI.createRenderable( "renderable", pbRen ); float scale = 1.0f; imgRot = newRotDegrees; if ( fitSize ) { log.debug( "fitSize" ); float widthScale = ((float)maxWidth)/origImage.getWidth(); float heightScale = ((float)maxHeight)/origImage.getHeight(); scale = widthScale; if ( heightScale < scale ) { scale = heightScale; } log.debug( "scale: " + scale ); } else { scale = (float) imgScale; log.debug( "scale: " + scale ); } // Set the hourglass cursor Cursor oldCursor = getCursor(); setCursor( new Cursor( Cursor.WAIT_CURSOR ) ); Rectangle2D cropUsed = newCrop; if ( !drawCropped ) { cropUsed = new Rectangle2D.Double( 0.0, 0.0, 1.0, 1.0 ); } else { crop = newCrop; } // Create the zoom xform AffineTransform at = null; if ( fitSize ) { at = org.photovault.image.ImageXform.getFittingXform( (int)maxWidth, (int)maxHeight, imgRot, (int)( origImage.getWidth() * cropUsed.getWidth() ), (int)(( cropUsed.getHeight()* origImage.getHeight() ) ) ); } else { at = org.photovault.image.ImageXform.getScaleXform( imgScale, imgRot, (int)( origImage.getWidth() * cropUsed.getWidth() ), (int)(( cropUsed.getHeight()* origImage.getHeight() ) ) ); } // Create a ParameterBlock and specify the source and // parameters ParameterBlockJAI scaleParams = new ParameterBlockJAI( "affine" ); scaleParams.addSource( origImage ); scaleParams.setParameter( "transform", at ); scaleParams.setParameter( "interpolation", new InterpolationBilinear()); // Create the scale operation RenderedOp tmp = JAI.create( "affine", scaleParams, null ); ParameterBlockJAI cropParams = new ParameterBlockJAI( "crop" ); cropParams.addSource( tmp ); float cropX = (float)( Math.rint( tmp.getMinX() + cropUsed.getMinX() * tmp.getWidth() )); float cropY = (float)( Math.rint( tmp.getMinY() + cropUsed.getMinY() * tmp.getHeight() )); float cropW = (float)( Math.rint( cropUsed.getWidth() * tmp.getWidth() )); float cropH = (float) ( Math.rint( cropUsed.getHeight() * tmp.getHeight() )); cropParams.setParameter( "x", cropX ); cropParams.setParameter( "y", cropY ); cropParams.setParameter( "width", cropW ); cropParams.setParameter( "height", cropH ); RenderedOp cropped = JAI.create("crop", cropParams, null); // Translate the image so that it begins in origo ParameterBlockJAI pbXlate = new ParameterBlockJAI( "translate" ); pbXlate.addSource( cropped ); pbXlate.setParameter( "xTrans", (float) (-cropped.getMinX() ) ); pbXlate.setParameter( "yTrans", (float) (-cropped.getMinY() ) ); xformImage = JAI.create( "translate", pbXlate ); // We need to update also the crop border since image size & orientation // has changed cropBorderXpoints = null; cropBorderYpoints = null; setCursor( oldCursor ); }
1,108,674
private void buildXformImage() { // ParameterBlock pbRen = new ParameterBlock();// pbRen.addSource( origImage );// pbRen.add(null).add(null).add(null).add(null).add(null); // RenderableImage renSrc = JAI.createRenderable( "renderable", pbRen ); float scale = 1.0f; imgRot = newRotDegrees; if ( fitSize ) { log.debug( "fitSize" ); float widthScale = ((float)maxWidth)/origImage.getWidth(); float heightScale = ((float)maxHeight)/origImage.getHeight(); scale = widthScale; if ( heightScale < scale ) { scale = heightScale; } log.debug( "scale: " + scale ); } else { scale = (float) imgScale; log.debug( "scale: " + scale ); } // Set the hourglass cursor Cursor oldCursor = getCursor(); setCursor( new Cursor( Cursor.WAIT_CURSOR ) ); Rectangle2D cropUsed = newCrop; if ( !drawCropped ) { cropUsed = new Rectangle2D.Double( 0.0, 0.0, 1.0, 1.0 ); } else { crop = newCrop; } // Create the zoom xform AffineTransform at = null; if ( fitSize ) { at = org.photovault.image.ImageXform.getFittingXform( (int)maxWidth, (int)maxHeight, imgRot, (int)( origImage.getWidth() * cropUsed.getWidth() ), (int)(( cropUsed.getHeight()* origImage.getHeight() ) ) ); } else { at = org.photovault.image.ImageXform.getScaleXform( imgScale, imgRot, (int)( origImage.getWidth() * cropUsed.getWidth() ), (int)(( cropUsed.getHeight()* origImage.getHeight() ) ) ); } // Create a ParameterBlock and specify the source and // parameters ParameterBlockJAI scaleParams = new ParameterBlockJAI( "affine" ); scaleParams.addSource( origImage ); scaleParams.setParameter( "transform", at ); scaleParams.setParameter( "interpolation", new InterpolationBilinear()); // Create the scale operation RenderedOp tmp = JAI.create( "affine", scaleParams, null ); ParameterBlockJAI cropParams = new ParameterBlockJAI( "crop" ); cropParams.addSource( tmp ); float cropX = (float)( Math.rint( tmp.getMinX() + cropUsed.getMinX() * tmp.getWidth() )); float cropY = (float)( Math.rint( tmp.getMinY() + cropUsed.getMinY() * tmp.getHeight() )); float cropW = (float)( Math.rint( cropUsed.getWidth() * tmp.getWidth() )); float cropH = (float) ( Math.rint( cropUsed.getHeight() * tmp.getHeight() )); cropParams.setParameter( "x", cropX ); cropParams.setParameter( "y", cropY ); cropParams.setParameter( "width", cropW ); cropParams.setParameter( "height", cropH ); RenderedOp cropped = JAI.create("crop", cropParams, null); // Translate the image so that it begins in origo ParameterBlockJAI pbXlate = new ParameterBlockJAI( "translate" ); pbXlate.addSource( cropped ); pbXlate.setParameter( "xTrans", (float) (-cropped.getMinX() ) ); pbXlate.setParameter( "yTrans", (float) (-cropped.getMinY() ) ); xformImage = JAI.create( "translate", pbXlate ); // We need to update also the crop border since image size & orientation // has changed cropBorderXpoints = null; cropBorderYpoints = null; setCursor( oldCursor ); }
private void buildXformImage() { // ParameterBlock pbRen = new ParameterBlock();// pbRen.addSource( origImage );// pbRen.add(null).add(null).add(null).add(null).add(null); // RenderableImage renSrc = JAI.createRenderable( "renderable", pbRen ); float scale = 1.0f; imgRot = newRotDegrees; if ( fitSize ) { log.debug( "fitSize" ); float widthScale = ((float)maxWidth)/origImage.getWidth(); float heightScale = ((float)maxHeight)/origImage.getHeight(); scale = widthScale; if ( heightScale < scale ) { scale = heightScale; } log.debug( "scale: " + scale ); } else { scale = (float) imgScale; log.debug( "scale: " + scale ); } // Set the hourglass cursor Cursor oldCursor = getCursor(); setCursor( new Cursor( Cursor.WAIT_CURSOR ) ); Rectangle2D cropUsed = newCrop; if ( !drawCropped ) { cropUsed = new Rectangle2D.Double( 0.0, 0.0, 1.0, 1.0 ); } else { crop = newCrop; } // Create the zoom xform AffineTransform at = null; if ( fitSize ) { at = org.photovault.image.ImageXform.getFittingXform( (int)maxWidth, (int)maxHeight, imgRot, (int)( origImage.getWidth() * cropUsed.getWidth() ), (int)(( cropUsed.getHeight()* origImage.getHeight() ) ) ); } else { at = org.photovault.image.ImageXform.getScaleXform( imgScale, imgRot, (int)( origImage.getWidth() * cropUsed.getWidth() ), (int)(( cropUsed.getHeight()* origImage.getHeight() ) ) ); } // Create a ParameterBlock and specify the source and // parameters ParameterBlockJAI scaleParams = new ParameterBlockJAI( "affine" ); scaleParams.addSource( origImage ); scaleParams.setParameter( "transform", at ); scaleParams.setParameter( "interpolation", new InterpolationBilinear()); // Create the scale operation RenderedOp tmp = JAI.create( "affine", scaleParams, null ); ParameterBlockJAI cropParams = new ParameterBlockJAI( "crop" ); cropParams.addSource( tmp ); float cropX = (float)( Math.rint( tmp.getMinX() + cropUsed.getMinX() * tmp.getWidth() )); float cropY = (float)( Math.rint( tmp.getMinY() + cropUsed.getMinY() * tmp.getHeight() )); float cropW = (float)( Math.rint( cropUsed.getWidth() * tmp.getWidth() )); float cropH = (float) ( Math.rint( cropUsed.getHeight() * tmp.getHeight() )); cropParams.setParameter( "x", cropX ); cropParams.setParameter( "y", cropY ); cropParams.setParameter( "width", cropW ); cropParams.setParameter( "height", cropH ); RenderedOp cropped = JAI.create("crop", cropParams, null); // Translate the image so that it begins in origo ParameterBlockJAI pbXlate = new ParameterBlockJAI( "translate" ); pbXlate.addSource( cropped ); pbXlate.setParameter( "xTrans", (float) (-cropped.getMinX() ) ); pbXlate.setParameter( "yTrans", (float) (-cropped.getMinY() ) ); xformImage = JAI.create( "translate", pbXlate ); // We need to update also the crop border since image size & orientation // has changed cropBorderXpoints = null; cropBorderYpoints = null; setCursor( oldCursor ); }
1,108,675
public Script getBody() { if ( getTrim() && ! hasTrimmed ) { trimBody(); } return body; }
public Script getBody() { if ( isTrim() && ! hasTrimmed ) { trimBody(); } return body; }
1,108,676
public TagScript createTagScript( final String name, Attributes attrs ) throws Exception { if ( name.equals( "tagdef" ) ) { return new TagScript( new TagFactory() { public Tag createTag() { return new TagDefTag( JeezTagLibrary.this ); } } ); } if ( name.equals( "target" ) ) { return new TagScript( new TagFactory() { public Tag createTag() { return new TargetTag(); } } ); } TagScript script = this.werkzTagLib.createTagScript( name, attrs ); if ( script == null ) { script = antTagLib.createCustomTagScript( name, attrs ); if ( script == null ) { return new TagScript( new TagFactory() { public Tag createTag() throws Exception { // lets try create a dynamic tag first Tag tag = JeezTagLibrary.this.createTag(name); if ( tag != null ) { return tag; } else { return antTagLib.createTag( name ); } } } ); } } return script; }
public TagScript createTagScript( final String name, Attributes attrs ) throws Exception { if ( name.equals( "tagdef" ) ) { return new TagScript( new TagFactory() { public Tag createTag(String name, Attributes attributes) { return new TagDefTag( JeezTagLibrary.this ); } } ); } if ( name.equals( "target" ) ) { return new TagScript( new TagFactory() { public Tag createTag(String name, Attributes attributes) { return new TargetTag(); } } ); } TagScript script = this.werkzTagLib.createTagScript( name, attrs ); if ( script == null ) { script = antTagLib.createCustomTagScript( name, attrs ); if ( script == null ) { return new TagScript( new TagFactory() { public Tag createTag() throws Exception { // lets try create a dynamic tag first Tag tag = JeezTagLibrary.this.createTag(name); if ( tag != null ) { return tag; } else { return antTagLib.createTag( name ); } } } ); } } return script; }
1,108,678
public TagScript createTagScript( final String name, Attributes attrs ) throws Exception { if ( name.equals( "tagdef" ) ) { return new TagScript( new TagFactory() { public Tag createTag() { return new TagDefTag( JeezTagLibrary.this ); } } ); } if ( name.equals( "target" ) ) { return new TagScript( new TagFactory() { public Tag createTag() { return new TargetTag(); } } ); } TagScript script = this.werkzTagLib.createTagScript( name, attrs ); if ( script == null ) { script = antTagLib.createCustomTagScript( name, attrs ); if ( script == null ) { return new TagScript( new TagFactory() { public Tag createTag() throws Exception { // lets try create a dynamic tag first Tag tag = JeezTagLibrary.this.createTag(name); if ( tag != null ) { return tag; } else { return antTagLib.createTag( name ); } } } ); } } return script; }
public TagScript createTagScript( final String name, Attributes attrs ) throws Exception { if ( name.equals( "tagdef" ) ) { return new TagScript( new TagFactory() { public Tag createTag() { return new TagDefTag( JeezTagLibrary.this ); } } ); } if ( name.equals( "target" ) ) { return new TagScript( new TagFactory() { public Tag createTag() { return new TargetTag(); } } ); } TagScript script = this.werkzTagLib.createTagScript( name, attrs ); if ( script == null ) { script = antTagLib.createCustomTagScript( name, attrs ); if ( script == null ) { return new TagScript( new TagFactory() { public Tag createTag(String name, Attributes attributes) throws Exception { // lets try create a dynamic tag first Tag tag = JeezTagLibrary.this.createTag(name); if ( tag != null ) { return tag; } else { return antTagLib.createTag( name ); } } } ); } } return script; }
1,108,679
public TagScript createTagScript( final String name, Attributes attrs ) throws Exception { if ( name.equals( "tagdef" ) ) { return new TagScript( new TagFactory() { public Tag createTag() { return new TagDefTag( JeezTagLibrary.this ); } } ); } if ( name.equals( "target" ) ) { return new TagScript( new TagFactory() { public Tag createTag() { return new TargetTag(); } } ); } TagScript script = this.werkzTagLib.createTagScript( name, attrs ); if ( script == null ) { script = antTagLib.createCustomTagScript( name, attrs ); if ( script == null ) { return new TagScript( new TagFactory() { public Tag createTag() throws Exception { // lets try create a dynamic tag first Tag tag = JeezTagLibrary.this.createTag(name); if ( tag != null ) { return tag; } else { return antTagLib.createTag( name ); } } } ); } } return script; }
public TagScript createTagScript( final String name, Attributes attrs ) throws Exception { if ( name.equals( "tagdef" ) ) { return new TagScript( new TagFactory() { public Tag createTag() { return new TagDefTag( JeezTagLibrary.this ); } } ); } if ( name.equals( "target" ) ) { return new TagScript( new TagFactory() { public Tag createTag() { return new TargetTag(); } } ); } TagScript script = this.werkzTagLib.createTagScript( name, attrs ); if ( script == null ) { script = antTagLib.createCustomTagScript( name, attrs ); if ( script == null ) { return new TagScript( new TagFactory() { public Tag createTag() throws Exception { // lets try create a dynamic tag first Tag tag = JeezTagLibrary.this.createTag(name, attributes); if ( tag != null ) { return tag; } else { return antTagLib.createTag( name ); } } } ); } } return script; }
1,108,680
public TagScript createTagScript( final String name, Attributes attrs ) throws Exception { if ( name.equals( "tagdef" ) ) { return new TagScript( new TagFactory() { public Tag createTag() { return new TagDefTag( JeezTagLibrary.this ); } } ); } if ( name.equals( "target" ) ) { return new TagScript( new TagFactory() { public Tag createTag() { return new TargetTag(); } } ); } TagScript script = this.werkzTagLib.createTagScript( name, attrs ); if ( script == null ) { script = antTagLib.createCustomTagScript( name, attrs ); if ( script == null ) { return new TagScript( new TagFactory() { public Tag createTag() throws Exception { // lets try create a dynamic tag first Tag tag = JeezTagLibrary.this.createTag(name); if ( tag != null ) { return tag; } else { return antTagLib.createTag( name ); } } } ); } } return script; }
public TagScript createTagScript( final String name, Attributes attrs ) throws Exception { if ( name.equals( "tagdef" ) ) { return new TagScript( new TagFactory() { public Tag createTag() { return new TagDefTag( JeezTagLibrary.this ); } } ); } if ( name.equals( "target" ) ) { return new TagScript( new TagFactory() { public Tag createTag() { return new TargetTag(); } } ); } TagScript script = this.werkzTagLib.createTagScript( name, attrs ); if ( script == null ) { script = antTagLib.createCustomTagScript( name, attrs ); if ( script == null ) { return new TagScript( new TagFactory() { public Tag createTag() throws Exception { // lets try create a dynamic tag first Tag tag = JeezTagLibrary.this.createTag(name); if ( tag != null ) { return tag; } else { return antTagLib.createTag( name, attributes ); } } } ); } } return script; }
1,108,681
public Tag createTag() { return new TagDefTag( JeezTagLibrary.this ); }
public Tag createTag(String name, Attributes attributes) { return new TagDefTag( JeezTagLibrary.this ); }
1,108,682
public Tag createTag() { return new TargetTag(); }
public Tag createTag(String name, Attributes attributes) { return new TargetTag(); }
1,108,683
public Tag createTag() throws Exception { // lets try create a dynamic tag first Tag tag = JeezTagLibrary.this.createTag(name); if ( tag != null ) { return tag; } else { return antTagLib.createTag( name ); } }
public Tag createTag(String name, Attributes attributes) throws Exception { // lets try create a dynamic tag first Tag tag = JeezTagLibrary.this.createTag(name); if ( tag != null ) { return tag; } else { return antTagLib.createTag( name ); } }
1,108,684
public Tag createTag() throws Exception { // lets try create a dynamic tag first Tag tag = JeezTagLibrary.this.createTag(name); if ( tag != null ) { return tag; } else { return antTagLib.createTag( name ); } }
public Tag createTag() throws Exception { // lets try create a dynamic tag first Tag tag = JeezTagLibrary.this.createTag(name, attributes); if ( tag != null ) { return tag; } else { return antTagLib.createTag( name ); } }
1,108,685
public Tag createTag() throws Exception { // lets try create a dynamic tag first Tag tag = JeezTagLibrary.this.createTag(name); if ( tag != null ) { return tag; } else { return antTagLib.createTag( name ); } }
public Tag createTag() throws Exception { // lets try create a dynamic tag first Tag tag = JeezTagLibrary.this.createTag(name); if ( tag != null ) { return tag; } else { return antTagLib.createTag( name, attributes ); } }
1,108,686
public TagDefTag() { }
public TagDefTag(DynamicTagLibrary tagLibrary) { this.tagLibrary = tagLibrary; }
1,108,687
public void mousePressed (MouseEvent e) { if ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK){ final int clickX = e.getX(); final int clickY = e.getY(); double dboxX = (double)(clickX - clickXShift - (clickY-clickYShift))/boxSize; double dboxY = (double)(clickX - clickXShift + (clickY-clickYShift))/boxSize; final int boxX, boxY; if (dboxX < 0){ boxX = (int)(dboxX - 0.5); } else{ boxX = (int)(dboxX + 0.5); } if (dboxY < 0){ boxY = (int)(dboxY - 0.5); }else{ boxY = (int)(dboxY + 0.5); } if ((boxX >= lowX && boxX <= highX) && (boxY > boxX && boxY < highY)){ if (dPrimeTable[boxX][boxY] != null){ final SwingWorker worker = new SwingWorker(){ public Object construct(){ final int leftMargin = 12; String[] displayStrings = new String[5]; if (markersLoaded){ displayStrings[0] = new String ("(" +((SNP)markers.elementAt(boxX)).getName() + ", " + ((SNP)markers.elementAt(boxY)).getName() + ")"); }else{ displayStrings[0] = new String("(" + (boxX+1) + ", " + (boxY+1) + ")"); } displayStrings[1] = new String ("D': " + dPrimeTable[boxX][boxY].getDPrime()); displayStrings[2] = new String ("LOD: " + dPrimeTable[boxX][boxY].getLOD()); displayStrings[3] = new String ("r^2: " + dPrimeTable[boxX][boxY].getRSquared()); displayStrings[4] = new String ("D' conf. bounds: " + dPrimeTable[boxX][boxY].getConfidenceLow() + "-" + dPrimeTable[boxX][boxY].getConfidenceHigh()); Graphics g = caller.getGraphics(); g.setFont(boxFont); FontMetrics metrics = g.getFontMetrics(); int strlen = 0; for (int x = 0; x < 5; x++){ if (strlen < metrics.stringWidth(displayStrings[x])){ strlen = metrics.stringWidth(displayStrings[x]); } } g.setColor(Color.WHITE); g.fillRect(clickX+1,clickY+1,strlen+leftMargin+4,5*metrics.getHeight()+9); g.setColor(Color.BLACK); g.drawRect(clickX,clickY,strlen+leftMargin+5,5*metrics.getHeight()+10); for (int x = 0; x < 5; x++){ g.drawString(displayStrings[x],clickX + leftMargin, clickY+5+((x+1)*metrics.getHeight())); } return ""; } }; worker.start(); } } } }
public void mousePressed (MouseEvent e) { if ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK){ final int clickX = e.getX(); final int clickY = e.getY(); double dboxX = (double)(clickX - clickXShift - (clickY-clickYShift))/boxSize; double dboxY = (double)(clickX - clickXShift + (clickY-clickYShift))/boxSize; final int boxX, boxY; if (dboxX < 0){ boxX = (int)(dboxX - 0.5); } else{ boxX = (int)(dboxX + 0.5); } if (dboxY < 0){ boxY = (int)(dboxY - 0.5); }else{ boxY = (int)(dboxY + 0.5); } if ((boxX >= lowX && boxX <= highX) && (boxY > boxX && boxY < highY)){ if (dPrimeTable[boxX][boxY] != null){ final SwingWorker worker = new SwingWorker(){ public Object construct(){ final int leftMargin = 12; String[] displayStrings = new String[5]; if (markersLoaded){ displayStrings[0] = new String ("(" +((SNP)markers.elementAt(boxX)).getName() + ", " + ((SNP)markers.elementAt(boxY)).getName() + ")"); }else{ displayStrings[0] = new String("(" + (boxX+1) + ", " + (boxY+1) + ")"); } displayStrings[1] = new String ("D': " + dPrimeTable[boxX][boxY].getDPrime()); displayStrings[2] = new String ("LOD: " + dPrimeTable[boxX][boxY].getLOD()); displayStrings[3] = new String ("r^2: " + dPrimeTable[boxX][boxY].getRSquared()); displayStrings[4] = new String ("D' conf. bounds: " + dPrimeTable[boxX][boxY].getConfidenceLow() + "-" + dPrimeTable[boxX][boxY].getConfidenceHigh()); Graphics g = caller.getGraphics(); g.setFont(boxFont); FontMetrics metrics = g.getFontMetrics(); int strlen = 0; for (int x = 0; x < 5; x++){ if (strlen < metrics.stringWidth(displayStrings[x])){ strlen = metrics.stringWidth(displayStrings[x]); } } g.setColor(Color.WHITE); g.fillRect(clickX+1-rightEdgeShift, clickY+1-botEdgeShift, strlen+leftMargin+4, 5*metrics.getHeight()+9); g.setColor(Color.BLACK); g.drawRect(clickX,clickY,strlen+leftMargin+5,5*metrics.getHeight()+10); for (int x = 0; x < 5; x++){ g.drawString(displayStrings[x],clickX + leftMargin, clickY+5+((x+1)*metrics.getHeight())); } return ""; } }; worker.start(); } } } }
1,108,688
public void mousePressed (MouseEvent e) { if ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK){ final int clickX = e.getX(); final int clickY = e.getY(); double dboxX = (double)(clickX - clickXShift - (clickY-clickYShift))/boxSize; double dboxY = (double)(clickX - clickXShift + (clickY-clickYShift))/boxSize; final int boxX, boxY; if (dboxX < 0){ boxX = (int)(dboxX - 0.5); } else{ boxX = (int)(dboxX + 0.5); } if (dboxY < 0){ boxY = (int)(dboxY - 0.5); }else{ boxY = (int)(dboxY + 0.5); } if ((boxX >= lowX && boxX <= highX) && (boxY > boxX && boxY < highY)){ if (dPrimeTable[boxX][boxY] != null){ final SwingWorker worker = new SwingWorker(){ public Object construct(){ final int leftMargin = 12; String[] displayStrings = new String[5]; if (markersLoaded){ displayStrings[0] = new String ("(" +((SNP)markers.elementAt(boxX)).getName() + ", " + ((SNP)markers.elementAt(boxY)).getName() + ")"); }else{ displayStrings[0] = new String("(" + (boxX+1) + ", " + (boxY+1) + ")"); } displayStrings[1] = new String ("D': " + dPrimeTable[boxX][boxY].getDPrime()); displayStrings[2] = new String ("LOD: " + dPrimeTable[boxX][boxY].getLOD()); displayStrings[3] = new String ("r^2: " + dPrimeTable[boxX][boxY].getRSquared()); displayStrings[4] = new String ("D' conf. bounds: " + dPrimeTable[boxX][boxY].getConfidenceLow() + "-" + dPrimeTable[boxX][boxY].getConfidenceHigh()); Graphics g = caller.getGraphics(); g.setFont(boxFont); FontMetrics metrics = g.getFontMetrics(); int strlen = 0; for (int x = 0; x < 5; x++){ if (strlen < metrics.stringWidth(displayStrings[x])){ strlen = metrics.stringWidth(displayStrings[x]); } } g.setColor(Color.WHITE); g.fillRect(clickX+1,clickY+1,strlen+leftMargin+4,5*metrics.getHeight()+9); g.setColor(Color.BLACK); g.drawRect(clickX,clickY,strlen+leftMargin+5,5*metrics.getHeight()+10); for (int x = 0; x < 5; x++){ g.drawString(displayStrings[x],clickX + leftMargin, clickY+5+((x+1)*metrics.getHeight())); } return ""; } }; worker.start(); } } } }
public void mousePressed (MouseEvent e) { if ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK){ final int clickX = e.getX(); final int clickY = e.getY(); double dboxX = (double)(clickX - clickXShift - (clickY-clickYShift))/boxSize; double dboxY = (double)(clickX - clickXShift + (clickY-clickYShift))/boxSize; final int boxX, boxY; if (dboxX < 0){ boxX = (int)(dboxX - 0.5); } else{ boxX = (int)(dboxX + 0.5); } if (dboxY < 0){ boxY = (int)(dboxY - 0.5); }else{ boxY = (int)(dboxY + 0.5); } if ((boxX >= lowX && boxX <= highX) && (boxY > boxX && boxY < highY)){ if (dPrimeTable[boxX][boxY] != null){ final SwingWorker worker = new SwingWorker(){ public Object construct(){ final int leftMargin = 12; String[] displayStrings = new String[5]; if (markersLoaded){ displayStrings[0] = new String ("(" +((SNP)markers.elementAt(boxX)).getName() + ", " + ((SNP)markers.elementAt(boxY)).getName() + ")"); }else{ displayStrings[0] = new String("(" + (boxX+1) + ", " + (boxY+1) + ")"); } displayStrings[1] = new String ("D': " + dPrimeTable[boxX][boxY].getDPrime()); displayStrings[2] = new String ("LOD: " + dPrimeTable[boxX][boxY].getLOD()); displayStrings[3] = new String ("r^2: " + dPrimeTable[boxX][boxY].getRSquared()); displayStrings[4] = new String ("D' conf. bounds: " + dPrimeTable[boxX][boxY].getConfidenceLow() + "-" + dPrimeTable[boxX][boxY].getConfidenceHigh()); Graphics g = caller.getGraphics(); g.setFont(boxFont); FontMetrics metrics = g.getFontMetrics(); int strlen = 0; for (int x = 0; x < 5; x++){ if (strlen < metrics.stringWidth(displayStrings[x])){ strlen = metrics.stringWidth(displayStrings[x]); } } g.setColor(Color.WHITE); g.fillRect(clickX+1,clickY+1,strlen+leftMargin+4,5*metrics.getHeight()+9); g.setColor(Color.BLACK); g.drawRect(clickX-rightEdgeShift, clickY-botEdgeShift, strlen+leftMargin+5, 5*metrics.getHeight()+10); for (int x = 0; x < 5; x++){ g.drawString(displayStrings[x],clickX + leftMargin, clickY+5+((x+1)*metrics.getHeight())); } return ""; } }; worker.start(); } } } }
1,108,689
public void mousePressed (MouseEvent e) { if ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK){ final int clickX = e.getX(); final int clickY = e.getY(); double dboxX = (double)(clickX - clickXShift - (clickY-clickYShift))/boxSize; double dboxY = (double)(clickX - clickXShift + (clickY-clickYShift))/boxSize; final int boxX, boxY; if (dboxX < 0){ boxX = (int)(dboxX - 0.5); } else{ boxX = (int)(dboxX + 0.5); } if (dboxY < 0){ boxY = (int)(dboxY - 0.5); }else{ boxY = (int)(dboxY + 0.5); } if ((boxX >= lowX && boxX <= highX) && (boxY > boxX && boxY < highY)){ if (dPrimeTable[boxX][boxY] != null){ final SwingWorker worker = new SwingWorker(){ public Object construct(){ final int leftMargin = 12; String[] displayStrings = new String[5]; if (markersLoaded){ displayStrings[0] = new String ("(" +((SNP)markers.elementAt(boxX)).getName() + ", " + ((SNP)markers.elementAt(boxY)).getName() + ")"); }else{ displayStrings[0] = new String("(" + (boxX+1) + ", " + (boxY+1) + ")"); } displayStrings[1] = new String ("D': " + dPrimeTable[boxX][boxY].getDPrime()); displayStrings[2] = new String ("LOD: " + dPrimeTable[boxX][boxY].getLOD()); displayStrings[3] = new String ("r^2: " + dPrimeTable[boxX][boxY].getRSquared()); displayStrings[4] = new String ("D' conf. bounds: " + dPrimeTable[boxX][boxY].getConfidenceLow() + "-" + dPrimeTable[boxX][boxY].getConfidenceHigh()); Graphics g = caller.getGraphics(); g.setFont(boxFont); FontMetrics metrics = g.getFontMetrics(); int strlen = 0; for (int x = 0; x < 5; x++){ if (strlen < metrics.stringWidth(displayStrings[x])){ strlen = metrics.stringWidth(displayStrings[x]); } } g.setColor(Color.WHITE); g.fillRect(clickX+1,clickY+1,strlen+leftMargin+4,5*metrics.getHeight()+9); g.setColor(Color.BLACK); g.drawRect(clickX,clickY,strlen+leftMargin+5,5*metrics.getHeight()+10); for (int x = 0; x < 5; x++){ g.drawString(displayStrings[x],clickX + leftMargin, clickY+5+((x+1)*metrics.getHeight())); } return ""; } }; worker.start(); } } } }
public void mousePressed (MouseEvent e) { if ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK){ final int clickX = e.getX(); final int clickY = e.getY(); double dboxX = (double)(clickX - clickXShift - (clickY-clickYShift))/boxSize; double dboxY = (double)(clickX - clickXShift + (clickY-clickYShift))/boxSize; final int boxX, boxY; if (dboxX < 0){ boxX = (int)(dboxX - 0.5); } else{ boxX = (int)(dboxX + 0.5); } if (dboxY < 0){ boxY = (int)(dboxY - 0.5); }else{ boxY = (int)(dboxY + 0.5); } if ((boxX >= lowX && boxX <= highX) && (boxY > boxX && boxY < highY)){ if (dPrimeTable[boxX][boxY] != null){ final SwingWorker worker = new SwingWorker(){ public Object construct(){ final int leftMargin = 12; String[] displayStrings = new String[5]; if (markersLoaded){ displayStrings[0] = new String ("(" +((SNP)markers.elementAt(boxX)).getName() + ", " + ((SNP)markers.elementAt(boxY)).getName() + ")"); }else{ displayStrings[0] = new String("(" + (boxX+1) + ", " + (boxY+1) + ")"); } displayStrings[1] = new String ("D': " + dPrimeTable[boxX][boxY].getDPrime()); displayStrings[2] = new String ("LOD: " + dPrimeTable[boxX][boxY].getLOD()); displayStrings[3] = new String ("r^2: " + dPrimeTable[boxX][boxY].getRSquared()); displayStrings[4] = new String ("D' conf. bounds: " + dPrimeTable[boxX][boxY].getConfidenceLow() + "-" + dPrimeTable[boxX][boxY].getConfidenceHigh()); Graphics g = caller.getGraphics(); g.setFont(boxFont); FontMetrics metrics = g.getFontMetrics(); int strlen = 0; for (int x = 0; x < 5; x++){ if (strlen < metrics.stringWidth(displayStrings[x])){ strlen = metrics.stringWidth(displayStrings[x]); } } g.setColor(Color.WHITE); g.fillRect(clickX+1,clickY+1,strlen+leftMargin+4,5*metrics.getHeight()+9); g.setColor(Color.BLACK); g.drawRect(clickX,clickY,strlen+leftMargin+5,5*metrics.getHeight()+10); for (int x = 0; x < 5; x++){ g.drawString(displayStrings[x],clickX + leftMargin - rightEdgeShift, clickY+5+((x+1)*metrics.getHeight())-botEdgeShift); } return ""; } }; worker.start(); } } } }
1,108,690
public Object construct(){ final int leftMargin = 12; String[] displayStrings = new String[5]; if (markersLoaded){ displayStrings[0] = new String ("(" +((SNP)markers.elementAt(boxX)).getName() + ", " + ((SNP)markers.elementAt(boxY)).getName() + ")"); }else{ displayStrings[0] = new String("(" + (boxX+1) + ", " + (boxY+1) + ")"); } displayStrings[1] = new String ("D': " + dPrimeTable[boxX][boxY].getDPrime()); displayStrings[2] = new String ("LOD: " + dPrimeTable[boxX][boxY].getLOD()); displayStrings[3] = new String ("r^2: " + dPrimeTable[boxX][boxY].getRSquared()); displayStrings[4] = new String ("D' conf. bounds: " + dPrimeTable[boxX][boxY].getConfidenceLow() + "-" + dPrimeTable[boxX][boxY].getConfidenceHigh()); Graphics g = caller.getGraphics(); g.setFont(boxFont); FontMetrics metrics = g.getFontMetrics(); int strlen = 0; for (int x = 0; x < 5; x++){ if (strlen < metrics.stringWidth(displayStrings[x])){ strlen = metrics.stringWidth(displayStrings[x]); } } g.setColor(Color.WHITE); g.fillRect(clickX+1,clickY+1,strlen+leftMargin+4,5*metrics.getHeight()+9); g.setColor(Color.BLACK); g.drawRect(clickX,clickY,strlen+leftMargin+5,5*metrics.getHeight()+10); for (int x = 0; x < 5; x++){ g.drawString(displayStrings[x],clickX + leftMargin, clickY+5+((x+1)*metrics.getHeight())); } return ""; }
public Object construct(){ final int leftMargin = 12; String[] displayStrings = new String[5]; if (markersLoaded){ displayStrings[0] = new String ("(" +((SNP)markers.elementAt(boxX)).getName() + ", " + ((SNP)markers.elementAt(boxY)).getName() + ")"); }else{ displayStrings[0] = new String("(" + (boxX+1) + ", " + (boxY+1) + ")"); } displayStrings[1] = new String ("D': " + dPrimeTable[boxX][boxY].getDPrime()); displayStrings[2] = new String ("LOD: " + dPrimeTable[boxX][boxY].getLOD()); displayStrings[3] = new String ("r^2: " + dPrimeTable[boxX][boxY].getRSquared()); displayStrings[4] = new String ("D' conf. bounds: " + dPrimeTable[boxX][boxY].getConfidenceLow() + "-" + dPrimeTable[boxX][boxY].getConfidenceHigh()); Graphics g = caller.getGraphics(); g.setFont(boxFont); FontMetrics metrics = g.getFontMetrics(); int strlen = 0; for (int x = 0; x < 5; x++){ if (strlen < metrics.stringWidth(displayStrings[x])){ strlen = metrics.stringWidth(displayStrings[x]); } } g.setColor(Color.WHITE); g.fillRect(clickX+1-rightEdgeShift, clickY+1-botEdgeShift, strlen+leftMargin+4, 5*metrics.getHeight()+9); g.setColor(Color.BLACK); g.drawRect(clickX,clickY,strlen+leftMargin+5,5*metrics.getHeight()+10); for (int x = 0; x < 5; x++){ g.drawString(displayStrings[x],clickX + leftMargin, clickY+5+((x+1)*metrics.getHeight())); } return ""; }
1,108,691
public Object construct(){ final int leftMargin = 12; String[] displayStrings = new String[5]; if (markersLoaded){ displayStrings[0] = new String ("(" +((SNP)markers.elementAt(boxX)).getName() + ", " + ((SNP)markers.elementAt(boxY)).getName() + ")"); }else{ displayStrings[0] = new String("(" + (boxX+1) + ", " + (boxY+1) + ")"); } displayStrings[1] = new String ("D': " + dPrimeTable[boxX][boxY].getDPrime()); displayStrings[2] = new String ("LOD: " + dPrimeTable[boxX][boxY].getLOD()); displayStrings[3] = new String ("r^2: " + dPrimeTable[boxX][boxY].getRSquared()); displayStrings[4] = new String ("D' conf. bounds: " + dPrimeTable[boxX][boxY].getConfidenceLow() + "-" + dPrimeTable[boxX][boxY].getConfidenceHigh()); Graphics g = caller.getGraphics(); g.setFont(boxFont); FontMetrics metrics = g.getFontMetrics(); int strlen = 0; for (int x = 0; x < 5; x++){ if (strlen < metrics.stringWidth(displayStrings[x])){ strlen = metrics.stringWidth(displayStrings[x]); } } g.setColor(Color.WHITE); g.fillRect(clickX+1,clickY+1,strlen+leftMargin+4,5*metrics.getHeight()+9); g.setColor(Color.BLACK); g.drawRect(clickX,clickY,strlen+leftMargin+5,5*metrics.getHeight()+10); for (int x = 0; x < 5; x++){ g.drawString(displayStrings[x],clickX + leftMargin, clickY+5+((x+1)*metrics.getHeight())); } return ""; }
public Object construct(){ final int leftMargin = 12; String[] displayStrings = new String[5]; if (markersLoaded){ displayStrings[0] = new String ("(" +((SNP)markers.elementAt(boxX)).getName() + ", " + ((SNP)markers.elementAt(boxY)).getName() + ")"); }else{ displayStrings[0] = new String("(" + (boxX+1) + ", " + (boxY+1) + ")"); } displayStrings[1] = new String ("D': " + dPrimeTable[boxX][boxY].getDPrime()); displayStrings[2] = new String ("LOD: " + dPrimeTable[boxX][boxY].getLOD()); displayStrings[3] = new String ("r^2: " + dPrimeTable[boxX][boxY].getRSquared()); displayStrings[4] = new String ("D' conf. bounds: " + dPrimeTable[boxX][boxY].getConfidenceLow() + "-" + dPrimeTable[boxX][boxY].getConfidenceHigh()); Graphics g = caller.getGraphics(); g.setFont(boxFont); FontMetrics metrics = g.getFontMetrics(); int strlen = 0; for (int x = 0; x < 5; x++){ if (strlen < metrics.stringWidth(displayStrings[x])){ strlen = metrics.stringWidth(displayStrings[x]); } } g.setColor(Color.WHITE); g.fillRect(clickX+1,clickY+1,strlen+leftMargin+4,5*metrics.getHeight()+9); g.setColor(Color.BLACK); g.drawRect(clickX-rightEdgeShift, clickY-botEdgeShift, strlen+leftMargin+5, 5*metrics.getHeight()+10); for (int x = 0; x < 5; x++){ g.drawString(displayStrings[x],clickX + leftMargin, clickY+5+((x+1)*metrics.getHeight())); } return ""; }
1,108,692
public Object construct(){ final int leftMargin = 12; String[] displayStrings = new String[5]; if (markersLoaded){ displayStrings[0] = new String ("(" +((SNP)markers.elementAt(boxX)).getName() + ", " + ((SNP)markers.elementAt(boxY)).getName() + ")"); }else{ displayStrings[0] = new String("(" + (boxX+1) + ", " + (boxY+1) + ")"); } displayStrings[1] = new String ("D': " + dPrimeTable[boxX][boxY].getDPrime()); displayStrings[2] = new String ("LOD: " + dPrimeTable[boxX][boxY].getLOD()); displayStrings[3] = new String ("r^2: " + dPrimeTable[boxX][boxY].getRSquared()); displayStrings[4] = new String ("D' conf. bounds: " + dPrimeTable[boxX][boxY].getConfidenceLow() + "-" + dPrimeTable[boxX][boxY].getConfidenceHigh()); Graphics g = caller.getGraphics(); g.setFont(boxFont); FontMetrics metrics = g.getFontMetrics(); int strlen = 0; for (int x = 0; x < 5; x++){ if (strlen < metrics.stringWidth(displayStrings[x])){ strlen = metrics.stringWidth(displayStrings[x]); } } g.setColor(Color.WHITE); g.fillRect(clickX+1,clickY+1,strlen+leftMargin+4,5*metrics.getHeight()+9); g.setColor(Color.BLACK); g.drawRect(clickX,clickY,strlen+leftMargin+5,5*metrics.getHeight()+10); for (int x = 0; x < 5; x++){ g.drawString(displayStrings[x],clickX + leftMargin, clickY+5+((x+1)*metrics.getHeight())); } return ""; }
public Object construct(){ final int leftMargin = 12; String[] displayStrings = new String[5]; if (markersLoaded){ displayStrings[0] = new String ("(" +((SNP)markers.elementAt(boxX)).getName() + ", " + ((SNP)markers.elementAt(boxY)).getName() + ")"); }else{ displayStrings[0] = new String("(" + (boxX+1) + ", " + (boxY+1) + ")"); } displayStrings[1] = new String ("D': " + dPrimeTable[boxX][boxY].getDPrime()); displayStrings[2] = new String ("LOD: " + dPrimeTable[boxX][boxY].getLOD()); displayStrings[3] = new String ("r^2: " + dPrimeTable[boxX][boxY].getRSquared()); displayStrings[4] = new String ("D' conf. bounds: " + dPrimeTable[boxX][boxY].getConfidenceLow() + "-" + dPrimeTable[boxX][boxY].getConfidenceHigh()); Graphics g = caller.getGraphics(); g.setFont(boxFont); FontMetrics metrics = g.getFontMetrics(); int strlen = 0; for (int x = 0; x < 5; x++){ if (strlen < metrics.stringWidth(displayStrings[x])){ strlen = metrics.stringWidth(displayStrings[x]); } } g.setColor(Color.WHITE); g.fillRect(clickX+1,clickY+1,strlen+leftMargin+4,5*metrics.getHeight()+9); g.setColor(Color.BLACK); g.drawRect(clickX,clickY,strlen+leftMargin+5,5*metrics.getHeight()+10); for (int x = 0; x < 5; x++){ g.drawString(displayStrings[x],clickX + leftMargin - rightEdgeShift, clickY+5+((x+1)*metrics.getHeight())-botEdgeShift); } return ""; }
1,108,693
public void paintComponent(Graphics g){ Graphics2D g2 = (Graphics2D) g; Dimension size = getSize(); Dimension pref = getPreferredSize(); Rectangle clipRect = (Rectangle)g.getClip(); //first paint grab the cliprect for the whole viewport if (viewRect.width == 0){viewRect=clipRect;} //okay so this dumb if block is to prevent the ugly //repainting bug when loading markers after the data are already //being displayed, results in a little off-centering for small //datasets, but not too bad. //clickxshift and clickyshift are used later to translate from x,y coords to the //pair of markers comparison at those coords if (!(markersLoaded)){ g2.translate((size.width - pref.width) / 2, (size.height - pref.height) / 2); clickXShift = left + (size.width-pref.width)/2; clickYShift = top + (size.height - pref.height)/2; } else { g2.translate((size.width - pref.width) / 2, 0); clickXShift = left + (size.width-pref.width)/2; clickYShift = top; } FontMetrics boxFontMetrics = g.getFontMetrics(boxFont); int diamondX[] = new int[4]; int diamondY[] = new int[4]; Polygon diamond; left = H_BORDER; top = V_BORDER; FontMetrics metrics; int ascent; g2.setColor(this.getBackground()); g2.fillRect(0,0,pref.width,pref.height); g2.setColor(Color.BLACK); if (markersLoaded) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //// draw the marker locations BasicStroke thickerStroke = new BasicStroke(1); BasicStroke thinnerStroke = new BasicStroke(0.25f); int wide = (dPrimeTable.length-1) * boxSize; //TODO: talk to kirby about locusview scaling gizmo int lineLeft = wide/20; int lineSpan = (wide/10)*9; long minpos = ((SNP)markers.elementAt(0)).getPosition(); long maxpos = ((SNP)markers.elementAt(markers.size()-1)).getPosition(); double spanpos = maxpos - minpos; g2.setStroke(thinnerStroke); g2.setColor(Color.white); g2.fillRect(left + lineLeft, 5, lineSpan, TICK_HEIGHT); g2.setColor(Color.black); g2.drawRect(left + lineLeft, 5, lineSpan, TICK_HEIGHT); for (int i = 0; i < markers.size(); i++) { double pos = (((SNP)markers.elementAt(i)).getPosition() - minpos) / spanpos; int xx = (int) (left + lineLeft + lineSpan*pos); g2.setStroke(thickerStroke); g.drawLine(xx, 5, xx, 5 + TICK_HEIGHT); g2.setStroke(thinnerStroke); g.drawLine(xx, 5 + TICK_HEIGHT, left + i*boxSize, TICK_BOTTOM); } top += TICK_BOTTOM; //// draw the marker names if (printDetails){ g.setFont(markerNameFont); metrics = g.getFontMetrics(); ascent = metrics.getAscent(); widestMarkerName = metrics.stringWidth(((SNP)markers.elementAt(0)).getName()); for (int x = 1; x < dPrimeTable.length; x++) { int thiswide = metrics.stringWidth(((SNP)markers.elementAt(x)).getName()); if (thiswide > widestMarkerName) widestMarkerName = thiswide; } //System.out.println(widest); g2.translate(left, top + widestMarkerName); g2.rotate(-Math.PI / 2.0); for (int x = 0; x < dPrimeTable.length; x++) { g2.drawString(((SNP)markers.elementAt(x)).getName(),TEXT_NUMBER_GAP, x*boxSize + ascent/3); } g2.rotate(Math.PI / 2.0); g2.translate(-left, -(top + widestMarkerName)); // move everybody down top += widestMarkerName + TEXT_NUMBER_GAP; } g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } //// draw the marker numbers if (printDetails){ g.setFont(markerNumFont); metrics = g.getFontMetrics(); ascent = metrics.getAscent(); for (int x = 0; x < dPrimeTable.length; x++) { String mark = String.valueOf(x + 1); g.drawString(mark, left + x*boxSize - metrics.stringWidth(mark)/2, top + ascent); } top += boxRadius/2; // give a little space between numbers and boxes } //if (pref.getWidth() > viewRect.width){ //this means that the table is bigger than the display. //the following values are the bounds on the boxes we want to //display given that the current window is 'clipRect' lowX = (clipRect.x-clickXShift-(clipRect.y+clipRect.height-clickYShift))/boxSize; if (lowX < 0) { lowX = 0; } highX = ((clipRect.x + clipRect.width)/boxSize)+1; if (highX > dPrimeTable.length-1){ highX = dPrimeTable.length-1; } lowY = ((clipRect.x-clickXShift)+(clipRect.y-clickYShift))/boxSize; if (lowY < lowX+1){ lowY = lowX+1; } highY = (((clipRect.x-clickXShift+clipRect.width) + (clipRect.y-clickYShift+clipRect.height))/boxSize)+1; if (highY > dPrimeTable.length){ highY = dPrimeTable.length; } /** boxSize = (int)((clipRect.width-2*H_BORDER)/dPrimeTable.length-1); if (boxSize < 12){boxSize=12;} if (boxSize < 25){ printDetails = false; boxRadius = boxSize/2; }else{ boxRadius = boxSize/2 - 1; } } else{ lowX = 0; highX = dPrimeTable.length-1; lowY = 0; highY = dPrimeTable.length; } **/ // draw table column by column for (int x = lowX; x < highX; x++) { //always draw the fewest possible boxes if (lowY < x+1){ lowY = x+1; } for (int y = lowY; y < highY; y++) { if (dPrimeTable[x][y] == null){ continue; } double d = dPrimeTable[x][y].getDPrime(); //double l = dPrimeTable[x][y].getLOD(); Color boxColor = dPrimeTable[x][y].getColor(); // draw markers above int xx = left + (x + y) * boxSize / 2; int yy = top + (y - x) * boxSize / 2; diamondX[0] = xx; diamondY[0] = yy - boxRadius; diamondX[1] = xx + boxRadius; diamondY[1] = yy; diamondX[2] = xx; diamondY[2] = yy + boxRadius; diamondX[3] = xx - boxRadius; diamondY[3] = yy; diamond = new Polygon(diamondX, diamondY, 4); g.setColor(boxColor); g.fillPolygon(diamond); if (boxColor == Color.white) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(Color.lightGray); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } if(printDetails){ g.setFont(boxFont); ascent = boxFontMetrics.getAscent(); int val = (int) (d * 100); g.setColor((val < 50) ? Color.gray : Color.black); if (val != 100) { String valu = String.valueOf(val); int widf = boxFontMetrics.stringWidth(valu); g.drawString(valu, xx - widf/2, yy + ascent/2); } } } } }
public void paintComponent(Graphics g){ Graphics2D g2 = (Graphics2D) g; Dimension size = getSize(); Dimension pref = getPreferredSize(); clipRect = (Rectangle)g.getClip(); //first paint grab the cliprect for the whole viewport if (viewRect.width == 0){viewRect=clipRect;} //okay so this dumb if block is to prevent the ugly //repainting bug when loading markers after the data are already //being displayed, results in a little off-centering for small //datasets, but not too bad. //clickxshift and clickyshift are used later to translate from x,y coords to the //pair of markers comparison at those coords if (!(markersLoaded)){ g2.translate((size.width - pref.width) / 2, (size.height - pref.height) / 2); clickXShift = left + (size.width-pref.width)/2; clickYShift = top + (size.height - pref.height)/2; } else { g2.translate((size.width - pref.width) / 2, 0); clickXShift = left + (size.width-pref.width)/2; clickYShift = top; } FontMetrics boxFontMetrics = g.getFontMetrics(boxFont); int diamondX[] = new int[4]; int diamondY[] = new int[4]; Polygon diamond; left = H_BORDER; top = V_BORDER; FontMetrics metrics; int ascent; g2.setColor(this.getBackground()); g2.fillRect(0,0,pref.width,pref.height); g2.setColor(Color.BLACK); if (markersLoaded) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //// draw the marker locations BasicStroke thickerStroke = new BasicStroke(1); BasicStroke thinnerStroke = new BasicStroke(0.25f); int wide = (dPrimeTable.length-1) * boxSize; //TODO: talk to kirby about locusview scaling gizmo int lineLeft = wide/20; int lineSpan = (wide/10)*9; long minpos = ((SNP)markers.elementAt(0)).getPosition(); long maxpos = ((SNP)markers.elementAt(markers.size()-1)).getPosition(); double spanpos = maxpos - minpos; g2.setStroke(thinnerStroke); g2.setColor(Color.white); g2.fillRect(left + lineLeft, 5, lineSpan, TICK_HEIGHT); g2.setColor(Color.black); g2.drawRect(left + lineLeft, 5, lineSpan, TICK_HEIGHT); for (int i = 0; i < markers.size(); i++) { double pos = (((SNP)markers.elementAt(i)).getPosition() - minpos) / spanpos; int xx = (int) (left + lineLeft + lineSpan*pos); g2.setStroke(thickerStroke); g.drawLine(xx, 5, xx, 5 + TICK_HEIGHT); g2.setStroke(thinnerStroke); g.drawLine(xx, 5 + TICK_HEIGHT, left + i*boxSize, TICK_BOTTOM); } top += TICK_BOTTOM; //// draw the marker names if (printDetails){ g.setFont(markerNameFont); metrics = g.getFontMetrics(); ascent = metrics.getAscent(); widestMarkerName = metrics.stringWidth(((SNP)markers.elementAt(0)).getName()); for (int x = 1; x < dPrimeTable.length; x++) { int thiswide = metrics.stringWidth(((SNP)markers.elementAt(x)).getName()); if (thiswide > widestMarkerName) widestMarkerName = thiswide; } //System.out.println(widest); g2.translate(left, top + widestMarkerName); g2.rotate(-Math.PI / 2.0); for (int x = 0; x < dPrimeTable.length; x++) { g2.drawString(((SNP)markers.elementAt(x)).getName(),TEXT_NUMBER_GAP, x*boxSize + ascent/3); } g2.rotate(Math.PI / 2.0); g2.translate(-left, -(top + widestMarkerName)); // move everybody down top += widestMarkerName + TEXT_NUMBER_GAP; } g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } //// draw the marker numbers if (printDetails){ g.setFont(markerNumFont); metrics = g.getFontMetrics(); ascent = metrics.getAscent(); for (int x = 0; x < dPrimeTable.length; x++) { String mark = String.valueOf(x + 1); g.drawString(mark, left + x*boxSize - metrics.stringWidth(mark)/2, top + ascent); } top += boxRadius/2; // give a little space between numbers and boxes } //if (pref.getWidth() > viewRect.width){ //this means that the table is bigger than the display. //the following values are the bounds on the boxes we want to //display given that the current window is 'clipRect' lowX = (clipRect.x-clickXShift-(clipRect.y+clipRect.height-clickYShift))/boxSize; if (lowX < 0) { lowX = 0; } highX = ((clipRect.x + clipRect.width)/boxSize)+1; if (highX > dPrimeTable.length-1){ highX = dPrimeTable.length-1; } lowY = ((clipRect.x-clickXShift)+(clipRect.y-clickYShift))/boxSize; if (lowY < lowX+1){ lowY = lowX+1; } highY = (((clipRect.x-clickXShift+clipRect.width) + (clipRect.y-clickYShift+clipRect.height))/boxSize)+1; if (highY > dPrimeTable.length){ highY = dPrimeTable.length; } /** boxSize = (int)((clipRect.width-2*H_BORDER)/dPrimeTable.length-1); if (boxSize < 12){boxSize=12;} if (boxSize < 25){ printDetails = false; boxRadius = boxSize/2; }else{ boxRadius = boxSize/2 - 1; } } else{ lowX = 0; highX = dPrimeTable.length-1; lowY = 0; highY = dPrimeTable.length; } **/ // draw table column by column for (int x = lowX; x < highX; x++) { //always draw the fewest possible boxes if (lowY < x+1){ lowY = x+1; } for (int y = lowY; y < highY; y++) { if (dPrimeTable[x][y] == null){ continue; } double d = dPrimeTable[x][y].getDPrime(); //double l = dPrimeTable[x][y].getLOD(); Color boxColor = dPrimeTable[x][y].getColor(); // draw markers above int xx = left + (x + y) * boxSize / 2; int yy = top + (y - x) * boxSize / 2; diamondX[0] = xx; diamondY[0] = yy - boxRadius; diamondX[1] = xx + boxRadius; diamondY[1] = yy; diamondX[2] = xx; diamondY[2] = yy + boxRadius; diamondX[3] = xx - boxRadius; diamondY[3] = yy; diamond = new Polygon(diamondX, diamondY, 4); g.setColor(boxColor); g.fillPolygon(diamond); if (boxColor == Color.white) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(Color.lightGray); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } if(printDetails){ g.setFont(boxFont); ascent = boxFontMetrics.getAscent(); int val = (int) (d * 100); g.setColor((val < 50) ? Color.gray : Color.black); if (val != 100) { String valu = String.valueOf(val); int widf = boxFontMetrics.stringWidth(valu); g.drawString(valu, xx - widf/2, yy + ascent/2); } } } } }
1,108,694
public void doTag(XMLOutput xmlOutput) throws Exception { // get the response from the context HttpResponse httpResponse = (HttpResponse) getContext().getVariable("response"); if (null == httpResponse) { throw new JellyException("HttpResponse variable not available in Jelly context"); } ByteArrayISO8859Writer writer = new ByteArrayISO8859Writer(1500); writer.write(getBodyText()); writer.flush(); httpResponse.setContentLength(writer.length()); writer.writeTo(httpResponse.getOutputStream()); }
public void doTag(XMLOutput xmlOutput) throws Exception { // get the response from the context HttpResponse httpResponse = (HttpResponse) getContext().getVariable("response"); if (null == httpResponse) { throw new JellyException("HttpResponse variable not available in Jelly context"); } ByteArrayISO8859Writer writer = new ByteArrayISO8859Writer(1500); writer.write(getBodyText()); writer.flush(); httpResponse.setContentLength(writer.size()); writer.writeTo(httpResponse.getOutputStream()); }
1,108,696
private static ConnectorRegistry create(ApplicationConfig config) throws Exception { Map paramValues = config.getParamValues(); String appId = config.getApplicationId(); String connectorId = (String) paramValues.get("connectorId"); File file1 = new File(CoreUtils.getConnectorDir() + File.separatorChar + connectorId); URL[] urls = new URL[]{file1.toURL()}; ClassLoader cl = ClassLoaderRepository.getClassLoader(urls, true); //URLClassLoader cl = new URLClassLoader(urls, // ConnectorMBeanRegistry.class.getClassLoader()); Registry.MODELER_MANIFEST = MBEANS_DESCRIPTOR; URL res = cl.getResource(MBEANS_DESCRIPTOR); logger.log(Level.INFO, "Application ID : " + appId); logger.log(Level.INFO, "Connector Archive: " + file1.getAbsoluteFile()); logger.log(Level.INFO, "MBean Descriptor : " + res.toString()); //Thread.currentThread().setContextClassLoader(cl); //Registry.setUseContextClassLoader(true); ConnectorRegistry registry = new ConnectorRegistry(); registry.loadMetadata(cl); String[] mbeans = registry.findManagedBeans(); MBeanServer server = MBeanServerFactory.createMBeanServer(DOMAIN_CONNECTOR); String objName = ":appType=connector,appName=" + config.getName() + ",connectorType=" + connectorId; for (int i = 0; i < mbeans.length; i++) { ManagedBean managed = registry.findManagedBean(mbeans[i]); String clsName = managed.getType(); String domain = managed.getDomain(); if (domain == null) { domain = DOMAIN_CONNECTOR; } Class cls = Class.forName(clsName, true, cl); Object obj = cls.newInstance(); // Call the initialize method if the MBean extends ConnectorSupport class if (cls.getSuperclass().getName().equals(CLASS_CONNECTOR_SUPPORT)) { Method method = cls.getMethod("initialize", new Class[] {Map.class}); Map props = config.getParamValues(); method.invoke(obj, new Object[] {props}); } ModelMBean mm = managed.createMBean(obj); String beanObjName = domain + objName + ",name=" + mbeans[i]; server.registerMBean(mm, new ObjectName(beanObjName)); } registry.setMBeanServer(server); entries.put(appId, registry); return registry; }
private static ConnectorRegistry create(ApplicationConfig config) throws Exception { Map paramValues = config.getParamValues(); String appId = config.getApplicationId(); String connectorId = (String) paramValues.get("connectorId"); File file1 = new File(CoreUtils.getConnectorDir() + File.separatorChar + connectorId); URL[] urls = new URL[]{file1.toURL()}; ClassLoader cl = ClassLoaderRepository.getClassLoader(urls, true); //URLClassLoader cl = new URLClassLoader(urls, // ConnectorMBeanRegistry.class.getClassLoader()); Registry.MODELER_MANIFEST = MBEANS_DESCRIPTOR; URL res = cl.getResource(MBEANS_DESCRIPTOR); logger.log(Level.INFO, "Application ID : " + appId); logger.log(Level.INFO, "Connector Archive: " + file1.getAbsoluteFile()); logger.log(Level.INFO, "MBean Descriptor : " + res.toString()); //Thread.currentThread().setContextClassLoader(cl); //Registry.setUseContextClassLoader(true); ConnectorRegistry registry = new ConnectorRegistry(); registry.loadMetadata(cl); String[] mbeans = registry.findManagedBeans(); MBeanServer server = MBeanServerFactory.createMBeanServer(DOMAIN_CONNECTOR); String objName = ":appType=connector,appName=" + config.getName() + ",connectorType=" + connectorId; for (int i = 0; i < mbeans.length; i++) { ManagedBean managed = registry.findManagedBean(mbeans[i]); String clsName = managed.getType(); String domain = managed.getDomain(); if (domain == null) { domain = DOMAIN_CONNECTOR; } Class cls = Class.forName(clsName, true, cl); Object obj = cls.newInstance(); // Call the initialize method if the MBean extends ConnectorSupport class if (cls.getSuperclass().getName().equals(CLASS_CONNECTOR_SUPPORT)) { Method method = cls.getMethod("initialize", new Class[] {Map.class}); Map props = config.getParamValues(); method.invoke(obj, new Object[] {props}); } ModelMBean mm = managed.createMBean(obj); String beanObjName = domain + objName + ",name=" + mbeans[i]; server.registerMBean(mm, new ObjectName(beanObjName)); } registry.setMBeanServer(server); entries.put(appId, registry); return registry; }
1,108,697
public void stateChanged(ChangeEvent e) { int tabNum = tabs.getSelectedIndex(); if (tabNum == VIEW_D_NUM || tabNum == VIEW_HAP_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(true); }else if (tabNum == VIEW_TDT_NUM || tabNum == VIEW_CHECK_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } if (tabNum == VIEW_D_NUM){ keyMenu.setEnabled(true); }else{ keyMenu.setEnabled(false); } 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,9)).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.filteredDPrimeTable = theData.getFilteredTable(); //after editing the filtered marker list, needs to be prodded into //resizing correctly Dimension size = dPrimeDisplay.getSize(); Dimension pref = dPrimeDisplay.getPreferredSize(); Rectangle visRect = dPrimeDisplay.getVisibleRect(); if (size.width != pref.width && pref.width > visRect.width){ ((JViewport)dPrimeDisplay.getParent()).setViewSize(pref); } hapDisplay.theData = theData; changeBlocks(currentBlockDef); if (tdtPanel != null){ tdtPanel.refreshTable(); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try{ hapDisplay.getHaps(); }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); theData.blocksChanged = false; } }
public void stateChanged(ChangeEvent e) { int tabNum = tabs.getSelectedIndex(); if (tabNum == VIEW_D_NUM || tabNum == VIEW_HAP_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(true); }else if (tabNum == VIEW_TDT_NUM || tabNum == VIEW_CHECK_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } if (tabNum == VIEW_D_NUM){ keyMenu.setEnabled(true); }else{ keyMenu.setEnabled(false); } 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,CheckDataPanel.STATUS_COL)).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.filteredDPrimeTable = theData.getFilteredTable(); //after editing the filtered marker list, needs to be prodded into //resizing correctly Dimension size = dPrimeDisplay.getSize(); Dimension pref = dPrimeDisplay.getPreferredSize(); Rectangle visRect = dPrimeDisplay.getVisibleRect(); if (size.width != pref.width && pref.width > visRect.width){ ((JViewport)dPrimeDisplay.getParent()).setViewSize(pref); } hapDisplay.theData = theData; changeBlocks(currentBlockDef); if (tdtPanel != null){ tdtPanel.refreshTable(); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try{ hapDisplay.getHaps(); }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); theData.blocksChanged = false; } }
1,108,698
public static void main(String[] args) { boolean nogui = false; //HaploView window; for(int i = 0;i<args.length;i++) { if(args[i].equals("-n") || args[i].equals("-h") || args[i].equals("-help")) { nogui = true; } } if(nogui) { HaploText textOnly = new HaploText(args); } else { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } //System.setProperty("swing.disableFileChooserSpeedFix", "true"); window = new HaploView(); //setup view object window.setTitle(TITLE_STRING); window.setSize(800,600); //center the window on the screen Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); window.setLocation((screen.width - window.getWidth()) / 2, (screen.height - window.getHeight()) / 2); window.setVisible(true); //parse command line stuff for input files or prompt data dialog HaploText argParser = new HaploText(args); String[] inputArray = new String[3]; if (argParser.getHapsFileName() != ""){ inputArray[0] = argParser.getHapsFileName(); inputArray[1] = argParser.getInfoFileName(); inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readPhasedGenotypes(inputArray); }else if (argParser.getPedFileName() != ""){ inputArray[0] = argParser.getPedFileName(); inputArray[1] = argParser.getInfoFileName(); inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readPedGenotypes(inputArray, 3); }else if (argParser.getHapmapFileName() != ""){ inputArray[0] = argParser.getHapmapFileName(); inputArray[1] = ""; inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readPedGenotypes(inputArray, 4); }else{ ReadDataDialog readDialog = new ReadDataDialog("Welcome to HaploView", window); readDialog.pack(); readDialog.setVisible(true); } } }
public static void main(String[] args) { boolean nogui = false; //HaploView window; for(int i = 0;i<args.length;i++) { if(args[i].equals("-n") || args[i].equals("-h") || args[i].equals("-help")) { nogui = true; } } if(nogui) { HaploText textOnly = new HaploText(args); } else { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } //System.setProperty("swing.disableFileChooserSpeedFix", "true"); window = new HaploView(); //setup view object window.setTitle(TITLE_STRING); window.setSize(800,600); //center the window on the screen Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); window.setLocation((screen.width - window.getWidth()) / 2, (screen.height - window.getHeight()) / 2); window.setVisible(true); //parse command line stuff for input files or prompt data dialog HaploText argParser = new HaploText(args); String[] inputArray = new String[3]; if (argParser.getHapsFileName() != ""){ inputArray[0] = argParser.getHapsFileName(); inputArray[1] = argParser.getInfoFileName(); inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readGenotypes(inputArray, HAPS); }else if (argParser.getPedFileName() != ""){ inputArray[0] = argParser.getPedFileName(); inputArray[1] = argParser.getInfoFileName(); inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readPedGenotypes(inputArray, 3); }else if (argParser.getHapmapFileName() != ""){ inputArray[0] = argParser.getHapmapFileName(); inputArray[1] = ""; inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readPedGenotypes(inputArray, 4); }else{ ReadDataDialog readDialog = new ReadDataDialog("Welcome to HaploView", window); readDialog.pack(); readDialog.setVisible(true); } } }
1,108,699
public static void main(String[] args) { boolean nogui = false; //HaploView window; for(int i = 0;i<args.length;i++) { if(args[i].equals("-n") || args[i].equals("-h") || args[i].equals("-help")) { nogui = true; } } if(nogui) { HaploText textOnly = new HaploText(args); } else { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } //System.setProperty("swing.disableFileChooserSpeedFix", "true"); window = new HaploView(); //setup view object window.setTitle(TITLE_STRING); window.setSize(800,600); //center the window on the screen Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); window.setLocation((screen.width - window.getWidth()) / 2, (screen.height - window.getHeight()) / 2); window.setVisible(true); //parse command line stuff for input files or prompt data dialog HaploText argParser = new HaploText(args); String[] inputArray = new String[3]; if (argParser.getHapsFileName() != ""){ inputArray[0] = argParser.getHapsFileName(); inputArray[1] = argParser.getInfoFileName(); inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readPhasedGenotypes(inputArray); }else if (argParser.getPedFileName() != ""){ inputArray[0] = argParser.getPedFileName(); inputArray[1] = argParser.getInfoFileName(); inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readPedGenotypes(inputArray, 3); }else if (argParser.getHapmapFileName() != ""){ inputArray[0] = argParser.getHapmapFileName(); inputArray[1] = ""; inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readPedGenotypes(inputArray, 4); }else{ ReadDataDialog readDialog = new ReadDataDialog("Welcome to HaploView", window); readDialog.pack(); readDialog.setVisible(true); } } }
public static void main(String[] args) { boolean nogui = false; //HaploView window; for(int i = 0;i<args.length;i++) { if(args[i].equals("-n") || args[i].equals("-h") || args[i].equals("-help")) { nogui = true; } } if(nogui) { HaploText textOnly = new HaploText(args); } else { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } //System.setProperty("swing.disableFileChooserSpeedFix", "true"); window = new HaploView(); //setup view object window.setTitle(TITLE_STRING); window.setSize(800,600); //center the window on the screen Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); window.setLocation((screen.width - window.getWidth()) / 2, (screen.height - window.getHeight()) / 2); window.setVisible(true); //parse command line stuff for input files or prompt data dialog HaploText argParser = new HaploText(args); String[] inputArray = new String[3]; if (argParser.getHapsFileName() != ""){ inputArray[0] = argParser.getHapsFileName(); inputArray[1] = argParser.getInfoFileName(); inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readPhasedGenotypes(inputArray); }else if (argParser.getPedFileName() != ""){ inputArray[0] = argParser.getPedFileName(); inputArray[1] = argParser.getInfoFileName(); inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readGenotypes(inputArray, PED); }else if (argParser.getHapmapFileName() != ""){ inputArray[0] = argParser.getHapmapFileName(); inputArray[1] = ""; inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readPedGenotypes(inputArray, 4); }else{ ReadDataDialog readDialog = new ReadDataDialog("Welcome to HaploView", window); readDialog.pack(); readDialog.setVisible(true); } } }
1,108,700
public static void main(String[] args) { boolean nogui = false; //HaploView window; for(int i = 0;i<args.length;i++) { if(args[i].equals("-n") || args[i].equals("-h") || args[i].equals("-help")) { nogui = true; } } if(nogui) { HaploText textOnly = new HaploText(args); } else { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } //System.setProperty("swing.disableFileChooserSpeedFix", "true"); window = new HaploView(); //setup view object window.setTitle(TITLE_STRING); window.setSize(800,600); //center the window on the screen Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); window.setLocation((screen.width - window.getWidth()) / 2, (screen.height - window.getHeight()) / 2); window.setVisible(true); //parse command line stuff for input files or prompt data dialog HaploText argParser = new HaploText(args); String[] inputArray = new String[3]; if (argParser.getHapsFileName() != ""){ inputArray[0] = argParser.getHapsFileName(); inputArray[1] = argParser.getInfoFileName(); inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readPhasedGenotypes(inputArray); }else if (argParser.getPedFileName() != ""){ inputArray[0] = argParser.getPedFileName(); inputArray[1] = argParser.getInfoFileName(); inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readPedGenotypes(inputArray, 3); }else if (argParser.getHapmapFileName() != ""){ inputArray[0] = argParser.getHapmapFileName(); inputArray[1] = ""; inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readPedGenotypes(inputArray, 4); }else{ ReadDataDialog readDialog = new ReadDataDialog("Welcome to HaploView", window); readDialog.pack(); readDialog.setVisible(true); } } }
public static void main(String[] args) { boolean nogui = false; //HaploView window; for(int i = 0;i<args.length;i++) { if(args[i].equals("-n") || args[i].equals("-h") || args[i].equals("-help")) { nogui = true; } } if(nogui) { HaploText textOnly = new HaploText(args); } else { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } //System.setProperty("swing.disableFileChooserSpeedFix", "true"); window = new HaploView(); //setup view object window.setTitle(TITLE_STRING); window.setSize(800,600); //center the window on the screen Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); window.setLocation((screen.width - window.getWidth()) / 2, (screen.height - window.getHeight()) / 2); window.setVisible(true); //parse command line stuff for input files or prompt data dialog HaploText argParser = new HaploText(args); String[] inputArray = new String[3]; if (argParser.getHapsFileName() != ""){ inputArray[0] = argParser.getHapsFileName(); inputArray[1] = argParser.getInfoFileName(); inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readPhasedGenotypes(inputArray); }else if (argParser.getPedFileName() != ""){ inputArray[0] = argParser.getPedFileName(); inputArray[1] = argParser.getInfoFileName(); inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readPedGenotypes(inputArray, 3); }else if (argParser.getHapmapFileName() != ""){ inputArray[0] = argParser.getHapmapFileName(); inputArray[1] = ""; inputArray[2] = String.valueOf(argParser.getMaxDistance()); window.readGenotypes(inputArray, DCC); }else{ ReadDataDialog readDialog = new ReadDataDialog("Welcome to HaploView", window); readDialog.pack(); readDialog.setVisible(true); } } }
1,108,701
public Object construct(){ dPrimeDisplay=null; theData.infoKnown = false; File markerFile; if (inputOptions[1].equals("")){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } readMarkers(markerFile, hminfo); changeKey(1); theData.generateDPrimeTable(); //theData.guessBlocks(BLOX_GABRIEL); theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first colorMenuItems[0].setSelected(true); blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); //LOD panel /*panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); LODDisplay ld = new LODDisplay(theData); JScrollPane lodScroller = new JScrollPane(ld); panel.add(lodScroller); tabs.addTab(viewItems[VIEW_LOD_NUM], panel); viewMenuItems[VIEW_LOD_NUM].setEnabled(true);*/ //int optionalTabCount = 1; //check data panel if (checkPanel != null){ //optionalTabCount++; //VIEW_CHECK_NUM = optionalTabCount; //viewItems[VIEW_CHECK_NUM] = VIEW_CHECK_PANEL; JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); JLabel countsLabel = new JLabel("Using " + theData.numSingletons + " singletons and " + theData.numTrios + " trios from " + theData.numPeds + " families."); if (theData.numTrios + theData.numSingletons == 0){ countsLabel.setForeground(Color.red); } countsLabel.setAlignmentX(Component.CENTER_ALIGNMENT); metaCheckPanel.add(countsLabel); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //TDT panel if(assocTest > 0) { //optionalTabCount++; //VIEW_TDT_NUM = optionalTabCount; //viewItems[VIEW_TDT_NUM] = VIEW_TDT; tdtPanel = new TDTPanel(theData.chromosomes, assocTest); tabs.addTab(viewItems[VIEW_TDT_NUM], tdtPanel); viewMenuItems[VIEW_TDT_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inputOptions[0]); return null; }
public Object construct(){ dPrimeDisplay=null; theData.infoKnown = false; File markerFile; if (inputOptions[1].equals("")){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } readMarkers(markerFile, hminfo); changeKey(1); theData.generateDPrimeTable(); //theData.guessBlocks(BLOX_GABRIEL); theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first colorMenuItems[0].setSelected(true); blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); //LOD panel /*panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); LODDisplay ld = new LODDisplay(theData); JScrollPane lodScroller = new JScrollPane(ld); panel.add(lodScroller); tabs.addTab(viewItems[VIEW_LOD_NUM], panel); viewMenuItems[VIEW_LOD_NUM].setEnabled(true);*/ //int optionalTabCount = 1; //check data panel if (checkPanel != null){ //optionalTabCount++; //VIEW_CHECK_NUM = optionalTabCount; //viewItems[VIEW_CHECK_NUM] = VIEW_CHECK_PANEL; JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); JLabel countsLabel = new JLabel("Using " + theData.numSingletons + " singletons and " + theData.numTrios + " trios from " + theData.numPeds + " families."); if (theData.numTrios + theData.numSingletons == 0){ countsLabel.setForeground(Color.red); } countsLabel.setAlignmentX(Component.CENTER_ALIGNMENT); metaCheckPanel.add(countsLabel); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //TDT panel if(assocTest > 0) { //optionalTabCount++; //VIEW_TDT_NUM = optionalTabCount; //viewItems[VIEW_TDT_NUM] = VIEW_TDT; tdtPanel = new TDTPanel(theData.chromosomes, assocTest); tabs.addTab(viewItems[VIEW_TDT_NUM], tdtPanel); viewMenuItems[VIEW_TDT_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inputOptions[0]); return null; }
1,108,702
public Object construct(){ dPrimeDisplay=null; theData.infoKnown = false; File markerFile; if (inputOptions[1].equals("")){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } readMarkers(markerFile, hminfo); changeKey(1); theData.generateDPrimeTable(); //theData.guessBlocks(BLOX_GABRIEL); theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first colorMenuItems[0].setSelected(true); blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); //LOD panel /*panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); LODDisplay ld = new LODDisplay(theData); JScrollPane lodScroller = new JScrollPane(ld); panel.add(lodScroller); tabs.addTab(viewItems[VIEW_LOD_NUM], panel); viewMenuItems[VIEW_LOD_NUM].setEnabled(true);*/ //int optionalTabCount = 1; //check data panel if (checkPanel != null){ //optionalTabCount++; //VIEW_CHECK_NUM = optionalTabCount; //viewItems[VIEW_CHECK_NUM] = VIEW_CHECK_PANEL; JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); JLabel countsLabel = new JLabel("Using " + theData.numSingletons + " singletons and " + theData.numTrios + " trios from " + theData.numPeds + " families."); if (theData.numTrios + theData.numSingletons == 0){ countsLabel.setForeground(Color.red); } countsLabel.setAlignmentX(Component.CENTER_ALIGNMENT); metaCheckPanel.add(countsLabel); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //TDT panel if(assocTest > 0) { //optionalTabCount++; //VIEW_TDT_NUM = optionalTabCount; //viewItems[VIEW_TDT_NUM] = VIEW_TDT; tdtPanel = new TDTPanel(theData.chromosomes, assocTest); tabs.addTab(viewItems[VIEW_TDT_NUM], tdtPanel); viewMenuItems[VIEW_TDT_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inputOptions[0]); return null; }
public Object construct(){ dPrimeDisplay=null; theData.infoKnown = false; File markerFile; if (inputOptions[1].equals("")){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } readMarkers(markerFile, hminfo); changeKey(1); theData.generateDPrimeTable(); //theData.guessBlocks(BLOX_GABRIEL); theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first colorMenuItems[0].setSelected(true); blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); //LOD panel /*panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); LODDisplay ld = new LODDisplay(theData); JScrollPane lodScroller = new JScrollPane(ld); panel.add(lodScroller); tabs.addTab(viewItems[VIEW_LOD_NUM], panel); viewMenuItems[VIEW_LOD_NUM].setEnabled(true);*/ //int optionalTabCount = 1; //check data panel if (checkPanel != null){ //optionalTabCount++; //VIEW_CHECK_NUM = optionalTabCount; //viewItems[VIEW_CHECK_NUM] = VIEW_CHECK_PANEL; JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); JLabel countsLabel = new JLabel("Using " + theData.numSingletons + " singletons and " + theData.numTrios + " trios from " + theData.numPeds + " families."); if (theData.numTrios + theData.numSingletons == 0){ countsLabel.setForeground(Color.red); } countsLabel.setAlignmentX(Component.CENTER_ALIGNMENT); metaCheckPanel.add(countsLabel); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //TDT panel if(assocTest > 0) { //optionalTabCount++; //VIEW_TDT_NUM = optionalTabCount; //viewItems[VIEW_TDT_NUM] = VIEW_TDT; tdtPanel = new TDTPanel(theData.chromosomes, assocTest); tabs.addTab(viewItems[VIEW_TDT_NUM], tdtPanel); viewMenuItems[VIEW_TDT_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; }
1,108,703
void readMarkers(File inputFile, String[][] hminfo){ try { theData.prepareMarkerInput(inputFile,maxCompDist,hminfo); if (checkPanel != null){ checkPanel.refreshNames(); } if (tdtPanel != null){ tdtPanel.refreshNames(); } }catch (HaploViewException e){ JOptionPane.showMessageDialog(this, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); }catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } if (dPrimeDisplay != null && tabs.getSelectedIndex() == VIEW_D_NUM){ dPrimeDisplay.refresh(); } }
void readMarkers(File inputFile, String[][] hminfo){ try { theData.prepareMarkerInput(inputFile,maxCompDist,hminfo); if (checkPanel != null){ checkPanel = new CheckDataPanel(theData); Container checkTab = (Container)tabs.getComponentAt(VIEW_CHECK_NUM); checkTab.removeAll(); JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); JLabel countsLabel = new JLabel("Using " + theData.numSingletons + " singletons and " + theData.numTrios + " trios from " + theData.numPeds + " families."); if (theData.numTrios + theData.numSingletons == 0){ countsLabel.setForeground(Color.red); } countsLabel.setAlignmentX(Component.CENTER_ALIGNMENT); metaCheckPanel.add(countsLabel); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); checkTab.add(metaCheckPanel); repaint(); } if (tdtPanel != null){ tdtPanel.refreshNames(); } }catch (HaploViewException e){ JOptionPane.showMessageDialog(this, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); }catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } if (dPrimeDisplay != null && tabs.getSelectedIndex() == VIEW_D_NUM){ dPrimeDisplay.refresh(); } }
1,108,704
public static double gammq (double a, double x) throws CheckDataException { double gamser, gammcf; //, gln; if ((x < 0.0 )|| (a <= 0.0 )) throw new CheckDataException("Invalid arguments in routine gammq" ); if (x < (a + 1.0) ) { gamser = gser(a , x); return (1.0 - gamser) ; } else { gammcf = gcf (a , x); return gammcf ; } }
public static double gammq (double a, double x) { double gamser, gammcf; //, gln; if ((x < 0.0 )|| (a <= 0.0 )) throw new CheckDataException("Invalid arguments in routine gammq" ); if (x < (a + 1.0) ) { gamser = gser(a , x); return (1.0 - gamser) ; } else { gammcf = gcf (a , x); return gammcf ; } }
1,108,707
public static double gammq (double a, double x) throws CheckDataException { double gamser, gammcf; //, gln; if ((x < 0.0 )|| (a <= 0.0 )) throw new CheckDataException("Invalid arguments in routine gammq" ); if (x < (a + 1.0) ) { gamser = gser(a , x); return (1.0 - gamser) ; } else { gammcf = gcf (a , x); return gammcf ; } }
public static double gammq (double a, double x) throws CheckDataException { double gamser, gammcf; //, gln; if ((x < 0.0 )|| (a <= 0.0 )) throw new CheckDataException("Invalid arguments in routine gammq" ); if (x < (a + 1.0) ) { gamser = gser(a , x); return (1.0 - gamser) ; } else { gammcf = gcf (a , x); return gammcf ; } }
1,108,708
public HaplotypeAssociationNode(String name) { this.name = name; this.freq = ""; this.chisq = -1; this.pval = ""; }
public HaplotypeAssociationNode(String name) { this.name = name; this.freq = ""; this.chisq = -1; this.pval = new Double(0); }
1,108,710
public void writeTable(SQLTable t) throws SQLException, ArchitectException { Map colNameMap = new HashMap(); // for detecting duplicate column names String origTableName = t.getName(); if (topLevelNames.get(t.getName()) != null) { int i = 1; String newName = origTableName+"_"+i; while (topLevelNames.get(newName) != null) { i++; newName = origTableName+"_"+i; } t.setTableName(newName); warnings.add(new NameChangeWarning(t, "Duplicate Table Name", origTableName)); } topLevelNames.put(t.getName(), t); print("\nCREATE TABLE "); printIdentifier(t.getName()); println(" ("); boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn c = (SQLColumn) it.next(); String origName = c.getName(); if (colNameMap.get(origName) != null) { int i = 1; String newName = origName+"_"+i; while (colNameMap.get(newName) != null) { i++; newName = origName+"_"+i; } c.setColumnName(newName); warnings.add(new NameChangeWarning(c, "Duplicate Col Name", origName)); } colNameMap.put(c.getName(), c); GenericTypeDescriptor td = (GenericTypeDescriptor) typeMap.get(new Integer(c.getType())); if (td == null) { td = (GenericTypeDescriptor) typeMap.get(new Integer(Types.VARCHAR)); //better be non-null! GenericTypeDescriptor oldType = new GenericTypeDescriptor (c.getSourceDBTypeName(), c.getType(), c.getPrecision(), null, null, c.getNullable(), false, false); oldType.determineScaleAndPrecision(); warnings.add(new TypeMapWarning(c, "Unknown Target Type", oldType, td)); } if (!firstCol) println(","); print(" "); printIdentifier(c.getName()); print(" "); print(td.getName()); if (td.getHasScale()) { print("("+c.getScale()); if (td.getHasPrecision()) { print(","+c.getPrecision()); } print(")"); } if (c.isNullable()) { if (! td.isNullable()) { throw new UnsupportedOperationException ("The data type "+td.getName()+" is not nullable on the target database platform."); } print(" NULL"); } else { print(" NOT NULL"); } // XXX: default values handled only in ETL? firstCol = false; } println(""); print(")"); endStatement(); println(""); }
public void writeTable(SQLTable t) throws SQLException, ArchitectException { Map colNameMap = new HashMap(); // for detecting duplicate column names String origTableName = t.getName(); if (topLevelNames.get(t.getName()) != null) { int i = 1; String newName = origTableName+"_"+i; while (topLevelNames.get(newName) != null) { i++; newName = origTableName+"_"+i; } t.setTableName(newName); warnings.add(new NameChangeWarning(t, "Duplicate Table Name", origTableName)); } topLevelNames.put(t.getName(), t); print("\nCREATE TABLE "); printIdentifier(t.getName()); println(" ("); boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn c = (SQLColumn) it.next(); String origName = c.getName(); if (colNameMap.get(origName) != null) { int i = 1; String newName = origName+"_"+i; while (colNameMap.get(newName) != null) { i++; newName = origName+"_"+i; } c.setColumnName(newName); warnings.add(new NameChangeWarning(c, "Duplicate Col Name", origName)); } colNameMap.put(c.getName(), c); GenericTypeDescriptor td = (GenericTypeDescriptor) typeMap.get(new Integer(c.getType())); if (td == null) { td = (GenericTypeDescriptor) typeMap.get(new Integer(Types.VARCHAR)); //better be non-null! GenericTypeDescriptor oldType = new GenericTypeDescriptor (c.getSourceDBTypeName(), c.getType(), c.getPrecision(), null, null, c.getNullable(), false, false); oldType.determineScaleAndPrecision(); warnings.add(new TypeMapWarning(c, "Unknown Target Type", oldType, td)); } if (!firstCol) println(","); print(" "); printIdentifier(c.getName()); print(" "); print(td.getName()); if (td.getHasScale()) { print("("+c.getScale()); if (td.getHasPrecision()) { print(","+c.getPrecision()); } print(")"); } if (c.isDefinitelyNullable()) { if (! td.isNullable()) { throw new UnsupportedOperationException ("The data type "+td.getName()+" is not nullable on the target database platform."); } print(" NULL"); } else { print(" NOT NULL"); } // XXX: default values handled only in ETL? firstCol = false; } println(""); print(")"); endStatement(); println(""); }
1,108,711
public void doTag(XMLOutput output) throws Exception { Project project = getAntProject(); String tagName = getTagName(); Object parentObject = findBeanAncestor(); // 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 if ( ! ( parentObject instanceof Task ) && project.getTaskDefinitions().containsKey( tagName ) ) { 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 task = createTask( tagName ); 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 }; method.invoke(this.task, args); } // 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(); } else { if ( log.isDebugEnabled() ) { log.debug( "Creating a nested object name: " + tagName ); } Object nested = createNestedObject( parentObject, tagName ); if ( nested == null ) { nested = createDataType( 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 { // 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 Exception { Project project = getAntProject(); String tagName = getTagName(); Object parentObject = findBeanAncestor(); // 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 if ( ! ( parentObject instanceof Task ) && project.getTaskDefinitions().containsKey( tagName ) ) { 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 task = createTask( tagName ); 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 }; method.invoke(this.task, args); } // 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(); } else { if ( log.isDebugEnabled() ) { log.debug( "Creating a nested object name: " + tagName ); } Object nested = createNestedObject( parentObject, tagName ); if ( nested == null ) { nested = createDataType( 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 { // 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,108,712
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals(READ_GENOTYPES)){ ReadDataDialog readDialog = new ReadDataDialog("Open new data", this); readDialog.pack(); readDialog.setVisible(true); } else if (command.equals(READ_MARKERS)){ //JFileChooser fc = new JFileChooser(System.getProperty("user.dir")); fc.setSelectedFile(new File("")); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { readMarkers(fc.getSelectedFile(),null); } }else if (command.equals(READ_ANALYSIS_TRACK)){ fc.setSelectedFile(new File("")); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION){ readAnalysisFile(fc.getSelectedFile()); } }else if (command.equals(DOWNLOAD_GBROWSE)){ GBrowseDialog gbd = new GBrowseDialog(this, "Connect to HapMap Info Server"); gbd.pack(); gbd.setVisible(true); }else if (command.equals(READ_BLOCKS_FILE)){ fc.setSelectedFile(new File("")); if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION){ readBlocksFile(fc.getSelectedFile()); } }else if (command.equals(CUST_BLOCKS)){ TweakBlockDefsDialog tweakDialog = new TweakBlockDefsDialog("Customize Blocks", this); tweakDialog.pack(); tweakDialog.setVisible(true); }else if (command.equals(CLEAR_BLOCKS)){ changeBlocks(BLOX_NONE); //blockdef clauses }else if (command.startsWith("block")){ int method = Integer.valueOf(command.substring(5)).intValue(); changeBlocks(method); /*for (int i = 1; i < colorMenuItems.length; i++){ if (method+1 == i){ colorMenuItems[i].setEnabled(true); }else{ colorMenuItems[i].setEnabled(false); } } colorMenuItems[0].setSelected(true);*/ //zooming clauses }else if (command.startsWith("zoom")){ dPrimeDisplay.zoom(Integer.valueOf(command.substring(4)).intValue()); //coloring clauses }else if (command.startsWith("color")){ Options.setLDColorScheme(Integer.valueOf(command.substring(5)).intValue()); dPrimeDisplay.colorDPrime(); changeKey(); //exporting clauses }else if (command.equals(EXPORT_PNG)){ export(tabs.getSelectedIndex(), PNG_MODE, 0, Chromosome.getSize()); }else if (command.equals(EXPORT_TEXT)){ export(tabs.getSelectedIndex(), TXT_MODE, 0, Chromosome.getSize()); }else if (command.equals(EXPORT_OPTIONS)){ ExportDialog exDialog = new ExportDialog(this); exDialog.pack(); exDialog.setVisible(true); }else if (command.equals("Select All")){ checkPanel.selectAll(); }else if (command.equals("Rescore Markers")){ String cut = cdc.hwcut.getText(); if (cut.equals("")){ cut = "0"; } CheckData.hwCut = Double.parseDouble(cut); cut = cdc.genocut.getText(); if (cut.equals("")){ cut="0"; } CheckData.failedGenoCut = Integer.parseInt(cut); cut = cdc.mendcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.numMendErrCut = Integer.parseInt(cut); cut = cdc.mafcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.mafCut = Double.parseDouble(cut); checkPanel.redoRatings(); JTable jt = checkPanel.getTable(); jt.repaint(); }else if (command.equals("LD Display Spacing")){ ProportionalSpacingDialog spaceDialog = new ProportionalSpacingDialog(this, "Adjust LD Spacing"); spaceDialog.pack(); spaceDialog.setVisible(true); }else if (command.equals("Tutorial")){ showHelp(); } else if(command.equals("Check for update")) { final SwingWorker worker = new SwingWorker(){ UpdateChecker uc; public Object construct() { uc = new UpdateChecker(); uc.checkForUpdate(); return null; } public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { UpdateDisplayDialog udp = new UpdateDisplayDialog(window,"Update Check",uc); udp.pack(); udp.setVisible(true); } else { JOptionPane.showMessageDialog(window, "Your version of Haploview is up to date.", "Update Check", JOptionPane.INFORMATION_MESSAGE); } } window.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }; setCursor(new Cursor(Cursor.WAIT_CURSOR)); worker.start(); }else if (command.equals("Quit")){ quit(); } else { for (int i = 0; i < viewItems.length; i++) { if (command.equals(viewItems[i])) tabs.setSelectedIndex(i); } } }
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals(READ_GENOTYPES)){ ReadDataDialog readDialog = new ReadDataDialog("Open new data", this); readDialog.pack(); readDialog.setVisible(true); } else if (command.equals(READ_MARKERS)){ //JFileChooser fc = new JFileChooser(System.getProperty("user.dir")); fc.setSelectedFile(new File("")); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { readMarkers(fc.getSelectedFile(),null); } }else if (command.equals(READ_ANALYSIS_TRACK)){ fc.setSelectedFile(new File("")); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION){ readAnalysisFile(fc.getSelectedFile()); } }else if (command.equals(DOWNLOAD_GBROWSE)){ GBrowseDialog gbd = new GBrowseDialog(this, "Connect to HapMap Info Server"); gbd.pack(); gbd.setVisible(true); }else if (command.equals(READ_BLOCKS_FILE)){ fc.setSelectedFile(new File("")); if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION){ readBlocksFile(fc.getSelectedFile()); } }else if (command.equals(CUST_BLOCKS)){ TweakBlockDefsDialog tweakDialog = new TweakBlockDefsDialog("Customize Blocks", this); tweakDialog.pack(); tweakDialog.setVisible(true); }else if (command.equals(CLEAR_BLOCKS)){ changeBlocks(BLOX_NONE); //blockdef clauses }else if (command.startsWith("block")){ int method = Integer.valueOf(command.substring(5)).intValue(); changeBlocks(method); /*for (int i = 1; i < colorMenuItems.length; i++){ if (method+1 == i){ colorMenuItems[i].setEnabled(true); }else{ colorMenuItems[i].setEnabled(false); } } colorMenuItems[0].setSelected(true);*/ //zooming clauses }else if (command.startsWith("zoom")){ dPrimeDisplay.zoom(Integer.valueOf(command.substring(4)).intValue()); //coloring clauses }else if (command.startsWith("color")){ Options.setLDColorScheme(Integer.valueOf(command.substring(5)).intValue()); dPrimeDisplay.colorDPrime(); changeKey(); //exporting clauses }else if (command.equals(EXPORT_PNG)){ export(tabs.getSelectedIndex(), PNG_MODE, 0, Chromosome.getSize()); }else if (command.equals(EXPORT_TEXT)){ export(tabs.getSelectedIndex(), TXT_MODE, 0, Chromosome.getSize()); }else if (command.equals(EXPORT_OPTIONS)){ ExportDialog exDialog = new ExportDialog(this); exDialog.pack(); exDialog.setVisible(true); }else if (command.equals("Select All")){ checkPanel.selectAll(); }else if (command.equals("Rescore Markers")){ String cut = cdc.hwcut.getText(); if (cut.equals("")){ cut = "0"; } CheckData.hwCut = Double.parseDouble(cut); cut = cdc.genocut.getText(); if (cut.equals("")){ cut="0"; } CheckData.failedGenoCut = Integer.parseInt(cut); cut = cdc.mendcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.numMendErrCut = Integer.parseInt(cut); cut = cdc.mafcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.mafCut = Double.parseDouble(cut); checkPanel.redoRatings(); JTable jt = checkPanel.getTable(); jt.repaint(); }else if (command.equals("LD Display Spacing")){ ProportionalSpacingDialog spaceDialog = new ProportionalSpacingDialog(this, "Adjust LD Spacing"); spaceDialog.pack(); spaceDialog.setVisible(true); }else if (command.equals("Tutorial")){ showHelp(); } else if(command.equals("Check for update")) { final SwingWorker worker = new SwingWorker(){ UpdateChecker uc; public Object construct() { uc = new UpdateChecker(); uc.checkForUpdate(); return null; } public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { UpdateDisplayDialog udp = new UpdateDisplayDialog(window,"Update Check",uc); udp.pack(); udp.setVisible(true); } else { JOptionPane.showMessageDialog(window, "Your version of Haploview is up to date.", "Update Check", JOptionPane.INFORMATION_MESSAGE); } } } }; setCursor(new Cursor(Cursor.WAIT_CURSOR)); worker.start(); }else if (command.equals("Quit")){ quit(); } else { for (int i = 0; i < viewItems.length; i++) { if (command.equals(viewItems[i])) tabs.setSelectedIndex(i); } } }
1,108,714
public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { UpdateDisplayDialog udp = new UpdateDisplayDialog(window,"Update Check",uc); udp.pack(); udp.setVisible(true); } else { JOptionPane.showMessageDialog(window, "Your version of Haploview is up to date.", "Update Check", JOptionPane.INFORMATION_MESSAGE); } } window.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { UpdateDisplayDialog udp = new UpdateDisplayDialog(window,"Update Check",uc); udp.pack(); udp.setVisible(true); } else { JOptionPane.showMessageDialog(window, "Your version of Haploview is up to date.", "Update Check", JOptionPane.INFORMATION_MESSAGE); } } }
1,108,715
public void actionPerformed(ActionEvent e) { final JDialog d = new JDialog(ArchitectFrame.getMainInstance(), "New PL Repository Connection"); JPanel plr = new JPanel(new BorderLayout(12,12)); plr.setBorder(BorderFactory.createEmptyBorder(12,12,12,12)); final DBCSPanel dbcsPanel = new DBCSPanel(); plr.add(dbcsPanel, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JButton okButton = new JButton("Ok"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { dbcs = new DBConnectionSpec(); dbcsPanel.applyChanges(dbcs); historyBox.addItem(ASUtils.lvb(dbcs.getDisplayName(), dbcs)); d.setVisible(false); } }); buttonPanel.add(okButton); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { dbcsPanel.discardChanges(); d.setVisible(false); } }); buttonPanel.add(cancelButton); plr.add(buttonPanel, BorderLayout.SOUTH); d.setContentPane(plr); d.pack(); d.setVisible(true); }
public void actionPerformed(ActionEvent e) { final JDialog d = new JDialog(ArchitectFrame.getMainInstance(), "New PL Repository Connection"); JPanel plr = new JPanel(new BorderLayout(12,12)); plr.setBorder(BorderFactory.createEmptyBorder(12,12,12,12)); final DBCSPanel dbcsPanel = new DBCSPanel(); plr.add(dbcsPanel, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JButton okButton = new JButton("Ok"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { dbcs = new DBConnectionSpec(); dbcsPanel.applyChanges(dbcs); historyBox.addItem(ASUtils.lvb(dbcs.getDisplayName(), dbcs)); d.setVisible(false); } }); buttonPanel.add(okButton); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { dbcsPanel.discardChanges(); d.setVisible(false); } }); buttonPanel.add(cancelButton); plr.add(buttonPanel, BorderLayout.SOUTH); d.setContentPane(plr); d.pack(); d.setVisible(true); }
1,108,716