List of usage examples for java.awt Container getHeight
public int getHeight()
From source file:edu.harvard.i2b2.analysis.ui.ExplorerC.java
public boolean PerformVisualizationQuery(final java.awt.Container oAwtContainer, final int[] patientIds, final boolean bDisplayAll) { bStillPerformingVisualizationQuery = true; bNoError = true;// www .j a v a 2 s . c om p = new WaitPanel((int) (oAwtContainer.getWidth() * 0.40), (int) (oAwtContainer.getHeight() * 0.40), patientIds.length); oAwtContainer.add(p); p.setBounds(0, 0, p.getParent().getWidth(), p.getParent().getHeight()); p.init((int) (p.getParent().getWidth() * 0.40), (int) (p.getParent().getHeight() * 0.40)); p.go(); p.setVisible(true); removelldFile(); visualizationQueryThread = new Thread() { public void run() { log.info("before getResultSetAsi2b2XML: " + new Date()); try { ConceptTableModel i2b2Model = (ConceptTableModel) table.getModel(); String xmlContent = i2b2Model.getContentXml(); oConnection = DBLib.openJDBCConnection(System.getProperty("datamartURL"), System.getProperty("datamartDriver"), System.getProperty("datamartUser"), System.getProperty("datamartPassword")); Properties properties = new Properties(); String writeFileStr = ""; String filename = "crcnavigator.properties"; try { properties.load(new FileInputStream(filename)); writeFileStr = properties.getProperty("writeTimelineFile"); log.debug("Properties writeFile: =" + writeFileStr); } catch (IOException e) { log.error(e.getMessage()); } boolean writeFile = true; if ((writeFileStr != null) && (writeFileStr.equalsIgnoreCase("no"))) { writeFile = false; } String result = DBLib.getResultSetFromI2B2Xml(xmlContent, patientIds, bDisplayAll, oConnection, writeFile, bDisplayDemographics); DBLib.closeConnection(oConnection); if (result != null) { if (result.equalsIgnoreCase("memory error")) { JOptionPane.showMessageDialog(oAwtContainer, "Running out of memory while loading " + patientIds.length + " patients." + "\nPlease try it again with a smaller number of patients."); bNoError = false; } else { PerformMiniVisualization(oAwtContainer, result, writeFile); } } p.stop(); p.setVisible(false); if (result.equalsIgnoreCase("memory error")) { oTheParent.getDisplay().syncExec(new Runnable() { public void run() { tabFolder.setSelection(0); } }); } } catch (Exception e) { log.error(e.getMessage()); bNoError = false; } log.info("after getResultSetAsi2b2XML: " + new Date()); } }; try { visualizationQueryThread.start(); } catch (Exception e) { log.error(e.getMessage()); } return bNoError; }
From source file:edu.harvard.i2b2.analysis.ui.ExplorerC.java
public boolean PerformVisualizationQuery(final java.awt.Container oAwtContainer, final int minPatient, final int maxPatient, final boolean bDisplayAll) { bStillPerformingVisualizationQuery = true; bNoError = true;//w ww . jav a 2s .c o m p = new WaitPanel((int) (oAwtContainer.getWidth() * 0.40), (int) (oAwtContainer.getHeight() * 0.40), (maxPatient - minPatient)); oAwtContainer.add(p); p.setBounds(0, 0, p.getParent().getWidth(), p.getParent().getHeight()); p.init((int) (p.getParent().getWidth() * 0.40), (int) (p.getParent().getHeight() * 0.40)); p.go(); p.setVisible(true); removelldFile(); visualizationQueryThread = new Thread() { public void run() { log.info("before getResultSetAsi2b2XML: " + new Date()); try { ConceptTableModel i2b2Model = (ConceptTableModel) table.getModel(); String xmlContent = i2b2Model.getContentXml(); oConnection = DBLib.openJDBCConnection(System.getProperty("datamartURL"), System.getProperty("datamartDriver"), System.getProperty("datamartUser"), System.getProperty("datamartPassword")); Properties properties = new Properties(); String writeFileStr = ""; String filename = "crcnavigator.properties"; try { properties.load(new FileInputStream(filename)); writeFileStr = properties.getProperty("writeTimelineFile"); log.debug("Properties writeFile: =" + writeFileStr); } catch (IOException e) { log.error(e.getMessage()); } boolean writeFile = false; if ((writeFileStr != null) && (writeFileStr.equalsIgnoreCase("yes"))) { writeFile = true; } String result = DBLib.getResultSetFromI2B2Xml(xmlContent, minPatient, maxPatient, bDisplayAll, oConnection, writeFile, bDisplayDemographics); DBLib.closeConnection(oConnection); if (result != null) { if (result.equalsIgnoreCase("memory error")) { JOptionPane.showMessageDialog(oAwtContainer, "Running out of memory while loading " + (maxPatient - minPatient) + " patients." + "\nPlease try it again with a smaller number of patients."); bNoError = false; } else { PerformMiniVisualization(oAwtContainer, result, writeFile); } } p.stop(); p.setVisible(false); if (result.equalsIgnoreCase("memory error")) { oTheParent.getDisplay().syncExec(new Runnable() { public void run() { tabFolder.setSelection(0); } }); } } catch (Exception e) { p.stop(); p.setVisible(false); oTheParent.getDisplay().syncExec(new Runnable() { public void run() { tabFolder.setSelection(0); } }); log.error(e.getMessage()); bNoError = false; } log.info("after getResultSetAsi2b2XML: " + new Date()); } }; try { visualizationQueryThread.start(); } catch (Exception e) { p.stop(); p.setVisible(false); oTheParent.getDisplay().syncExec(new Runnable() { public void run() { tabFolder.setSelection(0); } }); log.error(e.getMessage()); return false; } return bNoError; }
From source file:edu.harvard.i2b2.analysis.ui.ExplorerC.java
public boolean PerformVisualizationQuery(final java.awt.Container oAwtContainer, final String patientRefId, final int minPatient, final int maxPatient, final boolean bDisplayAll) { bStillPerformingVisualizationQuery = true; bNoError = true;//from ww w .j av a 2s.c o m p = new WaitPanel((int) (oAwtContainer.getWidth() * 0.40), (int) (oAwtContainer.getHeight() * 0.40), (maxPatient - minPatient)); oAwtContainer.add(p); p.setBounds(0, 0, p.getParent().getWidth(), p.getParent().getHeight()); p.init((int) (p.getParent().getWidth() * 0.40), (int) (p.getParent().getHeight() * 0.40)); p.go(); p.setVisible(true); removelldFile(); final ExplorerC explorer = this; visualizationQueryThread = new Thread() { public void run() { log.info("before getResultSetAsi2b2XML: " + new Date()); try { ConceptTableModel i2b2Model = (ConceptTableModel) table.getModel(); i2b2Model.fillDataFromTable(rowData); Properties properties = new Properties(); String writeFileStr = ""; String filename = "i2b2workbench.properties"; try { properties.load(new FileInputStream(filename)); writeFileStr = properties.getProperty("writeTimelineFile"); log.debug("Properties writeFile: =" + writeFileStr); } catch (IOException e) { log.error(e.getMessage()); } boolean writeFile = false; if ((writeFileStr != null) && (writeFileStr.equalsIgnoreCase("yes"))) { writeFile = true; } ArrayList<TimelineRow> tlrows = i2b2Model.getTimelineRows(rowData); String result = CRCQueryClient.getlldString(tlrows, patientRefId, minPatient, minPatient + maxPatient, bDisplayAll, writeFile, bDisplayDemographics, explorer); if (result != null) { if (result.equalsIgnoreCase("memory error")) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(oAwtContainer, "Running out of memory while loading " + (maxPatient - minPatient) + " patients." + "\nPlease try it again with a smaller number of patients."); } }); bNoError = false; } else if (result.equalsIgnoreCase("error")) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(oAwtContainer, "Response delivered from the remote server could not be " + "understood, you may wish to retry your last action"); } }); bNoError = false; } else { PerformMiniVisualization(oAwtContainer, result, writeFile); } } else { // JOptionPane.showMessageDialog(oAwtContainer, // "Response delivered from the remote server could not be understood, you may wish to retry your last action" // ); bNoError = false; } p.stop(); p.setVisible(false); if (result == null || result.equalsIgnoreCase("memory error") || result.equalsIgnoreCase("error")) { oTheParent.getDisplay().syncExec(new Runnable() { public void run() { tabFolder.setSelection(0); } }); } } catch (Exception e) { log.error(e.getMessage()); bNoError = false; } log.info("after getResultSetAsi2b2XML: " + new Date()); } }; try { visualizationQueryThread.start(); } catch (Exception e) { log.error(e.getMessage()); } return bNoError; }
From source file:edu.harvard.i2b2.patientMapping.ui.MainComposite.java
public boolean PerformVisualizationQuery(final java.awt.Container oAwtContainer, final String patientRefId, final int minPatient, final int maxPatient, final boolean bDisplayAll) { bStillPerformingVisualizationQuery = true; bNoError = true;//from w w w .j a va2s . c o m p = new WaitPanel((int) (oAwtContainer.getWidth() * 0.40), (int) (oAwtContainer.getHeight() * 0.40), (maxPatient - minPatient)); oAwtContainer.add(p); p.setBounds(0, 0, p.getParent().getWidth(), p.getParent().getHeight()); p.init((int) (p.getParent().getWidth() * 0.40), (int) (p.getParent().getHeight() * 0.40)); p.go(); p.setVisible(true); removelldFile(); final MainComposite explorer = this; visualizationQueryThread = new Thread() { public void run() { log.info("before getResultSetAsi2b2XML: " + new Date()); try { ConceptTableModel i2b2Model = (ConceptTableModel) table.getModel(); i2b2Model.fillDataFromTable(rowData); Properties properties = new Properties(); String writeFileStr = ""; String filename = "i2b2workbench.properties"; try { properties.load(new FileInputStream(filename)); writeFileStr = properties.getProperty("writeTimelineFile"); log.debug("Properties writeFile: =" + writeFileStr); } catch (IOException e) { log.error(e.getMessage()); } boolean writeFile = false; if ((writeFileStr != null) && (writeFileStr.equalsIgnoreCase("yes"))) { writeFile = true; } ArrayList<TimelineRow> tlrows = i2b2Model.getTimelineRows(rowData); String result = PatientMappingQueryClient.getlldString(tlrows, patientRefId, minPatient, minPatient + maxPatient, bDisplayAll, writeFile, bDisplayDemographics, explorer); if (result != null) { if (result.equalsIgnoreCase("memory error")) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(oAwtContainer, "Running out of memory while loading " + (maxPatient - minPatient) + " patients." + "\nPlease try it again with a smaller number of patients."); } }); bNoError = false; } else if (result.equalsIgnoreCase("error")) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(oAwtContainer, "Response delivered from the remote server could not be " + "understood, you may wish to retry your last action"); } }); bNoError = false; } else { PerformMiniVisualization(oAwtContainer, result, writeFile); } } else { // JOptionPane.showMessageDialog(oAwtContainer, // "Response delivered from the remote server could not be understood, you may wish to retry your last action" // ); bNoError = false; } p.stop(); p.setVisible(false); if (result == null || result.equalsIgnoreCase("memory error") || result.equalsIgnoreCase("error")) { oTheParent.getDisplay().syncExec(new Runnable() { public void run() { tabFolder.setSelection(0); } }); } } catch (Exception e) { log.error(e.getMessage()); bNoError = false; e.printStackTrace(); } log.info("after getResultSetAsi2b2XML: " + new Date()); } }; try { visualizationQueryThread.start(); } catch (Exception e) { log.error(e.getMessage()); } return bNoError; }
From source file:edu.harvard.i2b2.explorer.ui.MainComposite.java
public boolean PerformVisualizationQuery(final java.awt.Container oAwtContainer, final String patientRefId, final int minPatient, final int maxPatient, final boolean bDisplayAll) { bStillPerformingVisualizationQuery = true; bNoError = true;//ww w.j av a 2s.c o m p = new WaitPanel((int) (oAwtContainer.getWidth() * 0.40), (int) (oAwtContainer.getHeight() * 0.40), (maxPatient - minPatient)); oAwtContainer.add(p); p.setBounds(0, 0, p.getParent().getWidth(), p.getParent().getHeight()); p.init((int) (p.getParent().getWidth() * 0.40), (int) (p.getParent().getHeight() * 0.40)); p.go(); p.setVisible(true); removelldFile(); final MainComposite explorer = this; visualizationQueryThread = new Thread() { public void run() { log.info("before getResultSetAsi2b2XML: " + new Date()); try { ConceptTableModel i2b2Model = (ConceptTableModel) table.getModel(); i2b2Model.fillDataFromTable(rowData); Properties properties = new Properties(); String writeFileStr = ""; String filename = "i2b2workbench.properties"; try { properties.load(new FileInputStream(filename)); writeFileStr = properties.getProperty("writeTimelineFile"); log.debug("Properties writeFile: =" + writeFileStr); } catch (IOException e) { log.error(e.getMessage()); } boolean writeFile = false; if ((writeFileStr != null) && (writeFileStr.equalsIgnoreCase("yes"))) { writeFile = true; } ArrayList<TimelineRow> tlrows = i2b2Model.getTimelineRows(rowData); String result = PDOQueryClient.getlldString(tlrows, patientRefId, minPatient, minPatient + maxPatient, bDisplayAll, writeFile, bDisplayDemographics, explorer, filter); if (result != null) { if (result.equalsIgnoreCase("memory error")) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(oAwtContainer, "Running out of memory while loading " + (maxPatient - minPatient) + " patients." + "\nPlease try it again with a smaller number of patients."); } }); bNoError = false; } else if (result.equalsIgnoreCase("error")) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(oAwtContainer, "Response delivered from the remote server could not be " + "understood, you may wish to retry your last action"); } }); bNoError = false; } else { PerformMiniVisualization(oAwtContainer, result, writeFile); } } else { // JOptionPane.showMessageDialog(oAwtContainer, // "Response delivered from the remote server could not be understood, you may wish to retry your last action" // ); bNoError = false; } p.stop(); p.setVisible(false); if (result == null || result.equalsIgnoreCase("memory error") || result.equalsIgnoreCase("error")) { oTheParent.getDisplay().syncExec(new Runnable() { public void run() { tabFolder.setSelection(0); } }); } } catch (Exception e) { log.error(e.getMessage()); bNoError = false; e.printStackTrace(); } log.info("after getResultSetAsi2b2XML: " + new Date()); } }; try { visualizationQueryThread.start(); } catch (Exception e) { log.error(e.getMessage()); } return bNoError; }
From source file:org.jcurl.demo.tactics.JCurlShotPlanner.java
private static void renderPng(final Container src, final File dst) throws IOException { final BufferedImage img = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_ARGB); final Graphics g = img.getGraphics(); try {//from w ww . j a v a 2 s. c o m // SwingUtilities.paintComponent(g, src, src.getBounds(), null); src.paintAll(g); } finally { g.dispose(); } ImageIO.write(img, "png", dst); }
From source file:phex.gui.common.FileDialogHandler.java
/** * @param chooser//ww w . j a va 2s . c om */ private static void displayNotificationPopup(JComponent chooser, String title, String shortMessage) { final SlideInWindow window = new SlideInWindow(title, 0); window.setShortMessage(shortMessage, true); window.setHideBtnShown(false); window.initializeComponent(); window.setSize(200, 150); chooser.addAncestorListener(new AncestorListener() { public void ancestorAdded(AncestorEvent event) { window.setVisible(true); } public void ancestorRemoved(AncestorEvent event) { window.setVisible(false); } public void ancestorMoved(AncestorEvent event) { Container ancestor = event.getAncestor(); Point loc = ancestor.getLocationOnScreen(); int xPos = loc.x + ancestor.getWidth() + 5; int yPos = loc.y + ancestor.getHeight() - window.getHeight(); window.setLocation(xPos, yPos); } }); }