Changeset 7652

Show
Ignore:
Timestamp:
05/29/08 09:06:52 (5 years ago)
Author:
stedwar2
Message:

Minor layout fixups.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/jsnyder/ComponentProject/src/edu/vt/ossie/editors/ComponentEditor.java

    r7643 r7652  
    6565    implements IReusableEditor 
    6666{ 
    67     
    68  
    69  
    70          
    71  
    72  
    7367    //~ Constructor ........................................................... 
    7468 
     
    171165        descriptionGroup.setLayoutData(group2LData); 
    172166        { 
    173             componentNameLabel = new Label(descriptionGroup, SWT.NONE); 
     167            Label componentNameLabel = new Label(descriptionGroup, SWT.NONE); 
    174168            componentNameLabel.setText("Name"); 
    175169        } 
     
    178172        } 
    179173        { 
    180             descriptionLabel = new Label(descriptionGroup, SWT.NONE); 
     174            Label descriptionLabel = new Label(descriptionGroup, SWT.NONE); 
    181175            descriptionLabel.setText("Description"); 
    182176        } 
    183177        { 
    184             descriptionInputField = new Text(descriptionGroup, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL); 
     178            descriptionInputField = new Text( 
     179                descriptionGroup, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL); 
    185180            // descriptionInputField.setBounds(104, 62, 137, 60); 
    186181            GridData descriptionInputFieldLData = new GridData(); 
     
    208203            configurationGroup.setText("Generation Options"); 
    209204            //group1.setBounds(554, 15, 270, 150); 
    210             configurationGroup.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, false)); 
     205            configurationGroup.setLayoutData( 
     206                new GridData(SWT.LEFT, SWT.BOTTOM, true, false)); 
    211207            { 
    212208                Label templateLabel = new Label(configurationGroup, SWT.NONE); 
     
    220216            } 
    221217            { 
    222                 timingPortSupportCheckBox = new Button(configurationGroup, SWT.CHECK | SWT.LEFT); 
     218                timingPortSupportCheckBox = new Button( 
     219                    configurationGroup, SWT.CHECK | SWT.LEFT); 
    223220                timingPortSupportCheckBox.setText("Timing Port Support"); 
    224221                timingPortSupportCheckBox.setBounds(7, 78, 168, 21); 
     
    226223            } 
    227224            { 
    228                 ACESupportCheckBox = new Button(configurationGroup, SWT.CHECK | SWT.LEFT); 
     225                ACESupportCheckBox = new Button( 
     226                    configurationGroup, SWT.CHECK | SWT.LEFT); 
    229227                ACESupportCheckBox.setText("ACE Support"); 
    230228                ACESupportCheckBox.setBounds(7, 104, 113, 21); 
     
    232230            } 
    233231        } 
    234          
     232 
    235233        portsGroup = new Group(mainWindow, SWT.NONE); 
    236          
     234 
    237235        portsGroup.setText("Ports"); 
    238236        portsGroup.setLayout(null); 
    239         portsGroup.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, false)); 
     237        portsGroup.setLayoutData( 
     238            new GridData(SWT.LEFT, SWT.BOTTOM, true, false)); 
    240239 
    241240        GridData portsGroupData = new GridData(); 
     
    250249        portsTreeViewer.setContentProvider(new ContentProvider()); 
    251250        portsTreeViewer.setLabelProvider(new LabelProvider()); 
    252          
     251 
    253252 
    254253        addPortButton = new Button(portsGroup, SWT.PUSH | SWT.CENTER); 
     
    258257        addPortButton.addSelectionListener(new SelectionListener() 
    259258        { 
    260  
    261259            public void widgetDefaultSelected(SelectionEvent e) 
    262260            { 
    263                 // TODO Auto-generated method stub 
    264                  
     261                // not used 
    265262            } 
    266263 
     
    268265            { 
    269266                AddPortDialog apd = new AddPortDialog(null); 
    270                 apd.open();    
    271             } 
    272              
     267                apd.open(); 
     268            } 
    273269        }); 
    274          
     270 
    275271        removePortButton = new Button(portsGroup, SWT.PUSH | SWT.CENTER); 
    276272        removePortButton.setText("Remove Port"); 
     
    279275        propertiesGroup = new Group(mainWindow, SWT.NONE); 
    280276        propertiesGroup.setText("Properties"); 
    281         propertiesGroup.setLayoutData(new GridData(SWT.CENTER, SWT.BOTTOM, true, false)); 
    282          
     277        propertiesGroup.setLayoutData( 
     278            new GridData(SWT.CENTER, SWT.BOTTOM, true, false)); 
     279 
    283280        GridData propertiesGroupData = new GridData(); 
    284281        propertiesGroupData.widthHint = 250; 
     
    286283        propertiesGroupData.grabExcessHorizontalSpace = true; 
    287284        propertiesGroup.setLayoutData(propertiesGroupData); 
    288          
    289         propertiesTable = new Table(propertiesGroup, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | 
    290                         SWT.FULL_SELECTION | SWT.HIDE_SELECTION); 
     285 
     286        propertiesTable = new Table(propertiesGroup, 
     287            SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL 
     288            | SWT.FULL_SELECTION | SWT.HIDE_SELECTION); 
    291289        GridData gridData = new GridData(GridData.FILL_BOTH); 
    292                 gridData.grabExcessVerticalSpace = true; 
    293                 gridData.horizontalSpan = 3; 
    294                 propertiesTable.setLayoutData(gridData); 
    295  
    296                 propertiesTable.setLinesVisible(true); 
    297                 propertiesTable.setHeaderVisible(true); 
    298                  
    299                 tableViewer = new TableViewer(propertiesTable); 
     290        gridData.grabExcessVerticalSpace = true; 
     291        gridData.horizontalSpan = 3; 
     292        propertiesTable.setLayoutData(gridData); 
     293 
     294        propertiesTable.setLinesVisible(true); 
     295        propertiesTable.setHeaderVisible(true); 
     296 
     297        tableViewer = new TableViewer(propertiesTable); 
    300298        tableViewer.setColumnProperties(columnNames); 
    301299        tableViewer.setContentProvider(new TableContentProvider()); 
    302          
    303         TableViewerColumn propertiesColumn = new TableViewerColumn(tableViewer, SWT.LEFT); 
    304                 propertiesColumn.getColumn().setText(columnNames[0]); 
    305                 propertiesColumn.getColumn().setWidth(100); 
    306                 propertiesColumn.setLabelProvider(new ColumnLabelProvider() 
    307                 { 
    308                     public String getText(Object element) 
    309                     { 
    310                         return ((SimpleProperty)element).getName(); 
    311                     } 
    312             }); 
    313                  
    314                 TableViewerColumn defaultValuesColumn = new TableViewerColumn(tableViewer, SWT.RIGHT); 
    315                 defaultValuesColumn.getColumn().setText(columnNames[2]); 
    316                 defaultValuesColumn.getColumn().setWidth(90); 
     300 
     301        TableViewerColumn propertiesColumn = 
     302            new TableViewerColumn(tableViewer, SWT.LEFT); 
     303        propertiesColumn.getColumn().setText(columnNames[0]); 
     304        propertiesColumn.getColumn().setWidth(100); 
     305        propertiesColumn.setLabelProvider(new ColumnLabelProvider() 
     306        { 
     307            public String getText(Object element) 
     308            { 
     309                return ((SimpleProperty)element).getName(); 
     310            } 
     311        }); 
     312 
     313        TableViewerColumn defaultValuesColumn = 
     314            new TableViewerColumn(tableViewer, SWT.RIGHT); 
     315        defaultValuesColumn.getColumn().setText(columnNames[2]); 
     316        defaultValuesColumn.getColumn().setWidth(90); 
    317317        defaultValuesColumn.setLabelProvider(new ColumnLabelProvider() 
    318318        { 
     
    322322            } 
    323323        }); 
    324                  
    325                 TableViewerColumn valuesColumn = new TableViewerColumn(tableViewer, SWT.RIGHT); 
    326                 valuesColumn.getColumn().setText(columnNames[1]); 
    327                 valuesColumn.getColumn().setWidth(50); 
     324 
     325        TableViewerColumn valuesColumn = 
     326            new TableViewerColumn(tableViewer, SWT.RIGHT); 
     327        valuesColumn.getColumn().setText(columnNames[1]); 
     328        valuesColumn.getColumn().setWidth(50); 
    328329        valuesColumn.setLabelProvider(new ColumnLabelProvider() 
    329330        { 
     
    333334            } 
    334335        }); 
    335                  valuesColumn.setEditingSupport(new EditingSupport(tableViewer) { 
    336            @Override 
    337            protected boolean canEdit(Object element) 
    338            { 
    339                return element instanceof SimpleProperty; 
    340            } 
    341  
    342            @Override 
    343            protected CellEditor getCellEditor(Object element) 
    344            { 
    345                return editor; 
    346            } 
    347  
    348            @Override 
    349            protected Object getValue(Object element) 
    350            { 
    351                 
    352                return ((SimpleProperty)element).getValue(); 
    353                 
    354            } 
    355  
    356            @Override 
    357            protected void setValue(Object element, Object value) 
    358            { 
    359                ((SimpleProperty)element).setValue( 
    360                    Integer.parseInt((String)value)); 
    361                getViewer().update(element, null); 
    362            } 
    363  
    364            private CellEditor editor = new TextCellEditor(tableViewer.getTable()); 
    365                 }); 
    366                   
    367                  
    368  
    369                 tableViewer.setInput(component); 
    370                   
     336        valuesColumn.setEditingSupport(new EditingSupport(tableViewer) 
     337        { 
     338            @Override 
     339            protected boolean canEdit(Object element) 
     340            { 
     341                return element instanceof SimpleProperty; 
     342            } 
     343 
     344            @Override 
     345            protected CellEditor getCellEditor(Object element) 
     346            { 
     347                return editor; 
     348            } 
     349 
     350            @Override 
     351            protected Object getValue(Object element) 
     352            { 
     353                return ((SimpleProperty)element).getValue(); 
     354            } 
     355 
     356            @Override 
     357            protected void setValue(Object element, Object value) 
     358            { 
     359                ((SimpleProperty)element).setValue( 
     360                    Integer.parseInt((String)value)); 
     361                getViewer().update(element, null); 
     362            } 
     363 
     364            private CellEditor editor = 
     365               new TextCellEditor(tableViewer.getTable()); 
     366        }); 
     367 
     368 
     369 
     370        tableViewer.setInput(component); 
     371 
    371372        propertiesTable.setBounds(1, 16, 250, 175); 
    372          
     373 
    373374        addPropertyButton = new Button(propertiesGroup, SWT.PUSH | SWT.CENTER); 
    374375        addPropertyButton.setText("Add Property"); 
     
    376377        addPropertyButton.addSelectionListener(new SelectionListener() 
    377378        { 
    378  
    379379            public void widgetDefaultSelected(SelectionEvent e) 
    380380            { 
    381                 // TODO Auto-generated method stub 
    382                  
     381                // not used 
    383382            } 
    384383 
     
    389388                log.debug(component.getProperties()); 
    390389                pDlg.open(); 
    391                  
    392             } 
    393              
     390            } 
    394391        }); 
    395          
    396         removePropertyButton = new Button(propertiesGroup, SWT.PUSH | SWT.CENTER); 
     392 
     393        removePropertyButton = 
     394            new Button(propertiesGroup, SWT.PUSH | SWT.CENTER); 
    397395        removePropertyButton.setText("Remove Property"); 
    398396        removePropertyButton.setBounds(120, 190, 140, 30); 
    399          
     397 
    400398//        { 
    401399////            Label componentNameLabel = new Label(mainWindow, SWT.NONE); 
    402400////            componentNameLabel.setText("Name:"); 
    403401////          //  componentNameLabel.setBounds(12, 12, 92, 19); 
    404 //            componentNameLabel.setLayoutData(new GridData(SWT.CENTER, SWT.BOTTOM, true, false)); 
     402//            componentNameLabel.setLayoutData(new GridData( 
     403//                SWT.CENTER, SWT.BOTTOM, true, false)); 
    405404//        } 
    406          
    407         
     405 
     406 
    408407//        { 
    409408//            componentNameInputField = new Text(mainWindow, SWT.BORDER); 
     
    423422//            }); 
    424423//        } 
    425          
     424 
    426425 
    427426//        { 
     
    449448//            } 
    450449//            { 
    451 //                assemblyControllerCheckBox = new Button(group2, SWT.CHECK | SWT.LEFT); 
     450//                assemblyControllerCheckBox = 
     451//                    new Button(group2, SWT.CHECK | SWT.LEFT); 
    452452//                assemblyControllerCheckBox.setText("Assembly Controller"); 
    453453//                assemblyControllerCheckBox.setBounds(7, 103, 168, 21); 
     
    696696        return str == null ? "" : str; 
    697697    } 
     698 
     699 
    698700    //~ Private Methods ....................................................... 
    699701 
     
    739741    //~ Instance/static variables ............................................. 
    740742 
    741     private Label descriptionLabel; 
    742743    private TableViewer tableViewer; 
    743744    private Text   descriptionInputField; 
    744745    private Text   componentNameInputField; 
    745     private Label  componentBaseName; 
    746746    private Button ACESupportCheckBox; 
    747747    private Button timingPortSupportCheckBox; 
     
    753753    private static final Logger log = 
    754754        OWDPlugin.getLogManager().getLogger(ComponentEditor.class); 
    755     private Label componentNameLabel; 
    756755    private Button addPortButton; 
    757756    private Button removePortButton; 
     
    761760    private Group descriptionGroup; 
    762761    private Group portsGroup; 
    763         private Group propertiesGroup; 
    764         private Table propertiesTable; 
    765         private TreeViewer portsTreeViewer; 
    766         private String[] columnNames = new String[] {"Properties", "Values", "DefaultValues"}; 
     762    private Group propertiesGroup; 
     763    private Table propertiesTable; 
     764    private TreeViewer portsTreeViewer; 
     765    private String[] columnNames = new String[] 
     766    { 
     767        "Properties", 
     768        "Values", 
     769        "DefaultValues" 
     770    }; 
    767771}