Changeset 7410

Show
Ignore:
Timestamp:
05/01/08 10:05:46 (5 years ago)
Author:
Snyder.Jason
Message:

overloaded constructor to take a component, added a TreeViewer? to the transmittingPortsTree

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/jsnyder/ComponentProject/src/edu/vt/ossie/dialogs/ConnectDialog.java

    r7384 r7410  
    22 
    33import org.eclipse.jface.dialogs.Dialog; 
     4import org.eclipse.jface.viewers.TreeViewer; 
    45import org.eclipse.swt.SWT; 
    56import org.eclipse.swt.layout.FormData; 
     
    1718import org.eclipse.swt.widgets.Tree; 
    1819 
     20import edu.vt.ossie.views.ResourceTreeContentProvider; 
     21import edu.vt.ossie.views.ResourceTreeLabelProvider; 
     22import edu.vt.ossie.wavedev.Component; 
     23 
     24 
     25/** 
     26* This code was edited or generated using CloudGarden's Jigloo 
     27* SWT/Swing GUI Builder, which is free for non-commercial 
     28* use. If Jigloo is being used commercially (ie, by a corporation, 
     29* company or business for any purpose whatever) then you 
     30* should purchase a license for each developer using Jigloo. 
     31* Please visit www.cloudgarden.com for details. 
     32* Use of Jigloo implies acceptance of these licensing terms. 
     33* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR 
     34* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED 
     35* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE. 
     36*/ 
    1937public class ConnectDialog extends Dialog 
    2038{ 
     
    3351        private Label connectionsLabel; 
    3452        private Text connectionsBox; 
     53        private Component component; 
     54        private TreeViewer transmitterPortsTreeViewer; 
    3555 
    36         protected ConnectDialog(Shell parentShell)  
     56        protected ConnectDialog(Shell parentShell, Component comp)  
    3757        { 
    3858                super(parentShell); 
     59                component = comp; 
    3960                // TODO Auto-generated constructor stub 
     61        } 
     62        protected ConnectDialog(Shell parentShell) 
     63        { 
     64                super(parentShell); 
    4065        } 
    4166         
     
    5479                availablePortsLabel = new Label(comp, SWT.NONE); 
    5580                availablePortsLabel.setText("Available ports to connect to:"); 
    56                 availablePortsLabel.setBounds(379, 10, 167, 30); 
     81                availablePortsLabel.setBounds(350, 10, 196, 30); 
    5782                //END <<  availablePortsLabel 
    5883                //START >>  transmitterPortsTree 
    5984                transmitterPortsTree = new Tree(comp, SWT.NONE); 
    60                 transmitterPortsTree.setBounds(12, 38, 157, 226); 
     85                transmitterPortsTree.setBounds(12, 38, 177, 226); 
     86                if(component != null) 
     87                { 
     88                        transmitterPortsTreeViewer = new TreeViewer(transmitterPortsTree); 
     89                        transmitterPortsTreeViewer.setContentProvider(new ResourceTreeContentProvider()); 
     90                        transmitterPortsTreeViewer.setLabelProvider(new ResourceTreeLabelProvider()); 
     91                        transmitterPortsTreeViewer.setInput(component); 
     92                } 
    6193                //END <<  transmitterPortsTree 
    6294                //START >>  availablePortsTree 
    6395                availablePortsTree = new Tree(comp, SWT.NONE); 
    64                 availablePortsTree.setBounds(379, 38, 169, 226); 
     96                availablePortsTree.setBounds(350, 38, 198, 226); 
    6597                //END <<  availablePortsTree 
    6698                //START >>  connectButton 
    6799                connectButton = new Button(comp, SWT.PUSH | SWT.CENTER); 
    68100                connectButton.setText("Connect"); 
    69                 connectButton.setBounds(225, 116, 82, 30); 
     101                connectButton.setBounds(213, 116, 107, 30); 
    70102                //END <<  connectButton 
    71103                //START >>  legend 
     
    113145        public static void main(String[] args) 
    114146        { 
     147                System.out.println("here"); 
    115148                Display display = new Display(); 
    116149                Shell shell = new Shell(display); 
    117                 ConnectDialog dlg = new ConnectDialog(shell); 
    118                 dlg.open(); 
     150                try 
     151                { 
     152                        ConnectDialog dlg = new ConnectDialog(shell); 
     153                 
     154                        dlg.open(); 
     155                } 
     156                catch(Exception e) 
     157                { 
     158                        e.printStackTrace(); 
     159                } 
    119160                 
    120161                while (!shell.isDisposed()) {