Changeset 7652
- Timestamp:
- 05/29/08 09:06:52 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
ossiedev/branches/jsnyder/ComponentProject/src/edu/vt/ossie/editors/ComponentEditor.java
r7643 r7652 65 65 implements IReusableEditor 66 66 { 67 68 69 70 71 72 73 67 //~ Constructor ........................................................... 74 68 … … 171 165 descriptionGroup.setLayoutData(group2LData); 172 166 { 173 componentNameLabel = new Label(descriptionGroup, SWT.NONE);167 Label componentNameLabel = new Label(descriptionGroup, SWT.NONE); 174 168 componentNameLabel.setText("Name"); 175 169 } … … 178 172 } 179 173 { 180 descriptionLabel = new Label(descriptionGroup, SWT.NONE);174 Label descriptionLabel = new Label(descriptionGroup, SWT.NONE); 181 175 descriptionLabel.setText("Description"); 182 176 } 183 177 { 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); 185 180 // descriptionInputField.setBounds(104, 62, 137, 60); 186 181 GridData descriptionInputFieldLData = new GridData(); … … 208 203 configurationGroup.setText("Generation Options"); 209 204 //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)); 211 207 { 212 208 Label templateLabel = new Label(configurationGroup, SWT.NONE); … … 220 216 } 221 217 { 222 timingPortSupportCheckBox = new Button(configurationGroup, SWT.CHECK | SWT.LEFT); 218 timingPortSupportCheckBox = new Button( 219 configurationGroup, SWT.CHECK | SWT.LEFT); 223 220 timingPortSupportCheckBox.setText("Timing Port Support"); 224 221 timingPortSupportCheckBox.setBounds(7, 78, 168, 21); … … 226 223 } 227 224 { 228 ACESupportCheckBox = new Button(configurationGroup, SWT.CHECK | SWT.LEFT); 225 ACESupportCheckBox = new Button( 226 configurationGroup, SWT.CHECK | SWT.LEFT); 229 227 ACESupportCheckBox.setText("ACE Support"); 230 228 ACESupportCheckBox.setBounds(7, 104, 113, 21); … … 232 230 } 233 231 } 234 232 235 233 portsGroup = new Group(mainWindow, SWT.NONE); 236 234 237 235 portsGroup.setText("Ports"); 238 236 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)); 240 239 241 240 GridData portsGroupData = new GridData(); … … 250 249 portsTreeViewer.setContentProvider(new ContentProvider()); 251 250 portsTreeViewer.setLabelProvider(new LabelProvider()); 252 251 253 252 254 253 addPortButton = new Button(portsGroup, SWT.PUSH | SWT.CENTER); … … 258 257 addPortButton.addSelectionListener(new SelectionListener() 259 258 { 260 261 259 public void widgetDefaultSelected(SelectionEvent e) 262 260 { 263 // TODO Auto-generated method stub 264 261 // not used 265 262 } 266 263 … … 268 265 { 269 266 AddPortDialog apd = new AddPortDialog(null); 270 apd.open(); 271 } 272 267 apd.open(); 268 } 273 269 }); 274 270 275 271 removePortButton = new Button(portsGroup, SWT.PUSH | SWT.CENTER); 276 272 removePortButton.setText("Remove Port"); … … 279 275 propertiesGroup = new Group(mainWindow, SWT.NONE); 280 276 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 283 280 GridData propertiesGroupData = new GridData(); 284 281 propertiesGroupData.widthHint = 250; … … 286 283 propertiesGroupData.grabExcessHorizontalSpace = true; 287 284 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); 291 289 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); 300 298 tableViewer.setColumnProperties(columnNames); 301 299 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); 317 317 defaultValuesColumn.setLabelProvider(new ColumnLabelProvider() 318 318 { … … 322 322 } 323 323 }); 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); 328 329 valuesColumn.setLabelProvider(new ColumnLabelProvider() 329 330 { … … 333 334 } 334 335 }); 335 valuesColumn.setEditingSupport(new EditingSupport(tableViewer) { 336 @Override337 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 @Override357 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 371 372 propertiesTable.setBounds(1, 16, 250, 175); 372 373 373 374 addPropertyButton = new Button(propertiesGroup, SWT.PUSH | SWT.CENTER); 374 375 addPropertyButton.setText("Add Property"); … … 376 377 addPropertyButton.addSelectionListener(new SelectionListener() 377 378 { 378 379 379 public void widgetDefaultSelected(SelectionEvent e) 380 380 { 381 // TODO Auto-generated method stub 382 381 // not used 383 382 } 384 383 … … 389 388 log.debug(component.getProperties()); 390 389 pDlg.open(); 391 392 } 393 390 } 394 391 }); 395 396 removePropertyButton = new Button(propertiesGroup, SWT.PUSH | SWT.CENTER); 392 393 removePropertyButton = 394 new Button(propertiesGroup, SWT.PUSH | SWT.CENTER); 397 395 removePropertyButton.setText("Remove Property"); 398 396 removePropertyButton.setBounds(120, 190, 140, 30); 399 397 400 398 // { 401 399 //// Label componentNameLabel = new Label(mainWindow, SWT.NONE); 402 400 //// componentNameLabel.setText("Name:"); 403 401 //// // 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)); 405 404 // } 406 407 405 406 408 407 // { 409 408 // componentNameInputField = new Text(mainWindow, SWT.BORDER); … … 423 422 // }); 424 423 // } 425 424 426 425 427 426 // { … … 449 448 // } 450 449 // { 451 // assemblyControllerCheckBox = new Button(group2, SWT.CHECK | SWT.LEFT); 450 // assemblyControllerCheckBox = 451 // new Button(group2, SWT.CHECK | SWT.LEFT); 452 452 // assemblyControllerCheckBox.setText("Assembly Controller"); 453 453 // assemblyControllerCheckBox.setBounds(7, 103, 168, 21); … … 696 696 return str == null ? "" : str; 697 697 } 698 699 698 700 //~ Private Methods ....................................................... 699 701 … … 739 741 //~ Instance/static variables ............................................. 740 742 741 private Label descriptionLabel;742 743 private TableViewer tableViewer; 743 744 private Text descriptionInputField; 744 745 private Text componentNameInputField; 745 private Label componentBaseName;746 746 private Button ACESupportCheckBox; 747 747 private Button timingPortSupportCheckBox; … … 753 753 private static final Logger log = 754 754 OWDPlugin.getLogManager().getLogger(ComponentEditor.class); 755 private Label componentNameLabel;756 755 private Button addPortButton; 757 756 private Button removePortButton; … … 761 760 private Group descriptionGroup; 762 761 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 }; 767 771 }