Back to index

wims  3.65+svn20090927
Public Member Functions | Package Functions | Package Attributes
WIMSchem.CatalogWindow Class Reference
Inheritance diagram for WIMSchem.CatalogWindow:
Inheritance graph
[legend]
Collaboration diagram for WIMSchem.CatalogWindow:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CatalogWindow (String CatFN)
void Synch (int Sz)
void MolSelected (EditorPane source, int idx, boolean dblclick)
void DirtyChanged (boolean isdirty)
void actionPerformed (ActionEvent e)
void componentHidden (ComponentEvent e)
void componentMoved (ComponentEvent e)
void componentResized (ComponentEvent e)
void componentShown (ComponentEvent e)
void adjustmentValueChanged (AdjustmentEvent e)
void windowActivated (WindowEvent e)
void windowClosed (WindowEvent e)
void windowClosing (WindowEvent e)
void windowDeactivated (WindowEvent e)
void windowDeiconified (WindowEvent e)
void windowIconified (WindowEvent e)
void windowOpened (WindowEvent e)

Package Functions

void UpdatePosition (int NewPos)
synchronized void OpenMolecule (int N)

Package Attributes

String catFN
FileInputStream istr = null
final int COL_SIZE = 5
int basepos = 0
int selnum = -1
int highestUpdated = 0
Color bckgr
Color highl
JScrollBar scroll
JButton bopen
JButton bclose
EditorPane[] entries
CatalogLoader loader = null

Detailed Description

Definition at line 24 of file CatalogWindow.java.


Constructor & Destructor Documentation

WIMSchem.CatalogWindow.CatalogWindow ( String  CatFN) [inline]

Definition at line 41 of file CatalogWindow.java.

    {
       catFN=CatFN;
       
       setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
       JFrame.setDefaultLookAndFeelDecorated(false); 
       
       setTitle("WIMSchem Catalog - "+catFN);

       bckgr=getBackground();
       highl=new Color(Math.max(bckgr.getRed()-32,0),Math.max(bckgr.getGreen()-32,0),bckgr.getBlue());

       ImageIcon mainIcon=new ImageIcon(getClass().getResource("/images/MainIcon.png"));
       setIconImage(mainIcon.getImage());

       GridBagLayout gb=new GridBagLayout();
       GridBagConstraints gc=new GridBagConstraints();
       gc.insets=new Insets(2,2,2,2);
       
       // add the molecules
       JPanel content=new JPanel();
       content.setLayout(new BoxLayout(content,BoxLayout.X_AXIS));
       entries=new EditorPane[COL_SIZE];
       for (int n=0;n<COL_SIZE;n++)
       {
           entries[n]=new EditorPane(100,100);
           entries[n].SetEditable(false);
           entries[n].SetMolSelectListener(this);
           entries[n].SetToolCursor();
           entries[n].SetBorder(true);
           entries[n].setMaximumSize(new Dimension(Short.MAX_VALUE,Short.MAX_VALUE));
           content.add(entries[n]);
       }
       gc.fill=GridBagConstraints.BOTH;
       gc.gridwidth=GridBagConstraints.REMAINDER;
       gc.weightx=1;
       gc.weighty=1;
       gb.setConstraints(content,gc);
       add(content);
       
       // add the scroller and buttons
       gc.fill=GridBagConstraints.HORIZONTAL;
       gc.weighty=0;

       scroll=new JScrollBar(JScrollBar.HORIZONTAL,0,0,0,0);
       scroll.addAdjustmentListener(this);
       gc.gridwidth=5;
       gc.weightx=1;
       gb.setConstraints(scroll,gc);
       add(scroll);
       
       bopen=new JButton("Open");
       bopen.addActionListener(this);
       bopen.setMnemonic(KeyEvent.VK_O);
       gc.gridwidth=1;
       gc.weightx=0;
       gb.setConstraints(bopen,gc);
       add(bopen);
       
       bclose=new JButton("Close");
       bclose.setMnemonic(KeyEvent.VK_C);
       bclose.addActionListener(this);
       gc.gridwidth=1;
       gc.weightx=0;
       gb.setConstraints(bclose,gc);
       add(bclose);

       setLayout(gb);
       pack();
       addComponentListener(this);
       addWindowListener(this);

       try
       {      
           istr=new FileInputStream(catFN);
       }
       catch (IOException e)
       {
           JOptionPane.showMessageDialog(null,e.toString(),"Catalog Read Failed",JOptionPane.ERROR_MESSAGE);
           dispose();
           return;
       }

       loader=new CatalogLoader(this,istr);
       loader.start();
    }

Here is the call graph for this function:


Member Function Documentation

void WIMSchem.CatalogWindow.actionPerformed ( ActionEvent  e) [inline]

Definition at line 200 of file CatalogWindow.java.

    {
       if (e.getSource()==bopen) {if (selnum>=0) OpenMolecule(selnum);}
       if (e.getSource()==bclose) 
       {
           if (loader!=null) loader.Zap();
           dispose(); 
           return;
       }
    }

Here is the call graph for this function:

void WIMSchem.CatalogWindow.adjustmentValueChanged ( AdjustmentEvent  e) [inline]

Definition at line 219 of file CatalogWindow.java.

    {
       if (e.getSource()==scroll)
       {
           int pos=e.getValue();
           if (pos!=basepos) UpdatePosition(pos);
       }
    }

Here is the call graph for this function:

void WIMSchem.CatalogWindow.componentHidden ( ComponentEvent  e) [inline]

Definition at line 211 of file CatalogWindow.java.

{}
void WIMSchem.CatalogWindow.componentMoved ( ComponentEvent  e) [inline]

Definition at line 212 of file CatalogWindow.java.

{}
void WIMSchem.CatalogWindow.componentResized ( ComponentEvent  e) [inline]

Definition at line 213 of file CatalogWindow.java.

    {
       for (int n=0;n<COL_SIZE;n++) entries[n].ScaleToFit();
    }
void WIMSchem.CatalogWindow.componentShown ( ComponentEvent  e) [inline]

Definition at line 217 of file CatalogWindow.java.

{}
void WIMSchem.CatalogWindow.DirtyChanged ( boolean  isdirty) [inline]

Implements WIMSchem.MolSelectListener.

Definition at line 198 of file CatalogWindow.java.

{}
void WIMSchem.CatalogWindow.MolSelected ( EditorPane  source,
int  idx,
boolean  dblclick 
) [inline]

Implements WIMSchem.MolSelectListener.

Definition at line 181 of file CatalogWindow.java.

    {
       int entnum=-1;
       for (int n=0;n<COL_SIZE;n++) if (source==entries[n]) {entnum=n; break;}
       if (entnum>=0)
       {
           selnum=basepos+entnum;
           for (int n=0;n<COL_SIZE;n++) 
           {
              entries[n].setBackground(n==entnum ? highl : bckgr);
              entries[n].repaint();
           }
           
           if (idx!=0) OpenMolecule(selnum);
       }
       
    }

Here is the call graph for this function:

synchronized void WIMSchem.CatalogWindow.OpenMolecule ( int  N) [inline, package]

Definition at line 167 of file CatalogWindow.java.

    {
       try
       {
           Molecule mol=loader.Get(N);
           MainWindow mw=new MainWindow(null,false,null);
           mw.MainPanel().SetMolecule(mol);
           mw.setVisible(true);
       }
       catch (Exception e) {e.printStackTrace();}
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void WIMSchem.CatalogWindow.Synch ( int  Sz) [inline]

Definition at line 129 of file CatalogWindow.java.

    {
       scroll.setMaximum(Sz);
       scroll.setVisibleAmount(COL_SIZE);
       scroll.setUnitIncrement(1);
       scroll.setBlockIncrement(COL_SIZE);
       
       if (basepos+5>=Sz || highestUpdated<=COL_SIZE) UpdatePosition(basepos);
       highestUpdated=Sz;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void WIMSchem.CatalogWindow.UpdatePosition ( int  NewPos) [inline, package]

Definition at line 140 of file CatalogWindow.java.

    {
       // NB: should speed this up sometime by re-using molecules that are already loaded
    
       basepos=NewPos;
       try
       {
           for (int n=0;n<COL_SIZE;n++)
           {
              if (basepos+n>=loader.Count()) 
              {
                  entries[n].setBackground(bckgr);
                  entries[n].Clear();
              }
              else
              {
                  Molecule mol=loader.Get(basepos+n);
                  entries[n].setBackground(basepos+n==selnum ? highl : bckgr);
                  entries[n].Replace(mol,true,false);
                  entries[n].ScaleToFit();
                  entries[n].repaint();
              }
           }
       }
       catch (Exception e) {e.printStackTrace();}
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void WIMSchem.CatalogWindow.windowActivated ( WindowEvent  e) [inline]

Definition at line 228 of file CatalogWindow.java.

{}
void WIMSchem.CatalogWindow.windowClosed ( WindowEvent  e) [inline]

Definition at line 229 of file CatalogWindow.java.

{loader.Zap();}

Here is the call graph for this function:

void WIMSchem.CatalogWindow.windowClosing ( WindowEvent  e) [inline]

Definition at line 230 of file CatalogWindow.java.

{}
void WIMSchem.CatalogWindow.windowDeactivated ( WindowEvent  e) [inline]

Definition at line 231 of file CatalogWindow.java.

{}
void WIMSchem.CatalogWindow.windowDeiconified ( WindowEvent  e) [inline]

Definition at line 232 of file CatalogWindow.java.

{}
void WIMSchem.CatalogWindow.windowIconified ( WindowEvent  e) [inline]

Definition at line 233 of file CatalogWindow.java.

{}
void WIMSchem.CatalogWindow.windowOpened ( WindowEvent  e) [inline]

Definition at line 234 of file CatalogWindow.java.

{}

Member Data Documentation

int WIMSchem.CatalogWindow.basepos = 0 [package]

Definition at line 31 of file CatalogWindow.java.

Definition at line 33 of file CatalogWindow.java.

JButton WIMSchem.CatalogWindow.bclose [package]

Definition at line 36 of file CatalogWindow.java.

JButton WIMSchem.CatalogWindow.bopen [package]

Definition at line 36 of file CatalogWindow.java.

String WIMSchem.CatalogWindow.catFN [package]

Definition at line 27 of file CatalogWindow.java.

final int WIMSchem.CatalogWindow.COL_SIZE = 5 [package]

Definition at line 30 of file CatalogWindow.java.

Definition at line 37 of file CatalogWindow.java.

Definition at line 31 of file CatalogWindow.java.

Definition at line 33 of file CatalogWindow.java.

FileInputStream WIMSchem.CatalogWindow.istr = null [package]

Definition at line 28 of file CatalogWindow.java.

Definition at line 39 of file CatalogWindow.java.

JScrollBar WIMSchem.CatalogWindow.scroll [package]

Definition at line 35 of file CatalogWindow.java.

int WIMSchem.CatalogWindow.selnum = -1 [package]

Definition at line 31 of file CatalogWindow.java.


The documentation for this class was generated from the following file: