001/***************************************************************************** 002 * Copyright by The HDF Group. * 003 * Copyright by the Board of Trustees of the University of Illinois. * 004 * All rights reserved. * 005 * * 006 * This file is part of the HDF Java Products distribution. * 007 * The full copyright notice, including terms governing use, modification, * 008 * and redistribution, is contained in the COPYING file, which can be found * 009 * at the root of the source code distribution tree, * 010 * or in https://www.hdfgroup.org/licenses. * 011 * If you do not have access to either file, you may request a copy from * 012 * help@hdfgroup.org. * 013 ****************************************************************************/ 014 015package hdf.view.dialog; 016 017import java.awt.GraphicsEnvironment; 018import java.io.File; 019 020import hdf.view.Tools; 021import hdf.view.ViewProperties; 022 023import org.slf4j.Logger; 024import org.slf4j.LoggerFactory; 025 026import org.eclipse.swt.SWT; 027import org.eclipse.swt.events.SelectionAdapter; 028import org.eclipse.swt.events.SelectionEvent; 029import org.eclipse.swt.graphics.Font; 030import org.eclipse.swt.layout.GridData; 031import org.eclipse.swt.layout.GridLayout; 032import org.eclipse.swt.widgets.Button; 033import org.eclipse.swt.widgets.Combo; 034import org.eclipse.swt.widgets.Composite; 035import org.eclipse.swt.widgets.Control; 036import org.eclipse.swt.widgets.DirectoryDialog; 037import org.eclipse.swt.widgets.Display; 038import org.eclipse.swt.widgets.FileDialog; 039import org.eclipse.swt.widgets.Label; 040import org.eclipse.swt.widgets.Text; 041 042/** 043 * UserOptionsGeneralPage.java - Configuration page for general application settings. 044 */ 045public class UserOptionsGeneralPage extends UserOptionsDefaultPage { 046 private static final Logger log = LoggerFactory.getLogger(UserOptionsGeneralPage.class); 047 048 private Text UGField, workField, maxMemberField, startMemberField, timerRefreshField; 049 050 private Combo fontSizeChoice, fontTypeChoice, delimiterChoice, imageOriginChoice, indexBaseChoice; 051 052 private Button checkCurrentUserDir, checkUserHomeDir, checkAutoContrast, checkShowValues; 053 private Button currentDirButton, userHomeButton, rwButton, helpButton; 054 private Button checkReadOnly, checkReadAll; 055 056 private boolean isFontChanged; 057 private boolean isUserGuideChanged; 058 private boolean isWorkDirChanged; 059 060 private String workDir; 061 062 private static String fontname; 063 064 /** 065 * Configuration page for general application settings. 066 */ 067 public UserOptionsGeneralPage() 068 { 069 super("General Settings"); 070 isFontChanged = false; 071 isUserGuideChanged = false; 072 isWorkDirChanged = false; 073 } 074 075 /** 076 * Performs special processing when this page's Defaults button has been pressed. 077 */ 078 @Override 079 public void performDefaults() 080 { 081 super.performDefaults(); 082 } 083 084 /** 085 * Notifies that the OK button of this page's container has been pressed. 086 * 087 * @return <code>false</code> to abort the container's OK processing and 088 * <code>true</code> to allow the OK to happen 089 */ 090 @Override 091 public boolean performOk() 092 { 093 getPreferenceStore(); 094 095 if (UGField != null) { 096 String UGPath = UGField.getText(); 097 if ((UGPath != null) && (UGPath.length() > 0)) { 098 UGPath = UGPath.trim(); 099 isUserGuideChanged = !UGPath.equals(ViewProperties.getUsersGuide()); 100 ViewProperties.setUsersGuide(UGPath); 101 } 102 } 103 104 if (workField != null) { 105 String workPath = workField.getText(); 106 if (checkCurrentUserDir.getSelection()) 107 workPath = System.getProperty("user.dir"); 108 else if (checkUserHomeDir.getSelection()) 109 workPath = System.getProperty("user.home"); 110 111 if ((workPath != null) && (workPath.length() > 0)) { 112 workPath = workPath.trim(); 113 isWorkDirChanged = !workPath.equals(ViewProperties.getWorkDir()); 114 ViewProperties.setWorkDir(workPath); 115 } 116 } 117 118 // set font size and type 119 try { 120 if (fontTypeChoice != null) { 121 String ftype = fontTypeChoice.getItem(fontTypeChoice.getSelectionIndex()); 122 int fsize = Integer.parseInt(fontSizeChoice.getItem(fontSizeChoice.getSelectionIndex())); 123 log.trace("performOk: save font options {} - {}", ftype, fsize); 124 125 if (ViewProperties.getFontSize() != fsize) { 126 ViewProperties.setFontSize(fsize); 127 isFontChanged = true; 128 log.trace("performOk: props font size {}", ViewProperties.getFontSize()); 129 } 130 131 if (!ftype.equalsIgnoreCase(ViewProperties.getFontType())) { 132 ViewProperties.setFontType(ftype); 133 isFontChanged = true; 134 log.trace("performOk: props font {}", ViewProperties.getFontType()); 135 } 136 } 137 } 138 catch (Exception ex) { 139 isFontChanged = false; 140 } 141 142 // set file access 143 if (checkReadOnly != null) { 144 if (checkReadOnly.getSelection()) 145 ViewProperties.setReadOnly(true); 146 else 147 ViewProperties.setReadOnly(false); 148 } 149 150 // set timer refresh value (msec) 151 try { 152 int timermsec = Integer.parseInt(timerRefreshField.getText()); 153 ViewProperties.setTimerRefresh(timermsec); 154 } 155 catch (Exception ex) { 156 } 157 158 // set data delimiter 159 if (delimiterChoice != null) 160 ViewProperties.setDataDelimiter(delimiterChoice.getItem(delimiterChoice.getSelectionIndex())); 161 if (imageOriginChoice != null) 162 ViewProperties.setImageOrigin(imageOriginChoice.getItem(imageOriginChoice.getSelectionIndex())); 163 164 if (checkReadAll != null) { 165 if (checkReadAll.getSelection()) { 166 ViewProperties.setStartMembers(0); 167 ViewProperties.setMaxMembers(-1); 168 } 169 else { 170 try { 171 int maxsize = Integer.parseInt(maxMemberField.getText()); 172 ViewProperties.setMaxMembers(maxsize); 173 } 174 catch (Exception ex) { 175 } 176 177 try { 178 int startsize = Integer.parseInt(startMemberField.getText()); 179 ViewProperties.setStartMembers(startsize); 180 } 181 catch (Exception ex) { 182 } 183 } 184 } 185 186 if (checkAutoContrast != null) 187 ViewProperties.setAutoContrast(checkAutoContrast.getSelection()); 188 if (checkShowValues != null) 189 ViewProperties.setShowImageValue(checkShowValues.getSelection()); 190 191 if (indexBaseChoice != null) { 192 if (indexBaseChoice.getSelectionIndex() == 0) 193 ViewProperties.setIndexBase1(false); 194 else 195 ViewProperties.setIndexBase1(true); 196 } 197 198 return true; 199 } 200 201 /** 202 * Checks if the Font setting changed. 203 * 204 * @return true if the font changed. 205 */ 206 public boolean isFontChanged() { return isFontChanged; } 207 208 /** 209 * Checks if the location for the UserGuide changed. 210 * 211 * @return true if the location of the UserGuide changed. 212 */ 213 public boolean isUserGuideChanged() { return isUserGuideChanged; } 214 215 /** 216 * Checks if the location of the WorkDir changed. 217 * 218 * @return true if the working directory changed. 219 */ 220 public boolean isWorkDirChanged() { return isWorkDirChanged; } 221 222 /** 223 * Loads all stored values in the <code>FieldEditor</code>s. 224 */ 225 protected void load() 226 { 227 getPreferenceStore(); 228 229 try { 230 curFont = new Font(Display.getCurrent(), ViewProperties.getFontType(), 231 ViewProperties.getFontSize(), SWT.NORMAL); 232 } 233 catch (Exception ex) { 234 curFont = null; 235 } 236 237 workDir = ViewProperties.getWorkDir(); 238 if (workDir == null) 239 workDir = rootDir; 240 241 workField.setText(workDir); 242 243 if (workDir.equals(System.getProperty("user.dir"))) { 244 checkCurrentUserDir.setSelection(true); 245 checkUserHomeDir.setSelection(false); 246 workField.setEnabled(false); 247 } 248 else if (workDir.equals(System.getProperty("user.home"))) { 249 checkCurrentUserDir.setSelection(false); 250 checkUserHomeDir.setSelection(true); 251 workField.setEnabled(false); 252 } 253 else { 254 checkCurrentUserDir.setSelection(false); 255 checkUserHomeDir.setSelection(false); 256 workField.setEnabled(true); 257 } 258 259 log.trace("UserOptionsGeneralPage: workDir={}", workDir); 260 261 UGField.setText(ViewProperties.getUsersGuide()); 262 263 checkReadOnly.setSelection(ViewProperties.isReadOnly()); 264 265 rwButton.setSelection(!ViewProperties.isReadOnly()); 266 267 String fontsize = String.valueOf(ViewProperties.getFontSize()); 268 log.trace("performOk: load General options fontsize={}", fontsize); 269 try { 270 int selectionIndex = fontSizeChoice.indexOf(fontsize); 271 fontSizeChoice.select(selectionIndex); 272 } 273 catch (Exception ex) { 274 fontSizeChoice.select(0); 275 } 276 277 fontname = ViewProperties.getFontType(); 278 log.trace("performOk: load General options fontname={}", fontname); 279 try { 280 int selectionIndex = fontTypeChoice.indexOf(fontname); 281 fontTypeChoice.select(selectionIndex); 282 } 283 catch (Exception ex) { 284 String sysFontName = Display.getDefault().getSystemFont().getFontData()[0].getName(); 285 286 try { 287 int selectionIndex = fontTypeChoice.indexOf(sysFontName); 288 fontTypeChoice.select(selectionIndex); 289 } 290 catch (Exception ex2) { 291 fontTypeChoice.select(0); 292 } 293 } 294 295 checkAutoContrast.setSelection(ViewProperties.isAutoContrast()); 296 297 checkShowValues.setSelection(ViewProperties.showImageValues()); 298 299 String[] imageOriginChoices = {ViewProperties.ORIGIN_UL, ViewProperties.ORIGIN_LL, 300 ViewProperties.ORIGIN_UR, ViewProperties.ORIGIN_LR}; 301 imageOriginChoice.setItems(imageOriginChoices); 302 303 try { 304 int selectionIndex = imageOriginChoice.indexOf(ViewProperties.getImageOrigin()); 305 imageOriginChoice.select(selectionIndex); 306 } 307 catch (Exception ex) { 308 imageOriginChoice.select(0); 309 } 310 311 // helpButton.setImage(ViewProperties.getHelpIcon()); 312 313 if (ViewProperties.isIndexBase1()) 314 indexBaseChoice.select(1); 315 else 316 indexBaseChoice.select(0); 317 318 String[] delimiterChoices = {ViewProperties.DELIMITER_TAB, ViewProperties.DELIMITER_COMMA, 319 ViewProperties.DELIMITER_SPACE, ViewProperties.DELIMITER_COLON, 320 ViewProperties.DELIMITER_SEMI_COLON}; 321 delimiterChoice.setItems(delimiterChoices); 322 323 try { 324 int selectionIndex = delimiterChoice.indexOf(ViewProperties.getDataDelimiter()); 325 delimiterChoice.select(selectionIndex); 326 } 327 catch (Exception ex) { 328 delimiterChoice.select(0); 329 } 330 331 timerRefreshField.setText(String.valueOf(ViewProperties.getTimerRefresh())); 332 333 int nMax = ViewProperties.getMaxMembers(); 334 checkReadAll.setSelection((nMax <= 0) || (nMax == Integer.MAX_VALUE)); 335 336 startMemberField.setText(String.valueOf(ViewProperties.getStartMembers())); 337 338 maxMemberField.setText(String.valueOf(ViewProperties.getMaxMembers())); 339 } 340 341 /** 342 * Creates and returns the SWT control for the customized body of this 343 * preference page under the given parent composite. 344 * 345 * @param parent 346 * the parent composite 347 * 348 * @return the new control 349 */ 350 @Override 351 protected Control createContents(Composite parent) 352 { 353 shell = parent.getShell(); 354 Composite composite = new Composite(parent, SWT.NONE); 355 composite.setLayout(new GridLayout()); 356 357 org.eclipse.swt.widgets.Group workingDirectoryGroup = 358 new org.eclipse.swt.widgets.Group(composite, SWT.NONE); 359 workingDirectoryGroup.setLayout(new GridLayout(4, false)); 360 workingDirectoryGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 361 workingDirectoryGroup.setFont(curFont); 362 workingDirectoryGroup.setText("Default Working Directory"); 363 364 checkCurrentUserDir = new Button(workingDirectoryGroup, SWT.CHECK); 365 checkCurrentUserDir.setFont(curFont); 366 checkCurrentUserDir.setText("\"User Work\" or"); 367 checkCurrentUserDir.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1)); 368 checkCurrentUserDir.addSelectionListener(new SelectionAdapter() { 369 @Override 370 public void widgetSelected(SelectionEvent e) 371 { 372 boolean isCheckCurrentUserDirSelected = checkCurrentUserDir.getSelection(); 373 if (isCheckCurrentUserDirSelected) 374 checkUserHomeDir.setSelection(false); 375 workField.setEnabled(!isCheckCurrentUserDirSelected); 376 currentDirButton.setEnabled(!isCheckCurrentUserDirSelected); 377 } 378 }); 379 380 checkUserHomeDir = new Button(workingDirectoryGroup, SWT.CHECK); 381 checkUserHomeDir.setFont(curFont); 382 checkUserHomeDir.setText("\"User Home\" or"); 383 checkUserHomeDir.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1)); 384 checkUserHomeDir.addSelectionListener(new SelectionAdapter() { 385 @Override 386 public void widgetSelected(SelectionEvent e) 387 { 388 boolean isCheckUserHomeDirSelected = checkUserHomeDir.getSelection(); 389 if (isCheckUserHomeDirSelected) 390 checkCurrentUserDir.setSelection(false); 391 workField.setEnabled(!isCheckUserHomeDirSelected); 392 currentDirButton.setEnabled(!isCheckUserHomeDirSelected); 393 } 394 }); 395 396 workField = new Text(workingDirectoryGroup, SWT.SINGLE | SWT.BORDER); 397 workField.setFont(curFont); 398 workField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1)); 399 400 currentDirButton = new Button(workingDirectoryGroup, SWT.PUSH); 401 currentDirButton.setFont(curFont); 402 currentDirButton.setText("Browse..."); 403 currentDirButton.setLayoutData(new GridData(SWT.END, SWT.FILL, false, false)); 404 currentDirButton.addSelectionListener(new SelectionAdapter() { 405 @Override 406 public void widgetSelected(SelectionEvent e) 407 { 408 final DirectoryDialog dChooser = new DirectoryDialog(shell); 409 dChooser.setFilterPath(workDir); 410 dChooser.setText("Select a Directory"); 411 412 String dir = dChooser.open(); 413 414 if (dir == null) 415 return; 416 417 workField.setText(dir); 418 } 419 }); 420 421 org.eclipse.swt.widgets.Group helpDocumentGroup = 422 new org.eclipse.swt.widgets.Group(composite, SWT.NONE); 423 helpDocumentGroup.setLayout(new GridLayout(3, false)); 424 helpDocumentGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 425 helpDocumentGroup.setFont(curFont); 426 helpDocumentGroup.setText("Help Document"); 427 428 Label label = new Label(helpDocumentGroup, SWT.RIGHT); 429 label.setFont(curFont); 430 label.setText("User's Guide: "); 431 432 UGField = new Text(helpDocumentGroup, SWT.SINGLE | SWT.BORDER); 433 UGField.setFont(curFont); 434 UGField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 435 436 Button browseButton = new Button(helpDocumentGroup, SWT.PUSH); 437 browseButton.setFont(curFont); 438 browseButton.setText("Browse..."); 439 browseButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); 440 browseButton.addSelectionListener(new SelectionAdapter() { 441 @Override 442 public void widgetSelected(SelectionEvent e) 443 { 444 final FileDialog fChooser = new FileDialog(shell, SWT.OPEN); 445 fChooser.setFilterPath(rootDir); 446 fChooser.setFilterExtensions(new String[] {"*"}); 447 fChooser.setFilterNames(new String[] {"All Files"}); 448 fChooser.setFilterIndex(0); 449 450 if (fChooser.open() == null) { 451 return; 452 } 453 454 File chosenFile = 455 new File(fChooser.getFilterPath() + File.separator + fChooser.getFileName()); 456 457 if (!chosenFile.exists()) { 458 // Give an error 459 return; 460 } 461 462 UGField.setText(chosenFile.getAbsolutePath()); 463 } 464 }); 465 466 org.eclipse.swt.widgets.Group fileAccessModeGroup = 467 new org.eclipse.swt.widgets.Group(composite, SWT.NONE); 468 fileAccessModeGroup.setLayout(new GridLayout(2, true)); 469 fileAccessModeGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 470 fileAccessModeGroup.setFont(curFont); 471 fileAccessModeGroup.setText("Default File Access Mode"); 472 473 checkReadOnly = new Button(fileAccessModeGroup, SWT.RADIO); 474 checkReadOnly.setFont(curFont); 475 checkReadOnly.setText("Read Only"); 476 checkReadOnly.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 477 478 rwButton = new Button(fileAccessModeGroup, SWT.RADIO); 479 rwButton.setFont(curFont); 480 rwButton.setText("Read/Write"); 481 rwButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 482 483 org.eclipse.swt.widgets.Group textFontGroup = new org.eclipse.swt.widgets.Group(composite, SWT.NONE); 484 textFontGroup.setLayout(new GridLayout(4, false)); 485 textFontGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 486 textFontGroup.setFont(curFont); 487 textFontGroup.setText("Text Font"); 488 489 label = new Label(textFontGroup, SWT.RIGHT); 490 label.setFont(curFont); 491 label.setText("Font Size: "); 492 493 String[] fontSizeChoices = {"8", "10", "12", "14", "16", "18", "20", "22", 494 "24", "26", "28", "30", "32", "34", "36", "48"}; 495 fontSizeChoice = new Combo(textFontGroup, SWT.SINGLE | SWT.READ_ONLY); 496 fontSizeChoice.setFont(curFont); 497 fontSizeChoice.setItems(fontSizeChoices); 498 fontSizeChoice.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 499 500 label = new Label(textFontGroup, SWT.RIGHT); 501 label.setFont(curFont); 502 label.setText("Font Type: "); 503 504 String[] fontNames = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); 505 506 fontTypeChoice = new Combo(textFontGroup, SWT.SINGLE | SWT.READ_ONLY); 507 fontTypeChoice.setFont(curFont); 508 fontTypeChoice.setItems(fontNames); 509 fontTypeChoice.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 510 511 org.eclipse.swt.widgets.Group imageGroup = new org.eclipse.swt.widgets.Group(composite, SWT.NONE); 512 imageGroup.setLayout(new GridLayout(6, false)); 513 imageGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 514 imageGroup.setFont(curFont); 515 imageGroup.setText("Image"); 516 517 helpButton = new Button(imageGroup, SWT.PUSH); 518 helpButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); 519 helpButton.setImage(ViewProperties.getHelpIcon()); 520 helpButton.setToolTipText("Help on Auto Contrast"); 521 helpButton.addSelectionListener(new SelectionAdapter() { 522 @Override 523 public void widgetSelected(SelectionEvent e) 524 { 525 final String msg = 526 "Auto Contrast does the following to compute a gain/bias \n" 527 + "that will stretch the pixels in the image to fit the pixel \n" 528 + "values of the graphics system. For example, it stretches unsigned\n" 529 + "short data to fit the full range of an unsigned short. Later \n" 530 + "code simply takes the high order byte and passes it to the graphics\n" 531 + "system (which expects 0-255). It uses some statistics on the pixels \n" 532 + "to prevent outliers from throwing off the gain/bias calculations much.\n\n" 533 + "To compute the gain/bias we... \n" 534 + "Find the mean and std. deviation of the pixels in the image \n" 535 + "min = mean - 3 * std.dev. \n" 536 + "max = mean + 3 * std.dev. \n" 537 + "small fudge factor because this tends to overshoot a bit \n" 538 + "Stretch to 0-USHRT_MAX \n" 539 + " gain = USHRT_MAX / (max-min) \n" 540 + " bias = -min \n" 541 + "\n" 542 + "To apply the gain/bias to a pixel, use the formula \n" 543 + "data[i] = (data[i] + bias) * gain \n" 544 + "\n" 545 // + 546 // "Finally, for auto-ranging the sliders for gain/bias, we do the following \n" 547 // + "gain_min = 0 \n" 548 // + "gain_max = gain * 3.0 \n" 549 // + "bias_min = -fabs(bias) * 3.0 \n" 550 // + "bias_max = fabs(bias) * 3.0 \n" 551 + "\n\n"; 552 553 Tools.showInformation(getShell(), "Help", msg); 554 } 555 }); 556 557 checkAutoContrast = new Button(imageGroup, SWT.CHECK); 558 checkAutoContrast.setFont(curFont); 559 checkAutoContrast.setText("Autogain Image Contrast"); 560 checkAutoContrast.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 561 562 checkShowValues = new Button(imageGroup, SWT.CHECK); 563 checkShowValues.setFont(curFont); 564 checkShowValues.setText("Show Values"); 565 checkShowValues.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 566 567 label = new Label(imageGroup, SWT.NONE); 568 569 label = new Label(imageGroup, SWT.RIGHT); 570 label.setFont(curFont); 571 label.setText("Image Origin: "); 572 573 imageOriginChoice = new Combo(imageGroup, SWT.SINGLE | SWT.READ_ONLY); 574 imageOriginChoice.setFont(curFont); 575 imageOriginChoice.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 576 577 org.eclipse.swt.widgets.Group dataGroup = new org.eclipse.swt.widgets.Group(composite, SWT.NONE); 578 dataGroup.setLayout(new GridLayout(4, false)); 579 dataGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 580 dataGroup.setFont(curFont); 581 dataGroup.setText("Data"); 582 583 label = new Label(dataGroup, SWT.RIGHT); 584 label.setFont(curFont); 585 label.setText("Index Base: "); 586 587 String[] indexBaseChoices = {"0-based", "1-based"}; 588 indexBaseChoice = new Combo(dataGroup, SWT.SINGLE | SWT.READ_ONLY); 589 indexBaseChoice.setFont(curFont); 590 indexBaseChoice.setItems(indexBaseChoices); 591 indexBaseChoice.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); 592 593 Label delimLabel = new Label(dataGroup, SWT.RIGHT); 594 delimLabel.setFont(curFont); 595 delimLabel.setText("Data Delimiter: "); 596 delimLabel.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false)); 597 598 delimiterChoice = new Combo(dataGroup, SWT.SINGLE | SWT.READ_ONLY); 599 delimiterChoice.setFont(curFont); 600 delimiterChoice.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); 601 602 Label timerRefreshLabel = new Label(dataGroup, SWT.RIGHT); 603 timerRefreshLabel.setFont(curFont); 604 timerRefreshLabel.setText("Timer Refresh (ms): "); 605 606 timerRefreshField = new Text(dataGroup, SWT.SINGLE | SWT.BORDER); 607 timerRefreshField.setFont(curFont); 608 timerRefreshField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); 609 610 org.eclipse.swt.widgets.Group objectsGroup = new org.eclipse.swt.widgets.Group(composite, SWT.NONE); 611 objectsGroup.setLayout(new GridLayout(5, true)); 612 objectsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 613 objectsGroup.setFont(curFont); 614 objectsGroup.setText("Objects to Open"); 615 616 checkReadAll = new Button(objectsGroup, SWT.CHECK); 617 checkReadAll.setFont(curFont); 618 checkReadAll.setText("Open All"); 619 checkReadAll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); 620 checkReadAll.addSelectionListener(new SelectionAdapter() { 621 @Override 622 public void widgetSelected(SelectionEvent e) 623 { 624 startMemberField.setEnabled(!checkReadAll.getSelection()); 625 maxMemberField.setEnabled(!checkReadAll.getSelection()); 626 } 627 }); 628 629 label = new Label(objectsGroup, SWT.RIGHT); 630 label.setFont(curFont); 631 label.setText("Start Member: "); 632 633 startMemberField = new Text(objectsGroup, SWT.SINGLE | SWT.BORDER); 634 startMemberField.setFont(curFont); 635 startMemberField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); 636 637 label = new Label(objectsGroup, SWT.RIGHT); 638 label.setFont(curFont); 639 label.setText("Member Count: "); 640 641 maxMemberField = new Text(objectsGroup, SWT.SINGLE | SWT.BORDER); 642 maxMemberField.setFont(curFont); 643 maxMemberField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); 644 645 startMemberField.setEnabled(!checkReadAll.getSelection()); 646 maxMemberField.setEnabled(!checkReadAll.getSelection()); 647 648 load(); 649 // return scroller; 650 return composite; 651 } 652}