Changeset 7712

Show
Ignore:
Timestamp:
06/01/08 16:29:46 (5 years ago)
Author:
Snyder.Jason
Message:

made properties table work with SimpleSequenceProperties?

Files:
1 modified

Legend:

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

    r7711 r7712  
    319319            new GridData(GridData.FILL, GridData.FILL, true, true)); 
    320320 
    321         Table propertiesTable = new Table(propertiesGroup, 
     321        final Table propertiesTable = new Table(propertiesGroup, 
    322322            SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL 
    323323            | SWT.FULL_SELECTION | SWT.HIDE_SELECTION); 
    324324        propertiesTable.setLayoutData( 
    325325            new GridData(GridData.FILL, GridData.FILL, true, true)); 
    326         ((GridData)propertiesTable.getLayoutData()).horizontalSpan = 2; 
     326        ((GridData)propertiesTable.getLayoutData()).horizontalSpan = 3; 
    327327        propertiesTable.setLinesVisible(true); 
    328328        propertiesTable.setHeaderVisible(true); 
     
    335335            new TableViewerColumn(tableViewer, SWT.LEFT); 
    336336        propertiesColumn.getColumn().setText(COLUMN_NAMES[0]); 
    337         propertiesColumn.getColumn().setWidth(100); 
     337        propertiesColumn.getColumn().setWidth(200); 
    338338        propertiesColumn.setLabelProvider(new ColumnLabelProvider() 
    339339        { 
    340340            public String getText(Object element) 
    341341            { 
    342                 return ((SimpleProperty)element).getName(); 
     342                return ((Property)element).getName(); 
    343343            } 
    344344        }); 
     
    350350        defaultValuesColumn.setLabelProvider(new ColumnLabelProvider() 
    351351        { 
    352             public String getText(Object element) 
    353             { 
    354                 return ((SimpleProperty)element).getDefaultValue(); 
     352                public String getText(Object element) 
     353            { 
     354                String result = ""; 
     355 
     356                if (element instanceof SimpleSequenceProperty) 
     357                { 
     358                     result = ((SimpleSequenceProperty)element) 
     359                         .getDefaultValues().toString(); 
     360                } 
     361                else if (element instanceof SimpleProperty) 
     362                { 
     363                    result = ((SimpleProperty)element).getDefaultValue(); 
     364                } 
     365                return result; 
    355366            } 
    356367        }); 
     
    362373        valuesColumn.setLabelProvider(new ColumnLabelProvider() 
    363374        { 
    364             public String getText(Object element) 
    365             { 
    366                 return ((SimpleProperty)element).getValue(); 
     375                public String getText(Object element) 
     376            { 
     377                String result = ""; 
     378                if (element instanceof SimpleProperty) 
     379                { 
     380                    result = ((SimpleProperty)element).getValue(); 
     381                } 
     382                else if (element instanceof SimpleSequenceProperty) 
     383                { 
     384                    result = ((SimpleSequenceProperty)element) 
     385                        .getValues().toString(); 
     386                } 
     387                return result; 
    367388            } 
    368389        }); 
     
    372393            protected boolean canEdit(Object element) 
    373394            { 
    374                 return element instanceof SimpleProperty; 
     395                return element instanceof SimpleProperty 
     396                        || element instanceof SimpleSequenceProperty; 
    375397            } 
    376398 
     
    384406            protected Object getValue(Object element) 
    385407            { 
    386                 return ((SimpleProperty)element).getValue(); 
     408                Object result = null; 
     409 
     410                if (element instanceof SimpleProperty) 
     411                { 
     412                    result = ((SimpleProperty)element).getValue(); 
     413                } 
     414                else if (element instanceof SimpleSequenceProperty) 
     415                { 
     416                    result = ((SimpleSequenceProperty)element).getValues(); 
     417                } 
     418                return result; 
    387419            } 
    388420 
     
    390422            protected void setValue(Object element, Object value) 
    391423            { 
    392                 ((SimpleProperty)element).setValue( 
    393                     Integer.parseInt((String)value)); 
     424                if (element instanceof SimpleProperty) 
     425                { 
     426                    ((SimpleProperty)element).setValue( 
     427                        Integer.parseInt((String)value)); 
     428                } 
     429                else if (element instanceof SimpleSequenceProperty) 
     430                { 
     431                    ((SimpleSequenceProperty)element).setValues(); 
     432                } 
    394433                getViewer().update(element, null); 
     434                 
    395435            } 
    396436 
    397437            private CellEditor editor = 
    398                 new TextCellEditor(tableViewer.getTable()); 
     438                new TextCellEditor(propertiesTable); 
    399439        }); 
    400440 
     
    402442 
    403443        tableViewer.setInput(component); 
     444        tableViewer.refresh(); 
    404445 
    405446        addPropertyButton = new Button(propertiesGroup, SWT.PUSH | SWT.CENTER); 
     
    420461                log.debug(component.getProperties()); 
    421462                pDlg.open(); 
     463                log.debug(component.getProperties()); 
     464                tableViewer.refresh(); 
    422465            } 
    423466        }); 
     
    921964    private static final String[] COLUMN_NAMES = new String[] 
    922965    { 
    923         "Properties", 
    924         "Values", 
    925         "DefaultValues" 
     966        "Property", 
     967        "Value", 
     968        "Default Value" 
    926969    }; 
    927970