rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
creatingThumbIcon = getIcon( "creating_thumb.png" );
void createUI() { photoTransferHandler = new PhotoCollectionTransferHandler( this ); setTransferHandler( photoTransferHandler ); setAutoscrolls( true ); addMouseListener( this ); addMouseMotionListener( this ); // Create the popup menu popup = new JPopupMenu(); ImageIcon propsIcon = getIcon( "view_properties.png" ); editSelectionPropsAction = new EditSelectionPropsAction( this, "Properties...", propsIcon, "Edit properties of the selected photos", KeyEvent.VK_P ); JMenuItem propsItem = new JMenuItem( editSelectionPropsAction ); ImageIcon showIcon = getIcon( "show_new_window.png" ); showSelectedPhotoAction = new ShowSelectedPhotoAction( this, "Show image", showIcon, "Show the selected phot(s)", KeyEvent.VK_S ); JMenuItem showItem = new JMenuItem( showSelectedPhotoAction ); ImageIcon rotateCWIcon = getIcon( "rotate_cw.png" ); rotateCWAction = new RotateSelectedPhotoAction( this, 90, "Rotate 90 deg CW", rotateCWIcon, "Rotates the selected photo clockwise", KeyEvent.VK_R ); JMenuItem rotateCW = new JMenuItem( rotateCWAction ); ImageIcon rotateCCWIcon = getIcon( "rotate_ccw.png" ); rotateCCWAction = new RotateSelectedPhotoAction( this, 270, "Rotate 90 deg CCW", rotateCCWIcon, "Rotates the selected photo counterclockwise", KeyEvent.VK_W ); JMenuItem rotateCCW = new JMenuItem( rotateCCWAction ); ImageIcon rotate180Icon = getIcon( "rotate_180.png" ); rotate180degAction = new RotateSelectedPhotoAction( this, 180, "Rotate 180 deg", rotate180Icon, "Rotates the selected photo 180 degrees", KeyEvent.VK_R ); JMenuItem rotate180deg = new JMenuItem( rotate180degAction ); JMenuItem addToFolder = new JMenuItem( "Add to folder..." ); addToFolder.addActionListener( this ); addToFolder.setActionCommand( PHOTO_ADD_TO_FOLDER_CMD ); ImageIcon exportIcon = getIcon( "filesave.png" ); exportSelectedAction = new ExportSelectedAction( this, "Export selected...", exportIcon, "Export the selected photos to from archive database to image files", KeyEvent.VK_X ); JMenuItem exportSelected = new JMenuItem( exportSelectedAction ); // Create the Quality submenu JMenu qualityMenu = new JMenu( "Quality" ); String qualityStrings[] = { "Unevaluated", "Top", "Good", "OK", "Poor", "Unusable" }; String qualityIconnames[] = { "quality_unevaluated.png", "quality_top.png", "quality_good.png", "quality_ok.png", "quality_poor.png", "quality_unusable.png" }; qualityIcons = new ImageIcon[qualityStrings.length]; for ( int n = 0; n < qualityStrings.length; n++ ) { qualityIcons[n] = getIcon( qualityIconnames[n] ); AbstractAction qualityAction = new SetPhotoQualityAction( this, n, qualityStrings[n], qualityIcons[n], "Set quality of selected phots to \"" + qualityStrings[n] + "\"", null ); JMenuItem qualityMenuItem = new JMenuItem( qualityAction ); qualityMenu.add( qualityMenuItem ); } popup.add( showItem ); popup.add( propsItem ); popup.add( rotateCW ); popup.add( rotateCCW ); popup.add( rotate180deg ); popup.add( qualityMenu ); popup.add( addToFolder ); popup.add( exportSelected ); MouseListener popupListener = new PopupListener(); addMouseListener( popupListener ); ImageIcon selectNextIcon = getIcon( "next.png" ); selectNextAction = new ChangeSelectionAction( this, ChangeSelectionAction.MOVE_FWD, "Next photo", selectNextIcon, "Move to next photo", KeyEvent.VK_N, KeyStroke.getKeyStroke( KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK ) ); ImageIcon selectPrevIcon = getIcon( "previous.png" ); selectPrevAction = new ChangeSelectionAction( this, ChangeSelectionAction.MOVE_BACK, "Previous photo", selectPrevIcon, "Move to previous photo", KeyEvent.VK_P, KeyStroke.getKeyStroke( KeyEvent.VK_P, KeyEvent.CTRL_DOWN_MASK ) ); }
thumbnail = Thumbnail.getDefaultThumbnail();
thumbnail = photo.getOldThumbnail(); if ( thumbnail != null ) { useOldThumbnail = true; } else { thumbnail = Thumbnail.getDefaultThumbnail(); }
private void paintThumbnail( Graphics2D g2, PhotoInfo photo, int startx, int starty, boolean isSelected ) { log.debug( "paintThumbnail entry " + photo.getUid() ); long startTime = System.currentTimeMillis(); long thumbReadyTime = 0; long thumbDrawnTime = 0; long endTime = 0; // Current position in which attributes can be drawn int ypos = starty + rowHeight/2; // Create a transaction which will be used for persisten object operations // during painting (to avoid creating several short-livin transactions) ODMGXAWrapper txw = new ODMGXAWrapper(); Thumbnail thumbnail = null; log.debug( "finding thumb" ); boolean hasThumbnail = photo.hasThumbnail(); log.debug( "asked if has thumb" ); if ( hasThumbnail ) { log.debug( "Photo " + photo.getUid() + " has thumbnail" ); thumbnail = photo.getThumbnail(); log.debug( "got thumbnail" ); } else { thumbnail = Thumbnail.getDefaultThumbnail(); if ( !thumbCreatorThread.isBusy() ) { log.debug( "Create thumbnail for " + photo.getUid() ); thumbCreatorThread.createThumbnail( photo ); log.debug( "Thumbnail request submitted" ); } } thumbReadyTime = System.currentTimeMillis(); log.debug( "starting to draw" ); // Find the position for the thumbnail BufferedImage img = thumbnail.getImage(); if ( img.getWidth() > columnWidth || img.getHeight() > rowHeight ) { img = img.getSubimage( 0, 0, Math.min( img.getWidth(), columnWidth ), Math.min( img.getHeight(), rowHeight ) ); } int x = startx + (columnWidth - img.getWidth())/(int)2; int y = starty + (rowHeight - img.getHeight())/(int)2; log.debug( "drawing thumbnail" ); g2.drawImage( img, new AffineTransform( 1f, 0f, 0f, 1f, x, y ), null ); log.debug( "Drawn, drawing decorations" ); if ( isSelected ) { Stroke prevStroke = g2.getStroke(); Color prevColor = g2.getColor(); g2.setStroke( new BasicStroke( 3.0f) ); g2.setColor( Color.BLUE ); g2.drawRect( x, y, img.getWidth(), img.getHeight() ); g2.setColor( prevColor ); g2.setStroke( prevStroke ); } thumbDrawnTime = System.currentTimeMillis(); // Increase ypos so that attributes are drawn under the image ypos += ((int)img.getHeight())/2 + 4; // Draw the attributes // Draw the qualoity icon to the upper left corner of the thumbnail int quality = photo.getQuality(); if ( showQuality && quality != PhotoInfo.QUALITY_UNDEFINED ) { ImageIcon qualityIcon = qualityIcons[quality]; int qx = startx + (columnWidth-img.getWidth()-qualityIcon.getIconWidth())/(int)2; int qy = starty + (rowHeight-img.getHeight()-qualityIcon.getIconHeight())/(int)2; qualityIcon.paintIcon( this, g2, qx, qy ); } Color prevBkg = g2.getBackground(); if ( isSelected ) { g2.setBackground( Color.BLUE ); } else { g2.setBackground( this.getBackground() ); } Font attrFont = new Font( "Arial", Font.PLAIN, 10 ); FontRenderContext frc = g2.getFontRenderContext(); if ( showDate && photo.getShootTime() != null ) { FuzzyDate fd = new FuzzyDate( photo.getShootTime(), photo.getTimeAccuracy() ); String dateStr = fd.format(); TextLayout txt = new TextLayout( dateStr, attrFont, frc ); // Calculate the position for the text Rectangle2D bounds = txt.getBounds(); int xpos = startx + ((int)(columnWidth - bounds.getWidth()))/2 - (int)bounds.getMinX(); g2.clearRect( xpos-2, ypos-2, (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 ); txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) ); ypos += bounds.getHeight() + 4; } String shootPlace = photo.getShootingPlace(); if ( showPlace && shootPlace != null && shootPlace.length() > 0 ) { TextLayout txt = new TextLayout( photo.getShootingPlace(), attrFont, frc ); // Calculate the position for the text Rectangle2D bounds = txt.getBounds(); int xpos = startx + ((int)(columnWidth-bounds.getWidth()))/2 - (int)bounds.getMinX(); g2.clearRect( xpos-2, ypos-2, (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 ); txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) ); ypos += bounds.getHeight() + 4; } g2.setBackground( prevBkg ); txw.commit(); endTime = System.currentTimeMillis(); log.debug( "paintThumbnail: exit " + photo.getUid() ); log.debug( "Thumb fetch " + (thumbReadyTime - startTime ) + " ms" ); log.debug( "Thumb draw " + ( thumbDrawnTime - thumbReadyTime ) + " ms" ); log.debug( "Deacoration draw " + (endTime - thumbDrawnTime ) + " ms" ); log.debug( "Total " + (endTime - startTime ) + " ms" ); }
if ( useOldThumbnail ) { creatingThumbIcon.paintIcon( this, g2, startx + (columnWidth - creatingThumbIcon.getIconWidth())/(int)2, starty + ( rowHeight - creatingThumbIcon.getIconHeight())/(int)2 ); }
private void paintThumbnail( Graphics2D g2, PhotoInfo photo, int startx, int starty, boolean isSelected ) { log.debug( "paintThumbnail entry " + photo.getUid() ); long startTime = System.currentTimeMillis(); long thumbReadyTime = 0; long thumbDrawnTime = 0; long endTime = 0; // Current position in which attributes can be drawn int ypos = starty + rowHeight/2; // Create a transaction which will be used for persisten object operations // during painting (to avoid creating several short-livin transactions) ODMGXAWrapper txw = new ODMGXAWrapper(); Thumbnail thumbnail = null; log.debug( "finding thumb" ); boolean hasThumbnail = photo.hasThumbnail(); log.debug( "asked if has thumb" ); if ( hasThumbnail ) { log.debug( "Photo " + photo.getUid() + " has thumbnail" ); thumbnail = photo.getThumbnail(); log.debug( "got thumbnail" ); } else { thumbnail = Thumbnail.getDefaultThumbnail(); if ( !thumbCreatorThread.isBusy() ) { log.debug( "Create thumbnail for " + photo.getUid() ); thumbCreatorThread.createThumbnail( photo ); log.debug( "Thumbnail request submitted" ); } } thumbReadyTime = System.currentTimeMillis(); log.debug( "starting to draw" ); // Find the position for the thumbnail BufferedImage img = thumbnail.getImage(); if ( img.getWidth() > columnWidth || img.getHeight() > rowHeight ) { img = img.getSubimage( 0, 0, Math.min( img.getWidth(), columnWidth ), Math.min( img.getHeight(), rowHeight ) ); } int x = startx + (columnWidth - img.getWidth())/(int)2; int y = starty + (rowHeight - img.getHeight())/(int)2; log.debug( "drawing thumbnail" ); g2.drawImage( img, new AffineTransform( 1f, 0f, 0f, 1f, x, y ), null ); log.debug( "Drawn, drawing decorations" ); if ( isSelected ) { Stroke prevStroke = g2.getStroke(); Color prevColor = g2.getColor(); g2.setStroke( new BasicStroke( 3.0f) ); g2.setColor( Color.BLUE ); g2.drawRect( x, y, img.getWidth(), img.getHeight() ); g2.setColor( prevColor ); g2.setStroke( prevStroke ); } thumbDrawnTime = System.currentTimeMillis(); // Increase ypos so that attributes are drawn under the image ypos += ((int)img.getHeight())/2 + 4; // Draw the attributes // Draw the qualoity icon to the upper left corner of the thumbnail int quality = photo.getQuality(); if ( showQuality && quality != PhotoInfo.QUALITY_UNDEFINED ) { ImageIcon qualityIcon = qualityIcons[quality]; int qx = startx + (columnWidth-img.getWidth()-qualityIcon.getIconWidth())/(int)2; int qy = starty + (rowHeight-img.getHeight()-qualityIcon.getIconHeight())/(int)2; qualityIcon.paintIcon( this, g2, qx, qy ); } Color prevBkg = g2.getBackground(); if ( isSelected ) { g2.setBackground( Color.BLUE ); } else { g2.setBackground( this.getBackground() ); } Font attrFont = new Font( "Arial", Font.PLAIN, 10 ); FontRenderContext frc = g2.getFontRenderContext(); if ( showDate && photo.getShootTime() != null ) { FuzzyDate fd = new FuzzyDate( photo.getShootTime(), photo.getTimeAccuracy() ); String dateStr = fd.format(); TextLayout txt = new TextLayout( dateStr, attrFont, frc ); // Calculate the position for the text Rectangle2D bounds = txt.getBounds(); int xpos = startx + ((int)(columnWidth - bounds.getWidth()))/2 - (int)bounds.getMinX(); g2.clearRect( xpos-2, ypos-2, (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 ); txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) ); ypos += bounds.getHeight() + 4; } String shootPlace = photo.getShootingPlace(); if ( showPlace && shootPlace != null && shootPlace.length() > 0 ) { TextLayout txt = new TextLayout( photo.getShootingPlace(), attrFont, frc ); // Calculate the position for the text Rectangle2D bounds = txt.getBounds(); int xpos = startx + ((int)(columnWidth-bounds.getWidth()))/2 - (int)bounds.getMinX(); g2.clearRect( xpos-2, ypos-2, (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 ); txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) ); ypos += bounds.getHeight() + 4; } g2.setBackground( prevBkg ); txw.commit(); endTime = System.currentTimeMillis(); log.debug( "paintThumbnail: exit " + photo.getUid() ); log.debug( "Thumb fetch " + (thumbReadyTime - startTime ) + " ms" ); log.debug( "Thumb draw " + ( thumbDrawnTime - thumbReadyTime ) + " ms" ); log.debug( "Deacoration draw " + (endTime - thumbDrawnTime ) + " ms" ); log.debug( "Total " + (endTime - startTime ) + " ms" ); }
while ( !parentFolderNode.containsPhotos() && parentNode != topNode ) {
while ( !parentFolderNode.containsPhotos() && parentNode.getChildCount() == 0 && parentNode != topNode ) {
public void removeAllFromFolder( PhotoFolder f ) { addedToFolders.remove( f ); removedFromFolders.add( f ); DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) folderNodes.get( f ); FolderNode fn = (FolderNode) treeNode.getUserObject(); fn.removeAllPhotos(); // If this folder has no visible children remove it from the tree if ( treeNode.getChildCount() == 0 ) { DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) treeNode.getParent(); FolderNode parentFolderNode = (FolderNode) parentNode.getUserObject(); // Remove the folder also from controller internal data structures folderNodes.remove( f ); treeModel.removeNodeFromParent( treeNode ); /* Check whether the parent node (and its parets...) contain any photos * from the model. If not we can remove them as well */ while ( !parentFolderNode.containsPhotos() && parentNode != topNode ) { treeNode = parentNode; fn = parentFolderNode; parentNode = (DefaultMutableTreeNode) treeNode.getParent(); parentFolderNode = (FolderNode) parentNode.getUserObject(); folderNodes.remove( fn.getFolder()); treeModel.removeNodeFromParent( treeNode ); } } else { // This folder has children that have photos in the model // Don't remove the folder but notify model that representation // should be changed treeModel.nodeChanged(treeNode); } }
if (rootURL == null) {
URL url = rootURL; if (url == null) {
protected URL createRelativeURL(URL rootURL, String relativeURI) throws MalformedURLException { if (rootURL == null) { File file = new File(System.getProperty("user.dir")); rootURL = file.toURL(); } String urlText = rootURL.toString() + relativeURI; if ( log.isDebugEnabled() ) { log.debug("Attempting to open url: " + urlText); } return new URL(urlText); }
rootURL = file.toURL();
url = file.toURL();
protected URL createRelativeURL(URL rootURL, String relativeURI) throws MalformedURLException { if (rootURL == null) { File file = new File(System.getProperty("user.dir")); rootURL = file.toURL(); } String urlText = rootURL.toString() + relativeURI; if ( log.isDebugEnabled() ) { log.debug("Attempting to open url: " + urlText); } return new URL(urlText); }
String urlText = rootURL.toString() + relativeURI;
String urlText = url.toString() + relativeURI;
protected URL createRelativeURL(URL rootURL, String relativeURI) throws MalformedURLException { if (rootURL == null) { File file = new File(System.getProperty("user.dir")); rootURL = file.toURL(); } String urlText = rootURL.toString() + relativeURI; if ( log.isDebugEnabled() ) { log.debug("Attempting to open url: " + urlText); } return new URL(urlText); }
ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader != null) { return (classLoader);
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); if (contextClassLoader != null) { return (contextClassLoader);
public ClassLoader getClassLoader() { if (this.classLoader != null) { return (this.classLoader); } if (this.useContextClassLoader) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader != null) { return (classLoader); } } return (this.getClass().getClassLoader()); }
JellyContext parent = getParent(); if (parent != null) { value = parent.getVariable( name );
JellyContext parentContext = getParent(); if (parentContext != null) { value = parentContext.getVariable( name );
public Object getVariable(String name) { Object value = variables.get(name); boolean definedHere = value != null || variables.containsKey(name); if (definedHere) return value; if ( value == null && isInherit() ) { JellyContext parent = getParent(); if (parent != null) { value = parent.getVariable( name ); } } // ### this is a hack - remove this when we have support for pluggable Scopes if ( value == null ) { value = getSystemProperty(name); } return value; }
if ( getInherit() ) { return getParent().findVariable( name );
Object value = variables.get(name); if ( value == null && getInherit() ) { value = getParent().findVariable( name );
public Object getVariable(String name) { if ( getInherit() ) { return getParent().findVariable( name ); } return variables.get(name); }
return variables.get(name);
return value;
public Object getVariable(String name) { if ( getInherit() ) { return getParent().findVariable( name ); } return variables.get(name); }
if ( getExport() ) {
if ( getExport() && getParent() != null ) {
public void setScopedVariable(String name, Object value) { if ( getExport() ) { getParent().setScopedVariable( name, value ); } }
} else { setVariable( name, value );
public void setScopedVariable(String name, Object value) { if ( getExport() ) { getParent().setScopedVariable( name, value ); } }
connections = plini.getConnections();
connections = plini.getConnections(); for (int i = listenerList.size() - 1; i >= 0; i--) { listenerList.get(i).contentsChanged( new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, e.getListIndex(), e.getListIndex())); }
public void databaseAdded(DatabaseListChangeEvent e) { connections = plini.getConnections(); for (int i = listenerList.size() -1 ; i>=0; i--) { listenerList.get(i).contentsChanged(new ListDataEvent(this,ListDataEvent.INTERVAL_ADDED,e.getListIndex(),e.getListIndex())); } }
for (int i = listenerList.size() -1 ; i>=0; i--) { listenerList.get(i).contentsChanged(new ListDataEvent(this,ListDataEvent.INTERVAL_ADDED,e.getListIndex(),e.getListIndex())); } }
}
public void databaseAdded(DatabaseListChangeEvent e) { connections = plini.getConnections(); for (int i = listenerList.size() -1 ; i>=0; i--) { listenerList.get(i).contentsChanged(new ListDataEvent(this,ListDataEvent.INTERVAL_ADDED,e.getListIndex(),e.getListIndex())); } }
public TDTPanel(Vector chromosomes, int t) {
public TDTPanel(PedFile pf, int t) {
public TDTPanel(Vector chromosomes, int t) { type = t; if (type == 1){ result = TDT.calcTrioTDT(chromosomes); }else{ result = TDT.calcCCTDT(chromosomes); } tableColumnNames.add("#"); tableColumnNames.add("Name"); if (type == 1){ tableColumnNames.add("Overtransmitted"); tableColumnNames.add("T:U"); }else{ tableColumnNames.add("Major Alleles"); tableColumnNames.add("Case, Control Ratios"); } tableColumnNames.add("Chi Squared"); tableColumnNames.add("p value"); refreshTable(); }
result = TDT.calcTrioTDT(chromosomes);
result = TDT.calcTrioTDT(pf);
public TDTPanel(Vector chromosomes, int t) { type = t; if (type == 1){ result = TDT.calcTrioTDT(chromosomes); }else{ result = TDT.calcCCTDT(chromosomes); } tableColumnNames.add("#"); tableColumnNames.add("Name"); if (type == 1){ tableColumnNames.add("Overtransmitted"); tableColumnNames.add("T:U"); }else{ tableColumnNames.add("Major Alleles"); tableColumnNames.add("Case, Control Ratios"); } tableColumnNames.add("Chi Squared"); tableColumnNames.add("p value"); refreshTable(); }
result = TDT.calcCCTDT(chromosomes);
result = TDT.calcCCTDT(pf);
public TDTPanel(Vector chromosomes, int t) { type = t; if (type == 1){ result = TDT.calcTrioTDT(chromosomes); }else{ result = TDT.calcCCTDT(chromosomes); } tableColumnNames.add("#"); tableColumnNames.add("Name"); if (type == 1){ tableColumnNames.add("Overtransmitted"); tableColumnNames.add("T:U"); }else{ tableColumnNames.add("Major Alleles"); tableColumnNames.add("Case, Control Ratios"); } tableColumnNames.add("Chi Squared"); tableColumnNames.add("p value"); refreshTable(); }
throw new MissingAttributeException("bean");
BeanSource tag = (BeanSource) findAncestorWithClass(BeanSource.class); if (tag != null) { bean = tag.getBean(); } if (bean == null) { throw new MissingAttributeException("bean"); }
public void doTag(XMLOutput output) throws Exception { Map attributes = getAttributes(); Object bean = attributes.remove( "object" ); if ( bean == null ) { throw new MissingAttributeException("bean"); } setBeanProperties(bean, attributes); }
updateViews( null );
public void setViews( Collection views ) { this.views = views; }
children.add(i,c);
if (c instanceof Relationship) { relations.add(i-children.size(),(Relationship)c); } else { children.add(i,c); }
public void add(PlayPenComponent c, int i) { children.add(i,c); c.addPlayPenComponentListener(playPenComponentEventPassthrough); c.addSelectionListener(getOwner()); c.revalidate(); }
return children.get(i);
if (i < children.size()){ return children.get(i); } else { return relations.get(i-children.size()); }
public PlayPenComponent getComponent(int i) { return children.get(i); }
for (Relationship ppc : relations) { if (ppc.contains(p)) { return (PlayPenComponent) ppc; } }
public PlayPenComponent getComponentAt(Point p) { for (PlayPenComponent ppc : children) { if (ppc.contains(p)) { return ppc; } } return null; }
return children.size();
return children.size()+relations.size();
public int getComponentCount() { return children.size(); }
PlayPenComponent c = children.get(j);
PlayPenComponent c; if (j < children.size()) { c= children.get(j); } else { c = relations.get(j-children.size()); }
public void remove(int j) { PlayPenComponent c = children.get(j); Rectangle r = c.getBounds(); c.removePlayPenComponentListener(playPenComponentEventPassthrough); c.removeSelectionListener(getOwner()); children.remove(j); getOwner().repaint(r); }
children.remove(j);
if (j < children.size()) { children.remove(j); } else { relations.remove(j-children.size()); }
public void remove(int j) { PlayPenComponent c = children.get(j); Rectangle r = c.getBounds(); c.removePlayPenComponentListener(playPenComponentEventPassthrough); c.removeSelectionListener(getOwner()); children.remove(j); getOwner().repaint(r); }
refreshPhotoChangeListeners();
public void photoCollectionChanged( PhotoCollectionChangeEvent e ) { revalidate(); repaint(); }
refreshPhotoChangeListeners();
public void setCollection(PhotoCollection v) { if ( photoCollection != null ) { photoCollection.removePhotoCollectionChangeListener( this ); } photoCollection = v; photoCollection.addPhotoCollectionChangeListener( this ); revalidate(); repaint(); }
CheckDataTableSorter sorter = new CheckDataTableSorter(tableModel);
sorter = new CheckDataTableSorter(tableModel);
public CheckDataPanel(HaploView hv){ this(hv.theData); this.hv = hv; setLayout(new BoxLayout(this,BoxLayout.Y_AXIS)); JPanel missingPanel = new JPanel(); JLabel countsLabel; 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); missingPanel.add(countsLabel); JButton missingButton = new JButton("Show Excluded Individuals"); JButton individualButton = new JButton("Individual Summary"); individualButton.setEnabled(true); JButton mendelButton = new JButton("Mendel Errors"); mendelButton.setEnabled(true); if (hv.theData.getPedFile().getAxedPeople().size() == 0){ missingButton.setEnabled(false); } missingButton.addActionListener(this); missingPanel.add(missingButton); individualButton.addActionListener(this); missingPanel.add(individualButton); mendelButton.addActionListener(this); missingPanel.add(mendelButton); missingPanel.setBorder(BorderFactory.createLineBorder(Color.black)); JPanel extraPanel = new JPanel(); extraPanel.add(missingPanel); CheckDataTableSorter sorter = new CheckDataTableSorter(tableModel); table = new JTable(sorter); sorter.setTableHeader(table.getTableHeader()); final CheckDataCellRenderer renderer = new CheckDataCellRenderer(); try{ table.setDefaultRenderer(Class.forName("java.lang.Double"), renderer); table.setDefaultRenderer(Class.forName("java.lang.Integer"), renderer); table.setDefaultRenderer(Class.forName("java.lang.Long"), renderer); table.setDefaultRenderer(Class.forName("java.lang.String"),renderer); }catch (Exception e){ } table.getColumnModel().getColumn(0).setPreferredWidth(30); table.getColumnModel().getColumn(0).setMinWidth(30); if (theData.infoKnown){ table.getColumnModel().getColumn(1).setMinWidth(100); table.getColumnModel().getColumn(2).setMinWidth(60); } JScrollPane tableScroller = new JScrollPane(table); //changed 600 to 800 and tableScroller.getPreferredSize().height to Integer.MAX_VALUE. tableScroller.setMaximumSize(new Dimension(800, Integer.MAX_VALUE)); add(extraPanel); add(tableScroller); if (theData.dupsToBeFlagged){ JOptionPane.showMessageDialog(hv, "Two or more SNPs have identical position. They have been flagged in yellow\n"+ "and the less completely genotyped duplicate has been deselected.", "Duplicate SNPs", JOptionPane.INFORMATION_MESSAGE); } if (theData.dupNames){ JOptionPane.showMessageDialog(hv, "Two or more SNPs have identical names. They have been renamed with\n"+ ".X extensions where X is an integer unique to each duplicate.", "Duplicate SNPs", JOptionPane.INFORMATION_MESSAGE); } }
for (int j = 0; j < table.getColumnCount(); j++){ sorter.setSortingStatus(j,TableSorter.NOT_SORTED); }
public void redoRatings(){ try{ Vector result = new CheckData(theData.getPedFile()).check(); for (int i = 0; i < table.getRowCount(); i++){ MarkerResult cur = (MarkerResult)result.get(i); //use this marker as long as it has a good (i.e. positive) rating and is not an "unused" dup (==2) int curRating = cur.getRating(); int dupStatus = Chromosome.getUnfilteredMarker(i).getDupStatus(); if ((curRating > 0 && dupStatus != 2) || theData.getPedFile().isWhiteListed(Chromosome.getUnfilteredMarker(i))){ table.setValueAt(new Boolean(true),i,STATUS_COL); }else{ table.setValueAt(new Boolean(false),i,STATUS_COL); } tableModel.setRating(i,curRating); } changed = true; }catch (Exception e){ e.printStackTrace(); } }
saveDprimeWriter.write((i+1) + "\t" + (j+1) + "\t" + filteredDPrimeTable[i][j] + "\n");
saveDprimeWriter.write((Chromosome.realIndex[i]+1) + "\t" + (Chromosome.realIndex[j]+1) + "\t" + filteredDPrimeTable[i][j] + "\n");
public void saveDprimeToText(File dumpDprimeFile) throws IOException{ FileWriter saveDprimeWriter = new FileWriter(dumpDprimeFile); if (infoKnown){ saveDprimeWriter.write("L1\tL2\tD'\tLOD\tr^2\tCIlow\tCIhi\tDist\n"); long dist; for (int i = 0; i < filteredDPrimeTable.length; i++){ for (int j = 0; j < filteredDPrimeTable[i].length; j++){ //many "slots" in table aren't filled in because it is a 1/2 matrix if (i < j){ if(filteredDPrimeTable[i][j] != null) { dist = (Chromosome.getFilteredMarker(j)).getPosition() - (Chromosome.getFilteredMarker(i)).getPosition(); saveDprimeWriter.write(Chromosome.getFilteredMarker(i).getName() + "\t" + Chromosome.getFilteredMarker(j).getName() + "\t" + filteredDPrimeTable[i][j].toString() + "\t" + dist + "\n"); } } } } }else{ saveDprimeWriter.write("L1\tL2\tD'\tLOD\tr^2\tCIlow\tCIhi\n"); for (int i = 0; i < filteredDPrimeTable.length; i++){ for (int j = 0; j < filteredDPrimeTable[i].length; j++){ //many "slots" in table aren't filled in because it is a 1/2 matrix if (i < j){ if(filteredDPrimeTable[i][j] != null) { saveDprimeWriter.write((i+1) + "\t" + (j+1) + "\t" + filteredDPrimeTable[i][j] + "\n"); } } } } } saveDprimeWriter.close(); }
saveHapsWriter.write(" " + (markerNums[j]+1));
saveHapsWriter.write(" " + (Chromosome.realIndex[markerNums[j]]+1));
public void saveHapsToText(Haplotype[][] finishedHaplos, double[] multidprime, File saveHapsFile) throws IOException{ if (finishedHaplos == null) return; NumberFormat nf = NumberFormat.getInstance(Locale.US); nf.setMinimumFractionDigits(3); nf.setMaximumFractionDigits(3); //open file for saving haps text FileWriter saveHapsWriter = new FileWriter(saveHapsFile); //go through each block and print haplos for (int i = 0; i < finishedHaplos.length; i++){ //write block header saveHapsWriter.write("BLOCK " + (i+1) + ". MARKERS:"); int[] markerNums = finishedHaplos[i][0].getMarkers(); boolean[] tags = finishedHaplos[i][0].getTags(); for (int j = 0; j < markerNums.length; j++){ saveHapsWriter.write(" " + (markerNums[j]+1)); if (tags[j]) saveHapsWriter.write("!"); } saveHapsWriter.write("\n"); //write haps and crossover percentages for (int j = 0; j < finishedHaplos[i].length; j++){ int[] theGeno = finishedHaplos[i][j].getGeno(); StringBuffer theHap = new StringBuffer(theGeno.length); for (int k = 0; k < theGeno.length; k++){ theHap.append(theGeno[k]); } saveHapsWriter.write(theHap.toString() + " (" + nf.format(finishedHaplos[i][j].getPercentage()) + ")"); if (i < finishedHaplos.length-1){ saveHapsWriter.write("\t|"); for (int crossCount = 0; crossCount < finishedHaplos[i+1].length; crossCount++){ if (crossCount != 0) saveHapsWriter.write("\t"); saveHapsWriter.write(nf.format(finishedHaplos[i][j].getCrossover(crossCount))); } saveHapsWriter.write("|"); } saveHapsWriter.write("\n"); } if (i < finishedHaplos.length - 1){ saveHapsWriter.write("Multiallelic Dprime: " + multidprime[i] + "\n"); }else{ saveHapsWriter.write("\n"); } } saveHapsWriter.close(); }
registerWizardDialogTag("wizardDialog", WizardDialogTag.class); registerWizardPageTag("wizardPage", WizardPageTag.class);
public JFaceTagLibrary() { // Viewer tags registerViewerTag("tableViewer", TableViewer.class); registerViewerTag("tableTreeViewer", TableTreeViewer.class); registerViewerTag("treeViewer", TreeViewer.class); registerViewerTag("checkboxTreeViewer", CheckboxTreeViewer.class); // Event tags registerTag("doubleClickListener", DoubleClickListenerTag.class); registerTag("selectionChangedListener", SelectionChangedListenerTag.class); // Window tags registerWindowTag("applicationWindow", ApplicationWindow.class); // ContributionManager tags registerMenuManager("menuManager", MenuManagerTag.class); // Action tags registerActionTag("action", ActionTag.class); // ContributionItem tags registerContributionItemTag("separator", Separator.class); // Wizard tags //registerWizardDialogTag("wizardDialog", WizardDialog.class); //registerWizardTag("wizard", Wizard.class); //registerWizardPageTag("wizardPage", WizardPage.class); // preference tags registerPreferenceDialogTag("preferenceDialog", PreferenceDialogTag.class); registerTag("preferencePage", PreferencePageTag.class); registerFieldEditorTag("booleanFieldEditor", BooleanFieldEditor.class); registerFieldEditorTag("colorFieldEditor", ColorFieldEditor.class); registerFieldEditorTag("directoryFieldEditor", DirectoryFieldEditor.class); registerFieldEditorTag("fileFieldEditor", FileFieldEditor.class); registerFieldEditorTag("fontFieldEditor", FontFieldEditor.class); registerFieldEditorTag("integerFieldEditor", IntegerFieldEditor.class); //registerFieldEditorTag("radioGroupFieldEditor", RadioGroupFieldEditor.class); //registerFieldEditorTag("stringButtonFieldEditor", StringButtonFieldEditor.class); registerFieldEditorTag("stringFieldEditor", StringFieldEditor.class); }
List answers = remoteManagerClient.readAnswer();
remoteManagerClient.readAnswer();
private void addUser(RemoteManagerClient remoteManagerClient, String username, String internalPassword) { remoteManagerClient.executeCommand("adduser " + username + " " + internalPassword); List answers = remoteManagerClient.readAnswer(); log.info("user created: " + username); }
throw new StartupException("failed to setup");
throw new StartupException("failed to setup",e);
private void setupForwardedMailInterceptor() throws StartupException { SMTPMailSink smtpMailSink = new SMTPMailSink(); smtpMailSink.setSmtpListenerPort(m_postageConfiguration.getTestserverPortSMTPForwarding()); smtpMailSink.setResults(m_results); try { smtpMailSink.initialize(); } catch (Exception e) { throw new StartupException("failed to setup"); } m_smtpMailSink = smtpMailSink; log.info("forwarded mail interceptor is set up."); }
boolean loginSuccess = remoteManagerClient.login();
remoteManagerClient.login();
private void setupInternalUserAccounts() throws StartupException { try { String host = m_postageConfiguration.getTestserverHost(); int remoteManagerPort = m_postageConfiguration.getTestserverRemoteManagerPort(); String remoteManagerUsername = m_postageConfiguration.getTestserverRemoteManagerUsername(); String remoteManagerPassword = m_postageConfiguration.getTestserverRemoteManagerPassword(); int internalUserCount = m_postageConfiguration.getInternalUsers().getCount(); String internalUsernamePrefix = m_postageConfiguration.getInternalUsers().getNamePrefix(); String internalPassword = m_postageConfiguration.getInternalUsers().getPassword(); Set existingUsers = getExistingUsers(host, remoteManagerPort, remoteManagerUsername, remoteManagerPassword); RemoteManagerClient remoteManagerClient = new RemoteManagerClient(host, remoteManagerPort, remoteManagerUsername, remoteManagerPassword); boolean loginSuccess = remoteManagerClient.login(); ArrayList internalUsers = new ArrayList(); for (int i = 1; i <= internalUserCount; i++) { String username = internalUsernamePrefix + i; if (existingUsers.contains(username)) { log.info("user already exists: " + username); if (!m_postageConfiguration.isInternalReuseExisting()) { remoteManagerClient.executeCommand("deluser " + username); List answers = remoteManagerClient.readAnswer(); addUser(remoteManagerClient, username, internalPassword); answers = remoteManagerClient.readAnswer(); log.info("user deleted and re-created: " + username); } remoteManagerClient.executeCommand("setpassword " + username + " " + internalPassword); List answers = remoteManagerClient.readAnswer(); } else { addUser(remoteManagerClient, username, internalPassword); } internalUsers.add(username); } m_postageConfiguration.getInternalUsers().setExistingUsers(internalUsers); remoteManagerClient.disconnect(); } catch (Exception e) { throw new StartupException("error setting up internal user accounts", e); } }
List answers = remoteManagerClient.readAnswer();
remoteManagerClient.readAnswer();
private void setupInternalUserAccounts() throws StartupException { try { String host = m_postageConfiguration.getTestserverHost(); int remoteManagerPort = m_postageConfiguration.getTestserverRemoteManagerPort(); String remoteManagerUsername = m_postageConfiguration.getTestserverRemoteManagerUsername(); String remoteManagerPassword = m_postageConfiguration.getTestserverRemoteManagerPassword(); int internalUserCount = m_postageConfiguration.getInternalUsers().getCount(); String internalUsernamePrefix = m_postageConfiguration.getInternalUsers().getNamePrefix(); String internalPassword = m_postageConfiguration.getInternalUsers().getPassword(); Set existingUsers = getExistingUsers(host, remoteManagerPort, remoteManagerUsername, remoteManagerPassword); RemoteManagerClient remoteManagerClient = new RemoteManagerClient(host, remoteManagerPort, remoteManagerUsername, remoteManagerPassword); boolean loginSuccess = remoteManagerClient.login(); ArrayList internalUsers = new ArrayList(); for (int i = 1; i <= internalUserCount; i++) { String username = internalUsernamePrefix + i; if (existingUsers.contains(username)) { log.info("user already exists: " + username); if (!m_postageConfiguration.isInternalReuseExisting()) { remoteManagerClient.executeCommand("deluser " + username); List answers = remoteManagerClient.readAnswer(); addUser(remoteManagerClient, username, internalPassword); answers = remoteManagerClient.readAnswer(); log.info("user deleted and re-created: " + username); } remoteManagerClient.executeCommand("setpassword " + username + " " + internalPassword); List answers = remoteManagerClient.readAnswer(); } else { addUser(remoteManagerClient, username, internalPassword); } internalUsers.add(username); } m_postageConfiguration.getInternalUsers().setExistingUsers(internalUsers); remoteManagerClient.disconnect(); } catch (Exception e) { throw new StartupException("error setting up internal user accounts", e); } }
answers = remoteManagerClient.readAnswer();
remoteManagerClient.readAnswer();
private void setupInternalUserAccounts() throws StartupException { try { String host = m_postageConfiguration.getTestserverHost(); int remoteManagerPort = m_postageConfiguration.getTestserverRemoteManagerPort(); String remoteManagerUsername = m_postageConfiguration.getTestserverRemoteManagerUsername(); String remoteManagerPassword = m_postageConfiguration.getTestserverRemoteManagerPassword(); int internalUserCount = m_postageConfiguration.getInternalUsers().getCount(); String internalUsernamePrefix = m_postageConfiguration.getInternalUsers().getNamePrefix(); String internalPassword = m_postageConfiguration.getInternalUsers().getPassword(); Set existingUsers = getExistingUsers(host, remoteManagerPort, remoteManagerUsername, remoteManagerPassword); RemoteManagerClient remoteManagerClient = new RemoteManagerClient(host, remoteManagerPort, remoteManagerUsername, remoteManagerPassword); boolean loginSuccess = remoteManagerClient.login(); ArrayList internalUsers = new ArrayList(); for (int i = 1; i <= internalUserCount; i++) { String username = internalUsernamePrefix + i; if (existingUsers.contains(username)) { log.info("user already exists: " + username); if (!m_postageConfiguration.isInternalReuseExisting()) { remoteManagerClient.executeCommand("deluser " + username); List answers = remoteManagerClient.readAnswer(); addUser(remoteManagerClient, username, internalPassword); answers = remoteManagerClient.readAnswer(); log.info("user deleted and re-created: " + username); } remoteManagerClient.executeCommand("setpassword " + username + " " + internalPassword); List answers = remoteManagerClient.readAnswer(); } else { addUser(remoteManagerClient, username, internalPassword); } internalUsers.add(username); } m_postageConfiguration.getInternalUsers().setExistingUsers(internalUsers); remoteManagerClient.disconnect(); } catch (Exception e) { throw new StartupException("error setting up internal user accounts", e); } }
subfolderStructureChanged( this );
protected void addSubfolder( PhotoFolder subfolder ) { subfolders.add( subfolder ); modified(); }
Transaction tx = odmg.newTransaction(); tx.begin();
Transaction tx = odmg.currentTransaction(); boolean mustCommit = false; if ( tx == null ) { tx = odmg.newTransaction(); tx.begin(); mustCommit = true; }
public void delete() { getODMGImplementation(); getODMGDatabase(); Transaction tx = odmg.newTransaction(); tx.begin(); // First make sure that this object is deleted from its parent's subfolders list (if it has a parent) setParentFolder( null ); try { db.deletePersistent( this ); tx.commit(); } catch ( Exception e ) { tx.abort(); log.warn( "Error deleteing photo folder: " + e.getMessage() ); } }
try { db.deletePersistent( this );
db.deletePersistent( this ); if ( mustCommit ) {
public void delete() { getODMGImplementation(); getODMGDatabase(); Transaction tx = odmg.newTransaction(); tx.begin(); // First make sure that this object is deleted from its parent's subfolders list (if it has a parent) setParentFolder( null ); try { db.deletePersistent( this ); tx.commit(); } catch ( Exception e ) { tx.abort(); log.warn( "Error deleteing photo folder: " + e.getMessage() ); } }
} catch ( Exception e ) { tx.abort(); log.warn( "Error deleteing photo folder: " + e.getMessage() );
public void delete() { getODMGImplementation(); getODMGDatabase(); Transaction tx = odmg.newTransaction(); tx.begin(); // First make sure that this object is deleted from its parent's subfolders list (if it has a parent) setParentFolder( null ); try { db.deletePersistent( this ); tx.commit(); } catch ( Exception e ) { tx.abort(); log.warn( "Error deleteing photo folder: " + e.getMessage() ); } }
Transaction tx = odmg.newTransaction(); tx.begin();
Transaction tx = odmg.currentTransaction(); boolean mustCommit = false; if ( tx == null ) { tx = odmg.newTransaction(); tx.begin(); mustCommit = true; }
public static PhotoFolder getRoot() { getODMGImplementation(); getODMGDatabase(); DList folders = null; Transaction tx = odmg.newTransaction(); tx.begin(); try { OQLQuery query = odmg.newOQLQuery(); query.create( "select folders from " + PhotoFolder.class.getName() + " where folderId = 1" ); folders = (DList) query.execute(); } catch ( Exception e ) { tx.abort(); return null; } PhotoFolder rootFolder = (PhotoFolder) folders.get( 0 ); return rootFolder; }
if ( mustCommit ) { tx.commit(); }
public static PhotoFolder getRoot() { getODMGImplementation(); getODMGDatabase(); DList folders = null; Transaction tx = odmg.newTransaction(); tx.begin(); try { OQLQuery query = odmg.newOQLQuery(); query.create( "select folders from " + PhotoFolder.class.getName() + " where folderId = 1" ); folders = (DList) query.execute(); } catch ( Exception e ) { tx.abort(); return null; } PhotoFolder rootFolder = (PhotoFolder) folders.get( 0 ); return rootFolder; }
query.create( "select folders from " + PhotoFolder.class.getName() + " where folderId = 0" );
query.create( "select folders from " + PhotoFolder.class.getName() + " where folderId = 1" );
public static void main( String[] args ) { org.apache.log4j.BasicConfigurator.configure(); log.setLevel( org.apache.log4j.Level.DEBUG ); Implementation odmg = getODMGImplementation(); Database db = getODMGDatabase(); Transaction tx = odmg.newTransaction(); tx.begin(); DList folders = null; try { OQLQuery query = odmg.newOQLQuery(); query.create( "select folders from " + PhotoFolder.class.getName() + " where folderId = 0" ); folders = (DList) query.execute(); tx.commit(); } catch ( Exception e ) { tx.abort(); log.error( e.getMessage() ); } Iterator iter = folders.iterator(); boolean found = false; log.debug( "Starting to go thourh..." ); while ( iter.hasNext() ) { PhotoFolder folder = (PhotoFolder) iter.next(); log.debug( "Folder " + folder.getName() ); if ( folder.getFolderId() == 0 ) { found = true; log.info( "Found!!!" ); } } }
if ( parent != null ) { parent.subfolderChanged( this ); }
protected void modified() { // Find the current transaction or create a new one Transaction tx = odmg.currentTransaction(); boolean mustCommit = false; if ( tx == null ) { tx = odmg.newTransaction(); tx.begin(); mustCommit = true; } // Add folder to the transaction tx.lock( this, Transaction.WRITE ); // Notify the listeners. This is done in the same transaction context so that potential modifications to other // persistent objects are also saved notifyListeners(); // If a new transaction was created, commit it if ( mustCommit ) { tx.commit(); } }
subfolderStructureChanged( this );
protected void removeSubfolder( PhotoFolder subfolder ) { subfolders.remove( subfolder ); modified(); }
metaAssoc.remove(1); metaAssoc.add("Haplotypes", new HaploAssocPanel(theData.getHaplotypes()));
htp.makeTable(theData.getHaplotypes());
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 we've adjusted the haps display thresh we need to change the haps ass panel if (tabNum == VIEW_TDT_NUM){ 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()){ metaAssoc.remove(1); metaAssoc.add("Haplotypes", new HaploAssocPanel(theData.getHaplotypes())); } } 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); } 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(); } Chromosome.doFilter(markerResults); //after editing the filtered marker list, needs to be prodded into //resizing correctly dPrimeDisplay.computePreferredSize(); dPrimeDisplay.colorDPrime(currentScheme); 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(); } 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; } }
if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc= (JTabbedPane)tabs.getComponentAt(VIEW_TDT_NUM); HaploAssocPanel hasp = (HaploAssocPanel)metaAssoc.getComponent(1); hasp.makeTable(theData.getHaplotypes()); }
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 we've adjusted the haps display thresh we need to change the haps ass panel if (tabNum == VIEW_TDT_NUM){ 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()){ metaAssoc.remove(1); metaAssoc.add("Haplotypes", new HaploAssocPanel(theData.getHaplotypes())); } } 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); } 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(); } Chromosome.doFilter(markerResults); //after editing the filtered marker list, needs to be prodded into //resizing correctly dPrimeDisplay.computePreferredSize(); dPrimeDisplay.colorDPrime(currentScheme); 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(); } 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; } }
addComponentListener( this );
public void createUI() { setLayout( new BorderLayout() ); imageView = new JAIPhotoView(); scrollPane = new JScrollPane( imageView ); scrollPane.setPreferredSize( new Dimension( 500, 500 ) ); add( scrollPane, BorderLayout.CENTER ); JToolBar toolbar = new JToolBar(); String[] defaultZooms = { "12%", "25%", "50%", "100%", "Fit" }; JLabel zoomLabel = new JLabel( "Zoom" ); JComboBox zoomCombo = new JComboBox( defaultZooms ); zoomCombo.setEditable( true ); zoomCombo.setSelectedItem( "Fit" ); final JAIPhotoViewer viewer = this; zoomCombo.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent ev ) { JComboBox cb = (JComboBox) ev.getSource(); String selected = (String)cb.getSelectedItem(); log.debug( "Selected: " + selected ); isFit = false; // Parse the pattern DecimalFormat percentFormat = new DecimalFormat( "#####.#%" ); if ( selected == "Fit" ) { isFit = true; log.debug( "Fitting to window" ); fit(); float newScale = getScale(); String strNewScale = "Fit"; cb.setSelectedItem( strNewScale ); } else { // Parse the number. First remove all white space to ease the parsing StringBuffer b = new StringBuffer( selected ); int spaceIndex = b.indexOf( " " ); while ( spaceIndex >= 0 ) { b.deleteCharAt( spaceIndex ); spaceIndex = b.indexOf( " " ); } selected = b.toString(); boolean success = false; float newScale = 0; try { newScale = Float.parseFloat( selected ); newScale /= 100.0; success = true; } catch (NumberFormatException e ) { // Not a float } if ( !success ) { try { newScale = percentFormat.parse( selected ).floatValue(); success = true; } catch ( ParseException e ) { } } if ( success ) { log.debug( "New scale: " + newScale ); viewer.setScale( newScale ); String strNewScale = percentFormat.format( newScale ); cb.setSelectedItem( strNewScale ); } } } }); toolbar.add( zoomLabel ); toolbar.add( zoomCombo ); add( toolbar, BorderLayout.NORTH ); }
log.debug( "fit to " + displaySize.getWidth() + ", " + displaySize.getHeight() );
public void fit() { Dimension displaySize = scrollPane.getSize(); imageView.fitToRect( displaySize.getWidth()-4, displaySize.getHeight()-4 ); // int origWidth = imageView.getOrigWidth(); // int origHeight = imageView.getOrigHeight(); // if ( origWidth > 0 && origHeight > 0 ) { // float widthScale = ((float)displaySize.getWidth())/(float)origWidth; // float heightScale = ((float)displaySize.getHeight())/(float)origHeight; // float scale = heightScale; // if ( widthScale < heightScale ) { // scale = widthScale; // } // setScale( scale ); // } }
h.fc.setSelectedFile(null);
h.fc.setSelectedFile(new File(""));
void browse(int browseType){ String name; String markerInfoName = ""; HaploView h = (HaploView) this.getParent(); h.fc.setSelectedFile(null); int returned = h.fc.showOpenDialog(this); if (returned != JFileChooser.APPROVE_OPTION) return; File file = h.fc.getSelectedFile(); if (browseType == GENO){ name = file.getName(); genoFileField.setText(file.getParent()+File.separator+name); if(infoFileField.getText().equals("")){ //baseName should be everything but the final ".XXX" extension StringTokenizer st = new StringTokenizer(name,"."); String baseName = st.nextToken(); for (int i = 0; i < st.countTokens()-1; i++){ baseName = baseName.concat(".").concat(st.nextToken()); } //check for info file for original file sample.haps //either sample.haps.info or sample.info File maybeMarkers1 = new File(file.getParent(), name + MARKER_DATA_EXT); File maybeMarkers2 = new File(file.getParent(), baseName + MARKER_DATA_EXT); if (maybeMarkers1.exists()){ markerInfoName = maybeMarkers1.getName(); }else if (maybeMarkers2.exists()){ markerInfoName = maybeMarkers2.getName(); }else{ return; } infoFileField.setText(file.getParent()+File.separator+markerInfoName); } }else if (browseType==INFO){ markerInfoName = file.getName(); infoFileField.setText(file.getParent()+File.separator+markerInfoName); } }
String tagName,
TagScript tagScript,
public Expression createExpression( ExpressionFactory factory, String tagName, String attributeName, String attributeValue) throws Exception { // #### may need to include some namespace URI information in the XPath instance? if (attributeName.equals("select")) { if ( log.isDebugEnabled() ) { log.debug( "Parsing XPath expression: " + attributeValue ); } try { XPath xpath = new Dom4jXPath(attributeValue); return new XPathExpression(xpath); } catch (JaxenException e) { throw new JellyException( "Could not parse XPath expression: \"" + attributeValue + "\" reason: " + e, e ); } } if (attributeName.equals("match")) { if ( log.isDebugEnabled() ) { log.debug( "Parsing XPath pattern: " + attributeValue ); } try { Pattern pattern = DocumentHelper.createPattern( attributeValue ); return new XPathPatternExpression(pattern); } catch (Exception e) { throw new JellyException( "Could not parse XPath expression: \"" + attributeValue + "\" reason: " + e, e ); } } // will use the default expression instead return super.createExpression(factory, tagName, attributeName, attributeValue); }
return new XPathExpression(xpath);
return new XPathExpression(xpath, tagScript);
public Expression createExpression( ExpressionFactory factory, String tagName, String attributeName, String attributeValue) throws Exception { // #### may need to include some namespace URI information in the XPath instance? if (attributeName.equals("select")) { if ( log.isDebugEnabled() ) { log.debug( "Parsing XPath expression: " + attributeValue ); } try { XPath xpath = new Dom4jXPath(attributeValue); return new XPathExpression(xpath); } catch (JaxenException e) { throw new JellyException( "Could not parse XPath expression: \"" + attributeValue + "\" reason: " + e, e ); } } if (attributeName.equals("match")) { if ( log.isDebugEnabled() ) { log.debug( "Parsing XPath pattern: " + attributeValue ); } try { Pattern pattern = DocumentHelper.createPattern( attributeValue ); return new XPathPatternExpression(pattern); } catch (Exception e) { throw new JellyException( "Could not parse XPath expression: \"" + attributeValue + "\" reason: " + e, e ); } } // will use the default expression instead return super.createExpression(factory, tagName, attributeName, attributeValue); }
return super.createExpression(factory, tagName, attributeName, attributeValue);
return super.createExpression(factory, tagScript, attributeName, attributeValue);
public Expression createExpression( ExpressionFactory factory, String tagName, String attributeName, String attributeValue) throws Exception { // #### may need to include some namespace URI information in the XPath instance? if (attributeName.equals("select")) { if ( log.isDebugEnabled() ) { log.debug( "Parsing XPath expression: " + attributeValue ); } try { XPath xpath = new Dom4jXPath(attributeValue); return new XPathExpression(xpath); } catch (JaxenException e) { throw new JellyException( "Could not parse XPath expression: \"" + attributeValue + "\" reason: " + e, e ); } } if (attributeName.equals("match")) { if ( log.isDebugEnabled() ) { log.debug( "Parsing XPath pattern: " + attributeValue ); } try { Pattern pattern = DocumentHelper.createPattern( attributeValue ); return new XPathPatternExpression(pattern); } catch (Exception e) { throw new JellyException( "Could not parse XPath expression: \"" + attributeValue + "\" reason: " + e, e ); } } // will use the default expression instead return super.createExpression(factory, tagName, attributeName, attributeValue); }
JTable table = checkPanel.getTable(); checkWindow.dispose(); boolean[] markerResultArray = new boolean[table.getRowCount()]; for (int i = 0; i < table.getRowCount(); i++){ markerResultArray[i] = ((Boolean)table.getValueAt(i,7)).booleanValue(); } try{ new TextMethods().linkageToHaps(markerResultArray,checkPanel.getPedFile(),"test.haps"); }catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); }
JTable table = checkPanel.getTable(); checkWindow.dispose(); boolean[] markerResultArray = new boolean[table.getRowCount()]; for (int i = 0; i < table.getRowCount(); i++){ markerResultArray[i] = ((Boolean)table.getValueAt(i,7)).booleanValue(); } try{ new TextMethods().linkageToHaps(markerResultArray,checkPanel.getPedFile(),filenames[0] + ".haps"); }catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); }
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command == READ_GENOTYPES){ ReadDataDialog readDialog = new ReadDataDialog("Open new data", this); readDialog.pack(); readDialog.setVisible(true); }else if (command == "Continue"){ JTable table = checkPanel.getTable(); checkWindow.dispose(); boolean[] markerResultArray = new boolean[table.getRowCount()]; for (int i = 0; i < table.getRowCount(); i++){ markerResultArray[i] = ((Boolean)table.getValueAt(i,7)).booleanValue(); } try{ new TextMethods().linkageToHaps(markerResultArray,checkPanel.getPedFile(),"test.haps"); }catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } //processInput(new File(hapInputFileName+".haps")); } else if (command == READ_MARKERS){ fc.setSelectedFile(null); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { readMarkers(fc.getSelectedFile()); } }else if (command == "Clear All Blocks"){ //theBlocks.clearBlocks(); }else if (command == DEFINE_BLOCKS){ defineBlocks(); }else if (command == "Tutorial"){ showHelp(); } else if (command == QUIT){ quit(); } else { for (int i = 0; i < viewItems.length; i++) { if (command == viewItems[i]) tabs.setSelectedIndex(i); } } }
private static void hapsTextOnly(String hapsFile,int outputType){
private static void hapsTextOnly(String hapsFile,int outputType, int maxDistance){
private static void hapsTextOnly(String hapsFile,int outputType){ try { HaploData theData; File OutputFile; File inputFile = new File(hapsFile); if(!inputFile.exists()){ System.out.println("haps input file " + hapsFile + " does not exist"); } switch(outputType){ case 1: OutputFile = new File(hapsFile + ".4GAMblocks"); break; case 2: OutputFile = new File(hapsFile + ".MJDblocks"); break; default: OutputFile = new File(hapsFile + ".SFSblocks"); break; } theData = new HaploData(new File(hapsFile)); String name = hapsFile; String baseName = hapsFile.substring(0,name.length()-5); File maybeInfo = new File(baseName + ".info"); if (maybeInfo.exists()){ theData.prepareMarkerInput(maybeInfo); } //theData.doMonitoredComputation(); Haplotype[][] haplos; if(outputType == 1 || outputType == 2){ theData.guessBlocks(outputType); } haplos = theData.generateHaplotypes(theData.blocks, 1); new TextMethods().saveHapsToText(orderHaps(haplos, theData), theData.getMultiDprime(), OutputFile); } catch(IOException e){} }
theData.generateDPrimeTable(maxDist);
private static void hapsTextOnly(String hapsFile,int outputType){ try { HaploData theData; File OutputFile; File inputFile = new File(hapsFile); if(!inputFile.exists()){ System.out.println("haps input file " + hapsFile + " does not exist"); } switch(outputType){ case 1: OutputFile = new File(hapsFile + ".4GAMblocks"); break; case 2: OutputFile = new File(hapsFile + ".MJDblocks"); break; default: OutputFile = new File(hapsFile + ".SFSblocks"); break; } theData = new HaploData(new File(hapsFile)); String name = hapsFile; String baseName = hapsFile.substring(0,name.length()-5); File maybeInfo = new File(baseName + ".info"); if (maybeInfo.exists()){ theData.prepareMarkerInput(maybeInfo); } //theData.doMonitoredComputation(); Haplotype[][] haplos; if(outputType == 1 || outputType == 2){ theData.guessBlocks(outputType); } haplos = theData.generateHaplotypes(theData.blocks, 1); new TextMethods().saveHapsToText(orderHaps(haplos, theData), theData.getMultiDprime(), OutputFile); } catch(IOException e){} }
if(outputType == 1 || outputType == 2){ theData.guessBlocks(outputType); }
theData.guessBlocks(outputType);
private static void hapsTextOnly(String hapsFile,int outputType){ try { HaploData theData; File OutputFile; File inputFile = new File(hapsFile); if(!inputFile.exists()){ System.out.println("haps input file " + hapsFile + " does not exist"); } switch(outputType){ case 1: OutputFile = new File(hapsFile + ".4GAMblocks"); break; case 2: OutputFile = new File(hapsFile + ".MJDblocks"); break; default: OutputFile = new File(hapsFile + ".SFSblocks"); break; } theData = new HaploData(new File(hapsFile)); String name = hapsFile; String baseName = hapsFile.substring(0,name.length()-5); File maybeInfo = new File(baseName + ".info"); if (maybeInfo.exists()){ theData.prepareMarkerInput(maybeInfo); } //theData.doMonitoredComputation(); Haplotype[][] haplos; if(outputType == 1 || outputType == 2){ theData.guessBlocks(outputType); } haplos = theData.generateHaplotypes(theData.blocks, 1); new TextMethods().saveHapsToText(orderHaps(haplos, theData), theData.getMultiDprime(), OutputFile); } catch(IOException e){} }
try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { }
HaploView window = new HaploView(); window.setTitle("HaploView beta"); window.setSize(800,600);
public static void main(String[] args) {//throws IOException{ try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } //setup view object HaploView window = new HaploView(); window.setTitle("HaploView beta"); 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); ReadDataDialog readDialog = new ReadDataDialog("Welcome to HaploView", window); readDialog.pack(); readDialog.setVisible(true); }
HaploView window = new HaploView(); window.setTitle("HaploView beta"); window.setSize(800,600);
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); window.setLocation((screen.width - window.getWidth()) / 2, (screen.height - window.getHeight()) / 2);
public static void main(String[] args) {//throws IOException{ try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } //setup view object HaploView window = new HaploView(); window.setTitle("HaploView beta"); 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); ReadDataDialog readDialog = new ReadDataDialog("Welcome to HaploView", window); readDialog.pack(); readDialog.setVisible(true); }
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); window.setLocation((screen.width - window.getWidth()) / 2, (screen.height - window.getHeight()) / 2); window.setVisible(true); ReadDataDialog readDialog = new ReadDataDialog("Welcome to HaploView", window); readDialog.pack(); readDialog.setVisible(true);
window.setVisible(true); ReadDataDialog readDialog = new ReadDataDialog("Welcome to HaploView", window); readDialog.pack(); readDialog.setVisible(true); }
public static void main(String[] args) {//throws IOException{ try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } //setup view object HaploView window = new HaploView(); window.setTitle("HaploView beta"); 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); ReadDataDialog readDialog = new ReadDataDialog("Welcome to HaploView", window); readDialog.pack(); readDialog.setVisible(true); }
if (!this.sessionIdSession.containsKey(sessionId)) { this.sessionIdSession.put(sessionId, session);
if (!sessionIdSession.containsKey(sessionId)) { sessionIdSession.put(sessionId, personalId);
public synchronized String addTicket(String personalId) { HttpSession session = IWContext.getInstance().getSession(); String sessionId = session.getId(); if (!this.sessionIdSession.containsKey(sessionId)) { this.sessionIdSession.put(sessionId, session); } return getTicket(personalId, sessionId); }
return getTicket(personalId, sessionId);
return getTicket(sessionId);
public synchronized String addTicket(String personalId) { HttpSession session = IWContext.getInstance().getSession(); String sessionId = session.getId(); if (!this.sessionIdSession.containsKey(sessionId)) { this.sessionIdSession.put(sessionId, session); } return getTicket(personalId, sessionId); }
private String getTicket(String personalId, String sessionId) { int length = personalId.length(); StringBuffer token = new StringBuffer(); token.append(length); token.append(SEPARATOR); token.append(personalId); token.append(sessionId); return token.toString();
private String getTicket(String sessionId) { return sessionId;
private String getTicket(String personalId, String sessionId) { int length = personalId.length(); StringBuffer token = new StringBuffer(); token.append(length); token.append(SEPARATOR); token.append(personalId); token.append(sessionId); return token.toString(); }
public boolean isValid(String ticket) { return (validate(ticket) != null);
public boolean isValid(String personalId, String ticket) { if (StringHandler.isEmpty(personalId)) { return false; } String ticketPersonalId = validate(ticket); return personalId.equals(ticketPersonalId);
public boolean isValid(String ticket) { return (validate(ticket) != null); }
int index = ticket.indexOf(SEPARATOR); if (index < 1) { return null; } String personalId = null; String sessionId = null; try { int lengthOfPersonalId = Integer.parseInt(ticket.substring(0, index)); if (lengthOfPersonalId < 1) { return null; } int startIndexSessionId = index + 1 + lengthOfPersonalId; int ticketLength = ticket.length(); if (startIndexSessionId >= ticketLength) { return null; } personalId = ticket.substring(index+1, startIndexSessionId); sessionId = ticket.substring(startIndexSessionId, ticketLength); } catch (NumberFormatException e) { return null; } return (this.sessionIdSession.containsKey(sessionId)) ? personalId : null;
return (String) sessionIdSession.get(ticket);
public String validate(String ticket) { int index = ticket.indexOf(SEPARATOR); if (index < 1) { return null; } String personalId = null; String sessionId = null; try { int lengthOfPersonalId = Integer.parseInt(ticket.substring(0, index)); if (lengthOfPersonalId < 1) { return null; } int startIndexSessionId = index + 1 + lengthOfPersonalId; int ticketLength = ticket.length(); if (startIndexSessionId >= ticketLength) { return null; } personalId = ticket.substring(index+1, startIndexSessionId); sessionId = ticket.substring(startIndexSessionId, ticketLength); } catch (NumberFormatException e) { return null; } return (this.sessionIdSession.containsKey(sessionId)) ? personalId : null; // // getting a session object from this request// MessageContext context = MessageContext.getCurrentContext();// AxisHttpSession myAxisSession = (AxisHttpSession) context.getSession();// HttpSession mySession = myAxisSession.getRep();// ServletContext myServletContext = mySession.getServletContext();// // getting the application context// IWMainApplication mainApplication = IWMainApplication.getIWMainApplication(myServletContext);// IWApplicationContext iwac = mainApplication.getIWApplicationContext(); // first try to get the user login name// String userLogin = getUserLogin(personalId, iwac);// if (userLogin == null) {// return false;// } // the first test should be sufficient but we perform also the test with the session // vice versa the test with the session should be sufficient //return isLoggedOnUsingLoggedOnMap(userLogin, mySession, iwac) && isLoggedOnUsingSession(sessionId, iwac); }
method.invoke(serviceObject, toObjectArray(parameters, parameterTypes));
method.invoke(serviceObject, args);
public Object execute(String serviceMethod, Vector parameters) throws Exception { try { int index = serviceMethod.indexOf(ServiceProxy.CLASS_METHOD_DELIMITER); final String className = serviceMethod.substring(0, index); final String methodName = serviceMethod.substring(index + 1); Class serviceClass = Class.forName(className); Class[] parameterTypes = getParameterTypes((List)parameters.get(0)); Method method = serviceClass.getMethod(methodName, parameterTypes); Object serviceObject = ServiceFactory.getService(serviceClass); Object result = method.invoke(serviceObject, toObjectArray(parameters, parameterTypes)); return Marshaller.marshal(result); } catch (Exception e) { logger.log(Level.SEVERE, "Error while invoking: " + serviceMethod, e); throw e; } }
if(serviceContext.getUser() != null){ UserManager userManager = UserManager.getInstance(); User completeUser = userManager.getUser(serviceContext.getUser().getUsername()); serviceContext.setUser(completeUser); }
private static Object[] toObjectArray(Vector parameters, Class[] parameterTypes){ Object[] args = new Object[parameterTypes.length]; for(int i=0; i<parameterTypes.length; i++){ if(i == 0){ /* first argument must always be ServiceContext */ assert parameterTypes[i].equals(ServiceContext.class): "First argument to the service method must be " + "ServiceContext "; ServiceContextImpl serviceContext = (ServiceContextImpl)Unmarshaller.unmarshal( ServiceContextImpl.class, (String)parameters.get(i+1)); if(serviceContext.getUser() != null){ UserManager userManager = UserManager.getInstance(); User completeUser = userManager.getUser(serviceContext.getUser().getUsername()); serviceContext.setUser(completeUser); } args[i] = serviceContext; }else{ args[i] = Unmarshaller.unmarshal(parameterTypes[i], (String)parameters.get(i+1)); } } return args; }
*/
public void register(AlertHandler handler, String alertId, String alertName){ assert this.handler == null; assert connection == null; this.handler = handler; /* start looking for this notification */ connection = ServerConnector.getServerConnection( sourceConfig.getApplicationConfig()); monitorObjName = new ObjectName("jmanage:name=" + alertName + ",id=" + alertId + ",type=GaugeMonitor"); /* create the MBean */ connection.createMBean("javax.management.monitor.GaugeMonitor", monitorObjName, null, null); /* set attributes */ List attributes = new LinkedList(); attributes.add(new ObjectAttribute("GranularityPeriod", new Long(5000))); attributes.add(new ObjectAttribute("NotifyHigh", Boolean.TRUE)); attributes.add(new ObjectAttribute("NotifyLow", Boolean.TRUE)); attributes.add(new ObjectAttribute("ObservedAttribute", sourceConfig.getAttributeName())); connection.setAttributes(monitorObjName, attributes); /* add observed object */ connection.invoke(monitorObjName, "addObservedObject", new Object[]{new ObjectName(sourceConfig.getObjectName())}, new String[]{"javax.management.ObjectName"}); /* set thresholds */ Object[] params = new Object[]{sourceConfig.getHighThreshold(), sourceConfig.getLowThreshold()}; String[] signature = new String[]{Number.class.getName(), Number.class.getName()}; connection.invoke(monitorObjName, "setThresholds", params, signature); /* start the monitor */ connection.invoke(monitorObjName, "start", new Object[0], new String[0]); /* now look for notifications from this mbean */ listener = new ObjectNotificationListener(){ public void handleNotification(ObjectNotification notification, Object handback) { try { GaugeAlertSource.this.handler.handle( new AlertInfo(notification)); } catch (Exception e) { logger.log(Level.SEVERE, "Error while handling alert", e); } } }; filter = new ObjectNotificationFilterSupport(); filter.enableType("jmx.monitor.gauge.high"); filter.enableType("jmx.monitor.gauge.low"); filter.enableType("jmx.monitor.error.attribute"); filter.enableType("jmx.monitor.error.type"); filter.enableType("jmx.monitor.error.mbean"); filter.enableType("jmx.monitor.error.runtime"); filter.enableType("jmx.monitor.error.threshold"); connection.addNotificationListener(monitorObjName, listener, filter, null); }
JellyContext context = new JellyContext(); context.setRootURL(new File(".").toURL()); StringWriter buffer = new StringWriter(); XMLOutput output = XMLOutput.createXMLOutput(buffer); context.runScript( new File(fileName), output ); String text = buffer.toString().trim(); if (log.isDebugEnabled()) { log.debug("Evaluated script as..."); log.debug(text); } return text;
return evaluteScriptAsText(fileName, null);
protected String evaluteScriptAsText(String fileName) throws Exception { JellyContext context = new JellyContext(); // allow scripts to refer to any resource inside this project // using an absolute URI like /src/test/org/apache/foo.xml context.setRootURL(new File(".").toURL()); // cature the output StringWriter buffer = new StringWriter(); XMLOutput output = XMLOutput.createXMLOutput(buffer); context.runScript( new File(fileName), output ); String text = buffer.toString().trim(); if (log.isDebugEnabled()) { log.debug("Evaluated script as..."); log.debug(text); } return text; }
assertEquals("Produces the correct output", "<!DOCTYPE foo PUBLIC \"publicID\" \"foo.dtd\">\n<foo></foo>", text);
assertEquals("Should produce the correct output", "<!DOCTYPE foo PUBLIC \"publicID\" \"foo.dtd\">\n<foo></foo>", text);
public void testDoctype() throws Exception { String text = evaluteScriptAsText(testBaseDir + "/testDoctype.jelly"); assertEquals("Produces the correct output", "<!DOCTYPE foo PUBLIC \"publicID\" \"foo.dtd\">\n<foo></foo>", text); }
assertEquals("Produces the correct output", "It works!", text);
assertEquals("Should produce the correct output", "It works!", text);
public void testParse() throws Exception { InputStream in = new FileInputStream(testBaseDir + "/example.jelly"); XMLParser parser = new XMLParser(); Script script = parser.parse(in); script = script.compile(); log.debug("Found: " + script); assertTrue("Parsed a Script", script instanceof Script); StringWriter buffer = new StringWriter(); script.run(parser.getContext(), XMLOutput.createXMLOutput(buffer)); String text = buffer.toString().trim(); if (log.isDebugEnabled()) { log.debug("Evaluated script as..."); log.debug(text); } assertEquals("Produces the correct output", "It works!", text); }
assertEquals("Produces the correct output", "It works!", text);
assertEquals("Should produce the correct output", "It works!", text);
public void testTransform() throws Exception { String text = evaluteScriptAsText(testBaseDir + "/transformExample.jelly"); assertEquals("Produces the correct output", "It works!", text); }
assertEquals("Produces the correct output", "It works!", text);
assertEquals("Should produce the correct output", "It works!", text);
public void testTransformAllInLine() throws Exception { String text = evaluteScriptAsText(testBaseDir + "/transformExampleAllInLine.jelly"); assertEquals("Produces the correct output", "It works!", text); }
assertEquals("Produces the correct output", "It works!", text);
assertEquals("Should produce the correct output", "It works!", text);
public void testTransformParams() throws Exception { String text = evaluteScriptAsText(testBaseDir + "/transformParamExample.jelly"); assertEquals("Produces the correct output", "It works!", text); }
assertEquals("Produces the correct output", "It works!", text);
assertEquals("Should produce the correct output", "It works!", text);
public void testTransformParamsInLine() throws Exception { String text = evaluteScriptAsText(testBaseDir + "/transformParamExample2.jelly"); assertEquals("Produces the correct output", "It works!", text); }
assertEquals("Produces the correct output", "It works!", text);
assertEquals("Should produce the correct output", "It works!", text);
public void testTransformSAXOutput() throws Exception { String text = evaluteScriptAsText(testBaseDir + "/transformExampleSAXOutput.jelly"); assertEquals("Produces the correct output", "It works!", text); }
assertEquals("Produces the correct output", "It works!", text);
assertEquals("Should produce the correct output", "It works!", text);
public void testTransformSAXOutputNestedTransforms() throws Exception { String text = evaluteScriptAsText(testBaseDir + "/transformExampleSAXOutputNestedTransforms.jelly"); assertEquals("Produces the correct output", "It works!", text); }
assertEquals("Produces the correct output", "Report count=1:assert count=2", text);
assertEquals("Should produce the correct output", "Report count=1:assert count=2", text);
public void testTransformSchematron() throws Exception { String text = evaluteScriptAsText(testBaseDir + "/schematron/transformSchematronExample.jelly"); assertEquals("Produces the correct output", "Report count=1:assert count=2", text); }
assertEquals("Produces the correct output", "It works!", text);
assertEquals("Should produce the correct output", "It works!", text);
public void testTransformXmlVar() throws Exception { String text = evaluteScriptAsText(testBaseDir + "/transformExampleXmlVar.jelly"); assertEquals("Produces the correct output", "It works!", text); }
sourceDatabaseDropdown.addItem(ds);
ArchitectFrame.getMainInstance().getUserSettings().getPlDotIni().addDataSource(ds);
public void testSourceDropDownsWithOnlyCatalog() { ArchitectDataSource ds = new ArchitectDataSource(); ds.setDisplayName("Schemaless Database"); ds.setDriverClass("regress.ca.sqlpower.architect.MockJDBCDriver"); ds.setUser("fake"); ds.setPass("fake"); //this creates a mock jdbc database with only catalogs ds.setUrl("jdbc:mock:" + "dbmd.catalogTerm=Catalog" + "&catalogs=cat1,cat2,cat3" + "&tables.cat1=tab1" + "&tables.cat2=tab2" + "&tables.cat3=tab3"); sourcePhysicalRadio.setSelected(true); sourceDatabaseDropdown.addItem(ds); sourceDatabaseDropdown.setSelectedItem(ds); flushAWT(); assertFalse(sourceSchemaDropdown.isEnabled()); assertTrue(sourceCatalogDropdown.isEnabled()); }
sourceDatabaseDropdown.addItem(ds);
ArchitectFrame.getMainInstance().getUserSettings().getPlDotIni().addDataSource(ds);
public void testSourceDropDownsWithSchemaAndCatalog() { ArchitectDataSource ds = new ArchitectDataSource(); ds.setDisplayName("Schemaless Database"); ds.setDriverClass("regress.ca.sqlpower.architect.MockJDBCDriver"); ds.setUser("fake"); ds.setPass("fake"); //this creates a mock jdbc database with catalogs and schemas ds.setUrl("jdbc:mock:dbmd.catalogTerm=Catalog&dbmd.schemaTerm=Schema&catalogs=cow_catalog&schemas.cow_catalog=moo_schema,quack_schema&tables.cow_catalog.moo_schema=braaaap,pffft&tables.cow_catalog.quack_schema=duck,goose"); sourcePhysicalRadio.setSelected(true); sourceDatabaseDropdown.addItem(ds); sourceDatabaseDropdown.setSelectedItem(ds); flushAWT(); assertTrue(sourceCatalogDropdown.isEnabled()); assertTrue(sourceSchemaDropdown.isEnabled()); }
this.currentContext = rootContext;
public Context() { }
Context answer = new Context( newVariables ); answer.taglibs = this.taglibs;
Context answer = new Context( this ); answer.setVariables( newVariables );
public Context newContext(Map newVariables) { // XXXX: should allow this new context to // XXXX: inherit parent contexts? // XXXX: Or at least publish the parent scope // XXXX: as a Map in this new variable scope? newVariables.put( "parentScope", variables ); Context answer = new Context( newVariables ); answer.taglibs = this.taglibs; return answer; }
markerResults[i] = ((Boolean)table.getValueAt(i,7)).booleanValue();
markerResults[i] = ((Boolean)table.getValueAt(i,8)).booleanValue();
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,7)).booleanValue(); } int count = 0; for (int i = 0; i < Chromosome.getSize(); i++){ if (markerResults[i]){ count++; } } Chromosome.realIndex = new int[count]; int k = 0; for (int i =0; i < Chromosome.getSize(); i++){ if (markerResults[i]){ Chromosome.realIndex[k] = i; k++; } } theData.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, dPrimeDisplay.currentScheme); 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; } }
String cut = hwcut.getText();
String cut = cdc.hwcut.getText();
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command == READ_GENOTYPES){ ReadDataDialog readDialog = new ReadDataDialog("Open new data", this); readDialog.pack(); readDialog.setVisible(true); } else if (command == 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 == CUST_BLOCKS){ TweakBlockDefsDialog tweakDialog = new TweakBlockDefsDialog("Customize Blocks", this); tweakDialog.pack(); tweakDialog.setVisible(true); }else if (command == CLEAR_BLOCKS){ colorMenuItems[0].setSelected(true); for (int i = 1; i< colorMenuItems.length; i++){ colorMenuItems[i].setEnabled(false); } changeBlocks(3,1); //blockdef clauses }else if (command.startsWith("block")){ int method = Integer.valueOf(command.substring(5)).intValue(); changeBlocks(method,1); 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")){ dPrimeDisplay.refresh(Integer.valueOf(command.substring(5)).intValue()+1); changeKey(Integer.valueOf(command.substring(5)).intValue()+1); //exporting clauses }else if (command == EXPORT_PNG){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ export(tabs.getSelectedIndex(), PNG_MODE, fc.getSelectedFile()); } }else if (command == EXPORT_TEXT){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ export(tabs.getSelectedIndex(), TXT_MODE, fc.getSelectedFile()); } }else if (command == "Select All"){ checkPanel.selectAll(); }else if (command == "Rescore Markers"){ String cut = hwcut.getText(); if (cut.equals("")){ cut = "0"; } CheckData.hwCut = Double.parseDouble(cut); cut = genocut.getText(); if (cut.equals("")){ cut="0"; } CheckData.failedGenoCut = Integer.parseInt(cut); cut = mendcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.numMendErrCut = Integer.parseInt(cut); checkPanel.redoRatings(); }else if (command == "Tutorial"){ showHelp(); } else if (command == QUIT){ quit(); } else { for (int i = 0; i < viewItems.length; i++) { if (command == viewItems[i]) tabs.setSelectedIndex(i); } } }
cut = genocut.getText();
cut = cdc.genocut.getText();
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command == READ_GENOTYPES){ ReadDataDialog readDialog = new ReadDataDialog("Open new data", this); readDialog.pack(); readDialog.setVisible(true); } else if (command == 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 == CUST_BLOCKS){ TweakBlockDefsDialog tweakDialog = new TweakBlockDefsDialog("Customize Blocks", this); tweakDialog.pack(); tweakDialog.setVisible(true); }else if (command == CLEAR_BLOCKS){ colorMenuItems[0].setSelected(true); for (int i = 1; i< colorMenuItems.length; i++){ colorMenuItems[i].setEnabled(false); } changeBlocks(3,1); //blockdef clauses }else if (command.startsWith("block")){ int method = Integer.valueOf(command.substring(5)).intValue(); changeBlocks(method,1); 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")){ dPrimeDisplay.refresh(Integer.valueOf(command.substring(5)).intValue()+1); changeKey(Integer.valueOf(command.substring(5)).intValue()+1); //exporting clauses }else if (command == EXPORT_PNG){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ export(tabs.getSelectedIndex(), PNG_MODE, fc.getSelectedFile()); } }else if (command == EXPORT_TEXT){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ export(tabs.getSelectedIndex(), TXT_MODE, fc.getSelectedFile()); } }else if (command == "Select All"){ checkPanel.selectAll(); }else if (command == "Rescore Markers"){ String cut = hwcut.getText(); if (cut.equals("")){ cut = "0"; } CheckData.hwCut = Double.parseDouble(cut); cut = genocut.getText(); if (cut.equals("")){ cut="0"; } CheckData.failedGenoCut = Integer.parseInt(cut); cut = mendcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.numMendErrCut = Integer.parseInt(cut); checkPanel.redoRatings(); }else if (command == "Tutorial"){ showHelp(); } else if (command == QUIT){ quit(); } else { for (int i = 0; i < viewItems.length; i++) { if (command == viewItems[i]) tabs.setSelectedIndex(i); } } }
cut = mendcut.getText();
cut = cdc.mendcut.getText();
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command == READ_GENOTYPES){ ReadDataDialog readDialog = new ReadDataDialog("Open new data", this); readDialog.pack(); readDialog.setVisible(true); } else if (command == 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 == CUST_BLOCKS){ TweakBlockDefsDialog tweakDialog = new TweakBlockDefsDialog("Customize Blocks", this); tweakDialog.pack(); tweakDialog.setVisible(true); }else if (command == CLEAR_BLOCKS){ colorMenuItems[0].setSelected(true); for (int i = 1; i< colorMenuItems.length; i++){ colorMenuItems[i].setEnabled(false); } changeBlocks(3,1); //blockdef clauses }else if (command.startsWith("block")){ int method = Integer.valueOf(command.substring(5)).intValue(); changeBlocks(method,1); 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")){ dPrimeDisplay.refresh(Integer.valueOf(command.substring(5)).intValue()+1); changeKey(Integer.valueOf(command.substring(5)).intValue()+1); //exporting clauses }else if (command == EXPORT_PNG){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ export(tabs.getSelectedIndex(), PNG_MODE, fc.getSelectedFile()); } }else if (command == EXPORT_TEXT){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ export(tabs.getSelectedIndex(), TXT_MODE, fc.getSelectedFile()); } }else if (command == "Select All"){ checkPanel.selectAll(); }else if (command == "Rescore Markers"){ String cut = hwcut.getText(); if (cut.equals("")){ cut = "0"; } CheckData.hwCut = Double.parseDouble(cut); cut = genocut.getText(); if (cut.equals("")){ cut="0"; } CheckData.failedGenoCut = Integer.parseInt(cut); cut = mendcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.numMendErrCut = Integer.parseInt(cut); checkPanel.redoRatings(); }else if (command == "Tutorial"){ showHelp(); } else if (command == QUIT){ quit(); } else { for (int i = 0; i < viewItems.length; i++) { if (command == viewItems[i]) tabs.setSelectedIndex(i); } } }
cut = cdc.mafcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.mafCut = Double.parseDouble(cut);
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command == READ_GENOTYPES){ ReadDataDialog readDialog = new ReadDataDialog("Open new data", this); readDialog.pack(); readDialog.setVisible(true); } else if (command == 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 == CUST_BLOCKS){ TweakBlockDefsDialog tweakDialog = new TweakBlockDefsDialog("Customize Blocks", this); tweakDialog.pack(); tweakDialog.setVisible(true); }else if (command == CLEAR_BLOCKS){ colorMenuItems[0].setSelected(true); for (int i = 1; i< colorMenuItems.length; i++){ colorMenuItems[i].setEnabled(false); } changeBlocks(3,1); //blockdef clauses }else if (command.startsWith("block")){ int method = Integer.valueOf(command.substring(5)).intValue(); changeBlocks(method,1); 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")){ dPrimeDisplay.refresh(Integer.valueOf(command.substring(5)).intValue()+1); changeKey(Integer.valueOf(command.substring(5)).intValue()+1); //exporting clauses }else if (command == EXPORT_PNG){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ export(tabs.getSelectedIndex(), PNG_MODE, fc.getSelectedFile()); } }else if (command == EXPORT_TEXT){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ export(tabs.getSelectedIndex(), TXT_MODE, fc.getSelectedFile()); } }else if (command == "Select All"){ checkPanel.selectAll(); }else if (command == "Rescore Markers"){ String cut = hwcut.getText(); if (cut.equals("")){ cut = "0"; } CheckData.hwCut = Double.parseDouble(cut); cut = genocut.getText(); if (cut.equals("")){ cut="0"; } CheckData.failedGenoCut = Integer.parseInt(cut); cut = mendcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.numMendErrCut = Integer.parseInt(cut); checkPanel.redoRatings(); }else if (command == "Tutorial"){ showHelp(); } else if (command == QUIT){ quit(); } else { for (int i = 0; i < viewItems.length; i++) { if (command == viewItems[i]) tabs.setSelectedIndex(i); } } }
window.setTitle("HaploView beta");
window.setTitle(TITLE_STRING);
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")) { 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(); window.argHandler(args); //setup view object window.setTitle("HaploView beta"); 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); ReadDataDialog readDialog = new ReadDataDialog("Welcome to HaploView", window); readDialog.pack(); readDialog.setVisible(true); } }
JPanel failPanel = new JPanel(); failPanel.setLayout(new BoxLayout(failPanel,BoxLayout.Y_AXIS)); JPanel holdPanel = new JPanel(); holdPanel.add(new JLabel("HW p-value cutoff: ")); hwcut = new NumberTextField(String.valueOf(CheckData.hwCut),6,true); holdPanel.add(hwcut); failPanel.add(holdPanel); holdPanel = new JPanel(); holdPanel.add(new JLabel("Min genotype %: ")); genocut = new NumberTextField(String.valueOf(CheckData.failedGenoCut),2, false); holdPanel.add(genocut); failPanel.add(holdPanel); holdPanel = new JPanel(); holdPanel.add(new JLabel("Max # mendel errors: ")); mendcut = new NumberTextField(String.valueOf(CheckData.numMendErrCut),2,false); holdPanel.add(mendcut); failPanel.add(holdPanel); JButton rescore = new JButton("Rescore Markers"); rescore.addActionListener(window); failPanel.add(rescore); JButton selAll = new JButton("Select All"); selAll.addActionListener(window); JPanel ctrlPanel = new JPanel(); ctrlPanel.add(failPanel); ctrlPanel.add(selAll); checkPanel.add(ctrlPanel);
cdc = new CheckDataController(window); metaCheckPanel.add(cdc);
void processData(final String[][] hminfo) { if (inputOptions[2].equals("")){ inputOptions[2] = "0"; } maxCompDist = Long.parseLong(inputOptions[2])*1000; this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; theData.infoKnown = false; if (!(inputOptions[1].equals(""))){ readMarkers(new File(inputOptions[1]), null); } if (hminfo != null){ readMarkers(null,hminfo); } theData.generateDPrimeTable(maxCompDist); theData.guessBlocks(0); colorMenuItems[0].setSelected(true); colorMenuItems[1].setEnabled(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(theData); 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); JPanel failPanel = new JPanel(); failPanel.setLayout(new BoxLayout(failPanel,BoxLayout.Y_AXIS)); JPanel holdPanel = new JPanel(); holdPanel.add(new JLabel("HW p-value cutoff: ")); hwcut = new NumberTextField(String.valueOf(CheckData.hwCut),6,true); holdPanel.add(hwcut); failPanel.add(holdPanel); holdPanel = new JPanel(); holdPanel.add(new JLabel("Min genotype %: ")); genocut = new NumberTextField(String.valueOf(CheckData.failedGenoCut),2, false); holdPanel.add(genocut); failPanel.add(holdPanel); holdPanel = new JPanel(); holdPanel.add(new JLabel("Max # mendel errors: ")); mendcut = new NumberTextField(String.valueOf(CheckData.numMendErrCut),2,false); holdPanel.add(mendcut); failPanel.add(holdPanel); JButton rescore = new JButton("Rescore Markers"); rescore.addActionListener(window); failPanel.add(rescore); JButton selAll = new JButton("Select All"); selAll.addActionListener(window); JPanel ctrlPanel = new JPanel(); ctrlPanel.add(failPanel); ctrlPanel.add(selAll); checkPanel.add(ctrlPanel); 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; 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); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }
JPanel failPanel = new JPanel(); failPanel.setLayout(new BoxLayout(failPanel,BoxLayout.Y_AXIS)); JPanel holdPanel = new JPanel(); holdPanel.add(new JLabel("HW p-value cutoff: ")); hwcut = new NumberTextField(String.valueOf(CheckData.hwCut),6,true); holdPanel.add(hwcut); failPanel.add(holdPanel); holdPanel = new JPanel(); holdPanel.add(new JLabel("Min genotype %: ")); genocut = new NumberTextField(String.valueOf(CheckData.failedGenoCut),2, false); holdPanel.add(genocut); failPanel.add(holdPanel); holdPanel = new JPanel(); holdPanel.add(new JLabel("Max # mendel errors: ")); mendcut = new NumberTextField(String.valueOf(CheckData.numMendErrCut),2,false); holdPanel.add(mendcut); failPanel.add(holdPanel); JButton rescore = new JButton("Rescore Markers"); rescore.addActionListener(window); failPanel.add(rescore); JButton selAll = new JButton("Select All"); selAll.addActionListener(window); JPanel ctrlPanel = new JPanel(); ctrlPanel.add(failPanel); ctrlPanel.add(selAll); checkPanel.add(ctrlPanel);
cdc = new CheckDataController(window); metaCheckPanel.add(cdc);
public Object construct(){ dPrimeDisplay=null; theData.infoKnown = false; if (!(inputOptions[1].equals(""))){ readMarkers(new File(inputOptions[1]), null); } if (hminfo != null){ readMarkers(null,hminfo); } theData.generateDPrimeTable(maxCompDist); theData.guessBlocks(0); colorMenuItems[0].setSelected(true); colorMenuItems[1].setEnabled(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(theData); 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); JPanel failPanel = new JPanel(); failPanel.setLayout(new BoxLayout(failPanel,BoxLayout.Y_AXIS)); JPanel holdPanel = new JPanel(); holdPanel.add(new JLabel("HW p-value cutoff: ")); hwcut = new NumberTextField(String.valueOf(CheckData.hwCut),6,true); holdPanel.add(hwcut); failPanel.add(holdPanel); holdPanel = new JPanel(); holdPanel.add(new JLabel("Min genotype %: ")); genocut = new NumberTextField(String.valueOf(CheckData.failedGenoCut),2, false); holdPanel.add(genocut); failPanel.add(holdPanel); holdPanel = new JPanel(); holdPanel.add(new JLabel("Max # mendel errors: ")); mendcut = new NumberTextField(String.valueOf(CheckData.numMendErrCut),2,false); holdPanel.add(mendcut); failPanel.add(holdPanel); JButton rescore = new JButton("Rescore Markers"); rescore.addActionListener(window); failPanel.add(rescore); JButton selAll = new JButton("Select All"); selAll.addActionListener(window); JPanel ctrlPanel = new JPanel(); ctrlPanel.add(failPanel); ctrlPanel.add(selAll); checkPanel.add(ctrlPanel); 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; return null; }
File pedFile = new File(inputOptions[0]);
File inFile = new File(inputOptions[0]);
void readPedGenotypes(String[] f, int type){ //input is a 3 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = max comparison distance (don't compute d' if markers are greater than this dist apart) //type is either 3 or 4 for ped and hapmap files respectively inputOptions = f; File pedFile = new File(inputOptions[0]); try { if (pedFile.length() < 1){ throw new HaploViewException("Pedfile is empty or nonexistent: " + pedFile.getName()); } checkPanel = new CheckDataPanel(pedFile, type); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); theData = new HaploData(assocTest); JTable table = checkPanel.getTable(); boolean[] markerResultArray = new boolean[table.getRowCount()]; for (int i = 0; i < table.getRowCount(); i++){ markerResultArray[i] = ((Boolean)table.getValueAt(i,7)).booleanValue(); } theData.linkageToChrom(markerResultArray,checkPanel.getPedFile(),checkPanel.getPedFile().getHMInfo()); processData(checkPanel.getPedFile().getHMInfo()); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } }
if (pedFile.length() < 1){ throw new HaploViewException("Pedfile is empty or nonexistent: " + pedFile.getName());
if (inFile.length() < 1){ throw new HaploViewException("Pedfile is empty or nonexistent: " + inFile.getName());
void readPedGenotypes(String[] f, int type){ //input is a 3 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = max comparison distance (don't compute d' if markers are greater than this dist apart) //type is either 3 or 4 for ped and hapmap files respectively inputOptions = f; File pedFile = new File(inputOptions[0]); try { if (pedFile.length() < 1){ throw new HaploViewException("Pedfile is empty or nonexistent: " + pedFile.getName()); } checkPanel = new CheckDataPanel(pedFile, type); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); theData = new HaploData(assocTest); JTable table = checkPanel.getTable(); boolean[] markerResultArray = new boolean[table.getRowCount()]; for (int i = 0; i < table.getRowCount(); i++){ markerResultArray[i] = ((Boolean)table.getValueAt(i,7)).booleanValue(); } theData.linkageToChrom(markerResultArray,checkPanel.getPedFile(),checkPanel.getPedFile().getHMInfo()); processData(checkPanel.getPedFile().getHMInfo()); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } }
checkPanel = new CheckDataPanel(pedFile, type);
checkPanel = new CheckDataPanel(theData.getPedFile());
void readPedGenotypes(String[] f, int type){ //input is a 3 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = max comparison distance (don't compute d' if markers are greater than this dist apart) //type is either 3 or 4 for ped and hapmap files respectively inputOptions = f; File pedFile = new File(inputOptions[0]); try { if (pedFile.length() < 1){ throw new HaploViewException("Pedfile is empty or nonexistent: " + pedFile.getName()); } checkPanel = new CheckDataPanel(pedFile, type); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); theData = new HaploData(assocTest); JTable table = checkPanel.getTable(); boolean[] markerResultArray = new boolean[table.getRowCount()]; for (int i = 0; i < table.getRowCount(); i++){ markerResultArray[i] = ((Boolean)table.getValueAt(i,7)).booleanValue(); } theData.linkageToChrom(markerResultArray,checkPanel.getPedFile(),checkPanel.getPedFile().getHMInfo()); processData(checkPanel.getPedFile().getHMInfo()); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } }
theData = new HaploData(assocTest); JTable table = checkPanel.getTable(); boolean[] markerResultArray = new boolean[table.getRowCount()]; for (int i = 0; i < table.getRowCount(); i++){ markerResultArray[i] = ((Boolean)table.getValueAt(i,7)).booleanValue(); } theData.linkageToChrom(markerResultArray,checkPanel.getPedFile(),checkPanel.getPedFile().getHMInfo()); processData(checkPanel.getPedFile().getHMInfo());
void readPedGenotypes(String[] f, int type){ //input is a 3 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = max comparison distance (don't compute d' if markers are greater than this dist apart) //type is either 3 or 4 for ped and hapmap files respectively inputOptions = f; File pedFile = new File(inputOptions[0]); try { if (pedFile.length() < 1){ throw new HaploViewException("Pedfile is empty or nonexistent: " + pedFile.getName()); } checkPanel = new CheckDataPanel(pedFile, type); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); theData = new HaploData(assocTest); JTable table = checkPanel.getTable(); boolean[] markerResultArray = new boolean[table.getRowCount()]; for (int i = 0; i < table.getRowCount(); i++){ markerResultArray[i] = ((Boolean)table.getValueAt(i,7)).booleanValue(); } theData.linkageToChrom(markerResultArray,checkPanel.getPedFile(),checkPanel.getPedFile().getHMInfo()); processData(checkPanel.getPedFile().getHMInfo()); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } }
System.out.println( "Succesfully loaded \""+ f.getPath() + "\"" );
log.debug( "Succesfully loaded \""+ f.getPath() + "\"" );
public static void main( String args[] ) { JFrame frame = new JFrame( "PhotoInfoEditorTest" ); PhotoView view = new PhotoView(); frame.getContentPane().add( view, BorderLayout.CENTER ); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } } ); File f = new File("c:\\java\\photovault\\testfiles\\test1.jpg" ); try { BufferedImage bi = ImageIO.read(f); view.setImage( bi ); view.setScale( 0.3f ); System.out.println( "Succesfully loaded \""+ f.getPath() + "\"" ); } catch (IOException e ) { System.out.println( "Error loading image \""+ f.getPath() + "\"" ); } frame.pack(); frame.setVisible( true ); }
System.out.println( "Error loading image \""+ f.getPath() + "\"" );
log.debug( "Error loading image \""+ f.getPath() + "\"" );
public static void main( String args[] ) { JFrame frame = new JFrame( "PhotoInfoEditorTest" ); PhotoView view = new PhotoView(); frame.getContentPane().add( view, BorderLayout.CENTER ); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } } ); File f = new File("c:\\java\\photovault\\testfiles\\test1.jpg" ); try { BufferedImage bi = ImageIO.read(f); view.setImage( bi ); view.setScale( 0.3f ); System.out.println( "Succesfully loaded \""+ f.getPath() + "\"" ); } catch (IOException e ) { System.out.println( "Error loading image \""+ f.getPath() + "\"" ); } frame.pack(); frame.setVisible( true ); }
public Tag createTag() throws Exception;
public Tag createTag(String name, Attributes attributes) throws Exception;
public Tag createTag() throws Exception;