List of usage examples for org.eclipse.swt.widgets Label Label
public Label(Composite parent, int style)
From source file:ReservationData.java
public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NULL); composite.setLayout(new GridLayout(2, false)); new Label(composite, SWT.NULL).setText("Credit card type: "); comboCreditCardTypes = new Combo(composite, SWT.READ_ONLY | SWT.BORDER); comboCreditCardTypes.add("American Express"); comboCreditCardTypes.add("Master Card"); comboCreditCardTypes.add("Visa"); comboCreditCardTypes.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); new Label(composite, SWT.NULL).setText("Credit card number: "); textCreditCardNumber = new Text(composite, SWT.SINGLE | SWT.BORDER); textCreditCardNumber.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); new Label(composite, SWT.NULL).setText("Expiration (MM/YY)"); textCreditCardExpiration = new Text(composite, SWT.SINGLE | SWT.BORDER); textCreditCardExpiration.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); comboCreditCardTypes.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { ((ReservationWizard) getWizard()).data.creditCardType = comboCreditCardTypes.getSelectionIndex(); if (((ReservationWizard) getWizard()).data.creditCardNumber != null && ((ReservationWizard) getWizard()).data.creditCardExpiration != null) setPageComplete(true);// w w w.ja v a 2s . c o m else setPageComplete(false); } }); textCreditCardNumber.addListener(SWT.Modify, new Listener() { public void handleEvent(Event event) { ((ReservationWizard) getWizard()).data.creditCardNumber = textCreditCardNumber.getText(); if (((ReservationWizard) getWizard()).data.creditCardNumber != null && ((ReservationWizard) getWizard()).data.creditCardExpiration != null) setPageComplete(true); else setPageComplete(false); } }); textCreditCardExpiration.addListener(SWT.Modify, new Listener() { public void handleEvent(Event event) { String text = textCreditCardExpiration.getText().trim(); if (text.length() == 5 && text.charAt(2) == '/') { ((ReservationWizard) getWizard()).data.creditCardExpiration = text; setErrorMessage(null); } else { ((ReservationWizard) getWizard()).data.creditCardExpiration = null; setErrorMessage("Invalid expiration date: " + text); } if (((ReservationWizard) getWizard()).data.creditCardNumber != null && ((ReservationWizard) getWizard()).data.creditCardExpiration != null) setPageComplete(true); else setPageComplete(false); } }); setControl(composite); }
From source file:net.sf.eclipsecs.ui.stats.views.GraphStatsView.java
/** * {@inheritDoc}//from www.j ava 2s . c om * * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) */ public void createPartControl(Composite parent) { super.createPartControl(parent); // set up the main layout GridLayout layout = new GridLayout(1, false); layout.marginWidth = 0; layout.marginHeight = 0; parent.setLayout(layout); // the label mLabelDesc = new Label(parent, SWT.NONE); GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; mLabelDesc.setLayoutData(gridData); // the main section mMainSection = new Composite(parent, SWT.NONE); mStackLayout = new StackLayout(); mStackLayout.marginHeight = 0; mStackLayout.marginWidth = 0; mMainSection.setLayout(mStackLayout); mMainSection.setLayoutData(new GridData(GridData.FILL_BOTH)); // create the master viewer mMasterComposite = createMasterView(mMainSection); // create the detail viewer mDetailViewer = createDetailView(mMainSection); mStackLayout.topControl = mMasterComposite; updateActions(); // initialize the view data refresh(); }
From source file:org.eclipse.swt.examples.layoutexample.RowLayoutTab.java
/** * Creates the control widgets.//ww w. ja va 2s .c o m */ @Override void createControlWidgets() { /* Controls the type of RowLayout */ Group typeGroup = new Group(controlGroup, SWT.NONE); typeGroup.setText(LayoutExample.getResourceString("Type")); typeGroup.setLayout(new GridLayout()); typeGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); horizontal = new Button(typeGroup, SWT.RADIO); horizontal.setText("SWT.HORIZONTAL"); horizontal.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); horizontal.setSelection(true); horizontal.addSelectionListener(selectionListener); vertical = new Button(typeGroup, SWT.RADIO); vertical.setText("SWT.VERTICAL"); vertical.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); vertical.addSelectionListener(selectionListener); /* Controls the margins and spacing of the RowLayout */ Group marginGroup = new Group(controlGroup, SWT.NONE); marginGroup.setText(LayoutExample.getResourceString("Margins_Spacing")); marginGroup.setLayout(new GridLayout(2, false)); marginGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 2)); new Label(marginGroup, SWT.NONE).setText("marginWidth"); marginWidth = new Spinner(marginGroup, SWT.BORDER); marginWidth.setSelection(0); marginWidth.addSelectionListener(selectionListener); new Label(marginGroup, SWT.NONE).setText("marginHeight"); marginHeight = new Spinner(marginGroup, SWT.BORDER); marginHeight.setSelection(0); marginHeight.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); marginHeight.addSelectionListener(selectionListener); new Label(marginGroup, SWT.NONE).setText("marginLeft"); marginLeft = new Spinner(marginGroup, SWT.BORDER); marginLeft.setSelection(3); marginLeft.addSelectionListener(selectionListener); new Label(marginGroup, SWT.NONE).setText("marginRight"); marginRight = new Spinner(marginGroup, SWT.BORDER); marginRight.setSelection(3); marginRight.addSelectionListener(selectionListener); new Label(marginGroup, SWT.NONE).setText("marginTop"); marginTop = new Spinner(marginGroup, SWT.BORDER); marginTop.setSelection(3); marginTop.addSelectionListener(selectionListener); new Label(marginGroup, SWT.NONE).setText("marginBottom"); marginBottom = new Spinner(marginGroup, SWT.BORDER); marginBottom.setSelection(3); marginBottom.addSelectionListener(selectionListener); new Label(marginGroup, SWT.NONE).setText("spacing"); spacing = new Spinner(marginGroup, SWT.BORDER); spacing.setSelection(3); spacing.addSelectionListener(selectionListener); /* Controls other parameters of the RowLayout */ Group specGroup = new Group(controlGroup, SWT.NONE); specGroup.setText(LayoutExample.getResourceString("Properties")); specGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); specGroup.setLayout(new GridLayout()); wrap = new Button(specGroup, SWT.CHECK); wrap.setText("Wrap"); wrap.setSelection(true); wrap.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); wrap.addSelectionListener(selectionListener); pack = new Button(specGroup, SWT.CHECK); pack.setText("Pack"); pack.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); pack.setSelection(true); pack.addSelectionListener(selectionListener); fill = new Button(specGroup, SWT.CHECK); fill.setText("Fill"); fill.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fill.addSelectionListener(selectionListener); justify = new Button(specGroup, SWT.CHECK); justify.setText("Justify"); justify.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); justify.addSelectionListener(selectionListener); center = new Button(specGroup, SWT.CHECK); center.setText("Center"); center.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); center.addSelectionListener(selectionListener); /* Add common controls */ super.createControlWidgets(); }
From source file:org.eclipse.swt.examples.clipboard.ClipboardExample.java
void createTextTransfer(Composite copyParent, Composite pasteParent) { // TextTransfer Label l = new Label(copyParent, SWT.NONE); l.setText("TextTransfer:"); //$NON-NLS-1$ final Text copyText = new Text(copyParent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); copyText.setText("some\nplain\ntext"); GridData data = new GridData(GridData.FILL_BOTH); data.widthHint = HSIZE;//from www . j a va 2 s. c o m data.heightHint = VSIZE; copyText.setLayoutData(data); Button b = new Button(copyParent, SWT.PUSH); b.setText("Copy"); b.addSelectionListener(widgetSelectedAdapter(e -> { String textData = copyText.getText(); if (textData.length() > 0) { status.setText(""); clipboard.setContents(new Object[] { textData }, new Transfer[] { TextTransfer.getInstance() }); } else { status.setText("No text to copy"); } })); l = new Label(pasteParent, SWT.NONE); l.setText("TextTransfer:"); //$NON-NLS-1$ final Text pasteText = new Text(pasteParent, SWT.READ_ONLY | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); data = new GridData(GridData.FILL_BOTH); data.widthHint = HSIZE; data.heightHint = VSIZE; pasteText.setLayoutData(data); b = new Button(pasteParent, SWT.PUSH); b.setText("Paste"); b.addSelectionListener(widgetSelectedAdapter(e -> { String textData = (String) clipboard.getContents(TextTransfer.getInstance()); if (textData != null && textData.length() > 0) { status.setText(""); pasteText.setText("begin paste>" + textData + "<end paste"); } else { status.setText("No text to paste"); } })); }
From source file:MainClass.java
public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new FillLayout(SWT.VERTICAL)); new Label(composite, SWT.CENTER).setText("Welcome to the Address Book Entry Wizard!"); new Label(composite, SWT.LEFT).setText("This wizard guides you through creating an Address Book entry."); new Label(composite, SWT.LEFT).setText("Click Next to continue."); setControl(composite);//from w w w . j a v a2 s .com }
From source file:org.eclipse.swt.examples.controlexample.StyledTextTab.java
/** * Creates the "StyledText Style" group. *///from w w w. j a va 2 s . co m void createStyledTextStyleGroup() { styledTextStyleGroup = new Group(controlGroup, SWT.NONE); styledTextStyleGroup.setText(ControlExample.getResourceString("StyledText_Styles")); styledTextStyleGroup.setLayout(new GridLayout(6, false)); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); data.horizontalSpan = 2; styledTextStyleGroup.setLayoutData(data); /* Get images */ boldImage = createBitmapImage(display, "bold"); italicImage = createBitmapImage(display, "italic"); redImage = createBitmapImage(display, "red"); yellowImage = createBitmapImage(display, "yellow"); underlineImage = createBitmapImage(display, "underline"); strikeoutImage = createBitmapImage(display, "strikeout"); /* Create controls to modify the StyledText */ Label label = new Label(styledTextStyleGroup, SWT.NONE); label.setText(ControlExample.getResourceString("StyledText_Style_Instructions")); label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1)); resetButton = new Button(styledTextStyleGroup, SWT.PUSH); resetButton.setText(ControlExample.getResourceString("Clear")); resetButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false, 2, 1)); label = new Label(styledTextStyleGroup, SWT.NONE); label.setText(ControlExample.getResourceString("Bold")); label.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false)); boldButton = new Button(styledTextStyleGroup, SWT.PUSH); boldButton.setImage(boldImage); label = new Label(styledTextStyleGroup, SWT.NONE); label.setText(ControlExample.getResourceString("Underline")); label.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false)); underlineButton = new Button(styledTextStyleGroup, SWT.PUSH); underlineButton.setImage(underlineImage); label = new Label(styledTextStyleGroup, SWT.NONE); label.setText(ControlExample.getResourceString("Foreground_Style")); label.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false)); redButton = new Button(styledTextStyleGroup, SWT.PUSH); redButton.setImage(redImage); label = new Label(styledTextStyleGroup, SWT.NONE); label.setText(ControlExample.getResourceString("Italic")); label.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false)); italicButton = new Button(styledTextStyleGroup, SWT.PUSH); italicButton.setImage(italicImage); label = new Label(styledTextStyleGroup, SWT.NONE); label.setText(ControlExample.getResourceString("Strikeout")); label.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false)); strikeoutButton = new Button(styledTextStyleGroup, SWT.PUSH); strikeoutButton.setImage(strikeoutImage); label = new Label(styledTextStyleGroup, SWT.NONE); label.setText(ControlExample.getResourceString("Background_Style")); label.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false)); yellowButton = new Button(styledTextStyleGroup, SWT.PUSH); yellowButton.setImage(yellowImage); SelectionListener styleListener = widgetSelectedAdapter(e -> { Point sel = styledText.getSelectionRange(); if ((sel == null) || (sel.y == 0)) return; StyleRange style; for (int i = sel.x; i < sel.x + sel.y; i++) { StyleRange range = styledText.getStyleRangeAtOffset(i); if (range != null && e.widget != resetButton) { style = (StyleRange) range.clone(); style.start = i; style.length = 1; } else { style = new StyleRange(i, 1, null, null, SWT.NORMAL); } if (e.widget == boldButton) { style.fontStyle ^= SWT.BOLD; } else if (e.widget == italicButton) { style.fontStyle ^= SWT.ITALIC; } else if (e.widget == underlineButton) { style.underline = !style.underline; } else if (e.widget == strikeoutButton) { style.strikeout = !style.strikeout; } styledText.setStyleRange(style); } styledText.setSelectionRange(sel.x + sel.y, 0); }); SelectionListener colorListener = widgetSelectedAdapter(e -> { Point sel = styledText.getSelectionRange(); if ((sel == null) || (sel.y == 0)) return; Color fg = null, bg = null; if (e.widget == redButton) { fg = display.getSystemColor(SWT.COLOR_RED); } else if (e.widget == yellowButton) { bg = display.getSystemColor(SWT.COLOR_YELLOW); } StyleRange style; for (int i = sel.x; i < sel.x + sel.y; i++) { StyleRange range = styledText.getStyleRangeAtOffset(i); if (range != null) { style = (StyleRange) range.clone(); style.start = i; style.length = 1; if (fg != null) style.foreground = style.foreground != null ? null : fg; if (bg != null) style.background = style.background != null ? null : bg; } else { style = new StyleRange(i, 1, fg, bg, SWT.NORMAL); } styledText.setStyleRange(style); } styledText.setSelectionRange(sel.x + sel.y, 0); }); resetButton.addSelectionListener(styleListener); boldButton.addSelectionListener(styleListener); italicButton.addSelectionListener(styleListener); underlineButton.addSelectionListener(styleListener); strikeoutButton.addSelectionListener(styleListener); redButton.addSelectionListener(colorListener); yellowButton.addSelectionListener(colorListener); yellowButton.addDisposeListener(e -> { boldImage.dispose(); italicImage.dispose(); redImage.dispose(); yellowImage.dispose(); underlineImage.dispose(); strikeoutImage.dispose(); }); }
From source file:ClipboardExample.java
void createRTFTransfer(Composite copyParent, Composite pasteParent) { // RTF Transfer Label l = new Label(copyParent, SWT.NONE); l.setText("RTFTransfer:"); //$NON-NLS-1$ copyRtfText = new Text(copyParent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); copyRtfText.setText("some\nrtf\ntext"); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = data.widthHint = SIZE; copyRtfText.setLayoutData(data);//w w w .ja v a 2s . c om Button b = new Button(copyParent, SWT.PUSH); b.setText("Copy"); b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { String data = copyRtfText.getText(); if (data.length() > 0) { status.setText(""); data = "{\\rtf1{\\colortbl;\\red255\\green0\\blue0;}\\uc1\\b\\i " + data + "}"; clipboard.setContents(new Object[] { data }, new Transfer[] { RTFTransfer.getInstance() }); } else { status.setText("nothing to copy"); } } }); l = new Label(pasteParent, SWT.NONE); l.setText("RTFTransfer:"); //$NON-NLS-1$ pasteRtfText = new Text(pasteParent, SWT.READ_ONLY | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = data.widthHint = SIZE; pasteRtfText.setLayoutData(data); b = new Button(pasteParent, SWT.PUSH); b.setText("Paste"); b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { String data = (String) clipboard.getContents(RTFTransfer.getInstance()); if (data != null && data.length() > 0) { status.setText(""); pasteRtfText.setText("start paste>" + data + "<end paste"); } else { status.setText("nothing to paste"); } } }); }
From source file:code.google.gclogviewer.GCLogViewer.java
private void createShell() { shell = new Shell(SWT.SHELL_TRIM | SWT.APPLICATION_MODAL); shell.setText(SHELL_TITLE);//from ww w .j a v a 2 s . c o m shell.setBackground(new Color(Display.getCurrent(), 255, 255, 255)); shell.setMaximized(false); shell.setToolTipText( "A free open source tool to visualize data produced by the Java VM options -Xloggc:<file>"); Monitor primary = shell.getDisplay().getPrimaryMonitor(); Rectangle bounds = primary.getBounds(); shell.setSize(new Point(bounds.width - 100, bounds.height - 100)); Rectangle rect = shell.getBounds(); int x = bounds.x + (bounds.width - rect.width) / 2; int y = bounds.y + (bounds.height - rect.height) / 2; shell.setLocation(x, y); GridLayout layout = new GridLayout(); layout.numColumns = 1; shell.setLayout(layout); menuBar = new Menu(shell, SWT.BAR); fileMenuHeader = new MenuItem(menuBar, SWT.CASCADE); fileMenuHeader.setText("&File"); toolsMenuItem = new MenuItem(menuBar, SWT.CASCADE); toolsMenuItem.setText("&Tools"); backToHomeMenuItem = new MenuItem(menuBar, SWT.CASCADE); backToHomeMenuItem.setText("Back To Home"); backToHomeMenuItem.setEnabled(false); backToHomeMenuItem.addSelectionListener(new BackToHomeListener()); exitMenuItem = new MenuItem(menuBar, SWT.CASCADE); exitMenuItem.setText("&Exit"); exitMenuItem.addSelectionListener(new ExitListener()); fileMenu = new Menu(shell, SWT.DROP_DOWN); fileMenuHeader.setMenu(fileMenu); fileOpenMenuItem = new MenuItem(fileMenu, SWT.PUSH); fileOpenMenuItem.setText("&Open log file..."); fileOpenMenuItem.addSelectionListener(new OpenFileListener()); toolsMenu = new Menu(shell, SWT.DROP_DOWN); toolsMenuItem.setMenu(toolsMenu); compareLogMenuItem = new MenuItem(toolsMenu, SWT.PUSH); compareLogMenuItem.setText("Compare GC Log"); compareLogMenuItem.setEnabled(false); compareLogMenuItem.addSelectionListener(new CompareLogListener()); memoryLeakDetectionMenuItem = new MenuItem(toolsMenu, SWT.PUSH); memoryLeakDetectionMenuItem.setText("Memory Leak Detection"); memoryLeakDetectionMenuItem.setEnabled(false); memoryLeakDetectionMenuItem.addSelectionListener(new MemoryLeakDetectionListener()); gcTuningMenuItem = new MenuItem(toolsMenu, SWT.PUSH); gcTuningMenuItem.setText("Data for GC Tuning"); gcTuningMenuItem.setEnabled(false); gcTuningMenuItem.addSelectionListener(new DataForGCTuningListener()); exportToPDFMenuItem = new MenuItem(toolsMenu, SWT.PUSH); exportToPDFMenuItem.setText("Export to PDF"); exportToPDFMenuItem.setEnabled(false); shell.setMenuBar(menuBar); createSummary(); createGCTrendGroup(); createMemoryTrendGroup(); createProgressBar(); // Info Grid GridData infoGrid = new GridData(GridData.FILL_BOTH); final Label runtimeLabel = new Label(summary, SWT.NONE); runtimeLabel.setText("Run time: "); runtimeLabel.setLayoutData(infoGrid); runtimedataLabel = new Label(summary, SWT.NONE); runtimedataLabel.setText("xxx seconds"); runtimedataLabel.setLayoutData(infoGrid); final Label gctypeLabel = new Label(summary, SWT.NONE); gctypeLabel.setText("GC Type: "); gctypeLabel.setLayoutData(infoGrid); gctypedataLabel = new Label(summary, SWT.NONE); gctypedataLabel.setText("xxx"); gctypedataLabel.setLayoutData(infoGrid); final Label throughputLabel = new Label(summary, SWT.NONE); throughputLabel.setText("Throughput: "); throughputLabel.setLayoutData(infoGrid); throughputdataLabel = new Label(summary, SWT.NONE); throughputdataLabel.setText("xx%"); throughputdataLabel.setLayoutData(infoGrid); final Label emptyLabel = new Label(summary, SWT.NONE); emptyLabel.setText(" "); emptyLabel.setLayoutData(infoGrid); final Label emptyDataLabel = new Label(summary, SWT.NONE); emptyDataLabel.setText(" "); emptyDataLabel.setLayoutData(infoGrid); // YGC Grid GridData ygcInfoGrid = new GridData(GridData.FILL_BOTH); final Label ygcLabel = new Label(summary, SWT.NONE); ygcLabel.setText("YGC: "); ygcLabel.setLayoutData(ygcInfoGrid); ygcDataLabel = new Label(summary, SWT.NONE); ygcDataLabel.setText("xxx"); ygcDataLabel.setLayoutData(ygcInfoGrid); final Label ygctLabel = new Label(summary, SWT.NONE); ygctLabel.setText("YGCT: "); ygctLabel.setLayoutData(ygcInfoGrid); ygctDataLabel = new Label(summary, SWT.NONE); ygctDataLabel.setText("xxx seconds"); ygctDataLabel.setLayoutData(ygcInfoGrid); final Label avgYGCTLabel = new Label(summary, SWT.NONE); avgYGCTLabel.setText("Avg YGCT: "); avgYGCTLabel.setLayoutData(ygcInfoGrid); avgYGCTDataLabel = new Label(summary, SWT.NONE); avgYGCTDataLabel.setText("xxx seconds"); avgYGCTDataLabel.setLayoutData(ygcInfoGrid); final Label avgYGCRateLabel = new Label(summary, SWT.NONE); avgYGCRateLabel.setText("Avg YGCRate: "); avgYGCRateLabel.setLayoutData(ygcInfoGrid); avgYGCRateDataLabel = new Label(summary, SWT.NONE); avgYGCRateDataLabel.setText("xxx seconds"); avgYGCRateDataLabel.setLayoutData(ygcInfoGrid); // CMS Grid GridData cmsgcInfoGrid = new GridData(GridData.FILL_BOTH); cmsgcInfoGrid.exclude = true; final Label cmsgcLabel = new Label(summary, SWT.NONE); cmsgcLabel.setText("CMSGC: "); cmsgcLabel.setLayoutData(cmsgcInfoGrid); cmsgcDataLabel = new Label(summary, SWT.NONE); cmsgcDataLabel.setText("xxx"); cmsgcDataLabel.setLayoutData(cmsgcInfoGrid); final Label cmsgctLabel = new Label(summary, SWT.NONE); cmsgctLabel.setText("CMSGCT: "); cmsgctLabel.setLayoutData(cmsgcInfoGrid); cmsgctDataLabel = new Label(summary, SWT.NONE); cmsgctDataLabel.setText("xxx seconds"); cmsgctDataLabel.setLayoutData(cmsgcInfoGrid); final Label avgCMSGCTLabel = new Label(summary, SWT.NONE); avgCMSGCTLabel.setText("Avg CMSGCT: "); avgCMSGCTLabel.setLayoutData(cmsgcInfoGrid); avgCMSGCTDataLabel = new Label(summary, SWT.NONE); avgCMSGCTDataLabel.setText("xxx seconds"); avgCMSGCTDataLabel.setLayoutData(cmsgcInfoGrid); final Label avgCMSGCRateLabel = new Label(summary, SWT.NONE); avgCMSGCRateLabel.setText("Avg CMSGCRate: "); avgCMSGCRateLabel.setLayoutData(cmsgcInfoGrid); avgCMSGCRateDataLabel = new Label(summary, SWT.NONE); avgCMSGCRateDataLabel.setText("xxx seconds"); avgCMSGCRateDataLabel.setLayoutData(cmsgcInfoGrid); // LDS & PTOS Grid GridData ldsAndPTOSGrid = new GridData(GridData.FILL_BOTH); ldsAndPTOSGrid.exclude = true; final Label avgYGCLDSLabel = new Label(summary, SWT.NONE); avgYGCLDSLabel.setText("AVG YGCLDS: "); avgYGCLDSLabel.setLayoutData(ldsAndPTOSGrid); avgYGCLDSDataLabel = new Label(summary, SWT.NONE); avgYGCLDSDataLabel.setText("xxx(K)"); avgYGCLDSDataLabel.setLayoutData(ldsAndPTOSGrid); final Label avgFGCLDSLabel = new Label(summary, SWT.NONE); avgFGCLDSLabel.setText("AVG FGCLDS: "); avgFGCLDSLabel.setLayoutData(ldsAndPTOSGrid); avgFGCLDSDataLabel = new Label(summary, SWT.NONE); avgFGCLDSDataLabel.setText("xxx(K)"); avgFGCLDSDataLabel.setLayoutData(ldsAndPTOSGrid); final Label avgPTOSLabel = new Label(summary, SWT.NONE); avgPTOSLabel.setText("AVG PTOS: "); avgPTOSLabel.setLayoutData(ldsAndPTOSGrid); avgPTOSDataLabel = new Label(summary, SWT.NONE); avgPTOSDataLabel.setText("xx%"); avgPTOSDataLabel.setLayoutData(ldsAndPTOSGrid); final Label emptyLabel2 = new Label(summary, SWT.NONE); emptyLabel2.setText(" "); emptyLabel2.setLayoutData(ldsAndPTOSGrid); final Label emptyDataLabel2 = new Label(summary, SWT.NONE); emptyDataLabel2.setText(" "); emptyDataLabel2.setLayoutData(ldsAndPTOSGrid); // FGC Grid GridData fgcInfoGrid = new GridData(GridData.FILL_BOTH); final Label fgcLabel = new Label(summary, SWT.NONE); fgcLabel.setText("FGC: "); fgcLabel.setLayoutData(fgcInfoGrid); fgcDataLabel = new Label(summary, SWT.NONE); fgcDataLabel.setText("xxx"); fgcDataLabel.setLayoutData(fgcInfoGrid); final Label fgctLabel = new Label(summary, SWT.NONE); fgctLabel.setText("FGCT: "); fgctLabel.setLayoutData(fgcInfoGrid); fgctDataLabel = new Label(summary, SWT.NONE); fgctDataLabel.setText("xxx seconds"); fgctDataLabel.setLayoutData(fgcInfoGrid); final Label avgFGCTLabel = new Label(summary, SWT.NONE); avgFGCTLabel.setText("Avg FGCT: "); avgFGCTLabel.setLayoutData(fgcInfoGrid); avgFGCTDataLabel = new Label(summary, SWT.NONE); avgFGCTDataLabel.setText("xxx seconds"); avgFGCTDataLabel.setLayoutData(fgcInfoGrid); final Label avgFGCRateLabel = new Label(summary, SWT.NONE); avgFGCRateLabel.setText("Avg FGCRate: "); avgFGCRateLabel.setLayoutData(fgcInfoGrid); avgFGCRateDataLabel = new Label(summary, SWT.NONE); avgFGCRateDataLabel.setText("xxx seconds"); avgFGCRateDataLabel.setLayoutData(fgcInfoGrid); }
From source file:org.eclipse.swt.examples.ole.win32.OleBrowserView.java
/** * Creates the Web browser toolbar.//from www .j ava 2 s. c o m */ private void createToolbar() { // Add a toolbar ToolBar bar = new ToolBar(displayArea, SWT.NONE); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 3; bar.setLayoutData(gridData); // Add a button to navigate backwards through previously visited web sites webCommandBackward = new ToolItem(bar, SWT.NONE); webCommandBackward.setToolTipText(OlePlugin.getResourceString("browser.Back.tooltip")); webCommandBackward.setText(OlePlugin.getResourceString("browser.Back.text")); webCommandBackward.setImage(OlePlugin.images[OlePlugin.biBack]); webCommandBackward.setEnabled(false); webCommandBackward.addListener(SWT.Selection, e -> { if (webBrowser == null) return; webBrowser.GoBack(); }); // Add a button to navigate forward through previously visited web sites webCommandForward = new ToolItem(bar, SWT.NONE); webCommandForward.setToolTipText(OlePlugin.getResourceString("browser.Forward.tooltip")); webCommandForward.setText(OlePlugin.getResourceString("browser.Forward.text")); webCommandForward.setImage(OlePlugin.images[OlePlugin.biForward]); webCommandForward.setEnabled(false); webCommandForward.addListener(SWT.Selection, e -> { if (webBrowser == null) return; webBrowser.GoForward(); }); // Add a separator new ToolItem(bar, SWT.SEPARATOR); // Add a button to navigate to the Home page webCommandHome = new ToolItem(bar, SWT.NONE); webCommandHome.setToolTipText(OlePlugin.getResourceString("browser.Home.tooltip")); webCommandHome.setText(OlePlugin.getResourceString("browser.Home.text")); webCommandHome.setImage(OlePlugin.images[OlePlugin.biHome]); webCommandHome.setEnabled(false); webCommandHome.addListener(SWT.Selection, e -> { if (webBrowser == null) return; webBrowser.GoHome(); }); // Add a button to abort web page loading webCommandStop = new ToolItem(bar, SWT.NONE); webCommandStop.setToolTipText(OlePlugin.getResourceString("browser.Stop.tooltip")); webCommandStop.setText(OlePlugin.getResourceString("browser.Stop.text")); webCommandStop.setImage(OlePlugin.images[OlePlugin.biStop]); webCommandStop.setEnabled(false); webCommandStop.addListener(SWT.Selection, e -> { if (webBrowser == null) return; webBrowser.Stop(); }); // Add a button to refresh the current web page webCommandRefresh = new ToolItem(bar, SWT.NONE); webCommandRefresh.setToolTipText(OlePlugin.getResourceString("browser.Refresh.tooltip")); webCommandRefresh.setText(OlePlugin.getResourceString("browser.Refresh.text")); webCommandRefresh.setImage(OlePlugin.images[OlePlugin.biRefresh]); webCommandRefresh.setEnabled(false); webCommandRefresh.addListener(SWT.Selection, e -> { if (webBrowser == null) return; webBrowser.Refresh(); }); // Add a separator new ToolItem(bar, SWT.SEPARATOR); // Add a button to search the web webCommandSearch = new ToolItem(bar, SWT.NONE); webCommandSearch.setToolTipText(OlePlugin.getResourceString("browser.Search.tooltip")); webCommandSearch.setText(OlePlugin.getResourceString("browser.Search.text")); webCommandSearch.setImage(OlePlugin.images[OlePlugin.biSearch]); webCommandSearch.setEnabled(false); webCommandSearch.addListener(SWT.Selection, e -> { if (webBrowser == null) return; webBrowser.GoSearch(); }); // Add a text area for Users to enter a url Composite addressBar = new Composite(displayArea, SWT.NONE); gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); gridData.horizontalSpan = 3; addressBar.setLayoutData(gridData); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 3; addressBar.setLayout(gridLayout); Label addressLabel = new Label(addressBar, SWT.NONE); gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL); addressLabel.setLayoutData(gridData); addressLabel.setText(OlePlugin.getResourceString("browser.Address.label")); addressLabel.setFont(OlePlugin.browserFont); webUrl = new Text(addressBar, SWT.SINGLE | SWT.BORDER); webUrl.setFont(OlePlugin.browserFont); gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); webUrl.setLayoutData(gridData); webUrl.addFocusListener(FocusListener .focusGainedAdapter(e -> webNavigateButton.getShell().setDefaultButton(webNavigateButton))); // Add a button to navigate to the web site specified in the Text area defined above webNavigateButton = new Button(addressBar, SWT.PUSH); gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL); webNavigateButton.setLayoutData(gridData); webNavigateButton.setText(OlePlugin.getResourceString("browser.Go.text")); webNavigateButton.setFont(OlePlugin.browserFont); webNavigateButton.addListener(SWT.Selection, event -> { if (webBrowser == null) return; webBrowser.Navigate(webUrl.getText()); }); }
From source file:edu.harvard.i2b2.analysis.ui.AnalysisComposite.java
/** * Create the composite//from w w w .jav a2 s . com * * @param parent * @param style */ public AnalysisComposite(Composite parent, int style) { super(parent, style); setLayout(new GridLayout()); this.setSize(557, 224); // Create the types Transfer[] types = new Transfer[] { TextTransfer.getInstance() }; final Composite composite_2 = new Composite(this, SWT.NONE); composite_2.setLayout(new FillLayout()); final GridData gd_composite_2 = new GridData(SWT.FILL, SWT.FILL, true, true); gd_composite_2.heightHint = 263; gd_composite_2.widthHint = 540; composite_2.setLayoutData(gd_composite_2); final SashForm sashForm = new SashForm(composite_2, SWT.HORIZONTAL); sashForm.setOrientation(SWT.HORIZONTAL); { composite2 = new FramedComposite(sashForm, SWT.SHADOW_NONE); GridLayout composite2Layout = new GridLayout(); composite2Layout.horizontalSpacing = 1; composite2.setLayout(composite2Layout); { composite3 = new FramedComposite(composite2, SWT.SHADOW_NONE); GridLayout composite3Layout = new GridLayout(); composite3Layout.numColumns = 2; composite3Layout.marginHeight = 3; GridData composite3LData = new GridData(); composite3LData.grabExcessHorizontalSpace = true; composite3LData.horizontalAlignment = GridData.FILL; composite3LData.heightHint = 25; composite3.setLayoutData(composite3LData); composite3.setLayout(composite3Layout); { label2 = new Label(composite3, SWT.NONE); label2.setText("Graphic Analyses"); GridData label2LData = new GridData(); label2LData.horizontalAlignment = GridData.FILL; label2LData.heightHint = 14; label2LData.grabExcessHorizontalSpace = true; label2.setLayoutData(label2LData); label2.setAlignment(SWT.CENTER); } { clearButton = new Button(composite3, SWT.PUSH | SWT.CENTER); GridData button1LData = new GridData(); button1LData.horizontalAlignment = GridData.CENTER; button1LData.widthHint = 19; button1LData.verticalAlignment = GridData.BEGINNING; button1LData.heightHint = 18; clearButton.setLayoutData(button1LData); clearButton.setText("x"); clearButton.setToolTipText("Remove all nodes in analysis tree panel below"); clearButton.setFont(SWTResourceManager.getFont("Tahoma", 10, 1, false, false)); clearButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent evt) { clearButtonWidgetSelected(evt); } }); } } { tree1 = new Tree(composite2, SWT.BORDER); tree1.addSelectionListener(new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { final TreeItem item = tree1.getSelection()[0]; if (item.getText().equalsIgnoreCase("No results to display")) { return; } getDisplay().syncExec(new Runnable() { public void run() { queryName = item.getParentItem().getText(); label1.setText(item.getParentItem().getText()); } }); setSelection((QueryResultData) item.getData()); } }); GridData tree1LData = new GridData(); tree1LData.verticalAlignment = GridData.FILL; tree1LData.horizontalAlignment = GridData.FILL; tree1LData.grabExcessHorizontalSpace = true; tree1LData.grabExcessVerticalSpace = true; tree1.setLayoutData(tree1LData); { /* * analyses = new TreeItem(tree1, SWT.NONE); * analyses.setText("Analyses"); analyses * .setImage(SWTResourceManager * .getImage("edu/harvard/i2b2/analysis/ui/openFolder.jpg" * )); analyses.setExpanded(true); */ } } } { final FramedComposite right_composite = new FramedComposite(sashForm, SWT.SHADOW_NONE); GridLayout right_compositeLayout = new GridLayout(); right_composite.setLayout(right_compositeLayout); { final FramedComposite top_composite = new FramedComposite(right_composite, SWT.SHADOW_NONE); GridLayout top_compositeLayout = new GridLayout(); top_compositeLayout.makeColumnsEqualWidth = true; top_composite.setLayout(top_compositeLayout); GridData top_compositeLData = new GridData(); top_compositeLData.horizontalAlignment = GridData.FILL; top_compositeLData.grabExcessHorizontalSpace = true; top_composite.setLayoutData(top_compositeLData); { label1 = new Label(top_composite, SWT.NO_TRIM); GridData gd_top_composite = new GridData(); gd_top_composite.grabExcessHorizontalSpace = true; gd_top_composite.horizontalAlignment = GridData.FILL; label1.setLayoutData(gd_top_composite); queryName = "Query Name: "; label1.setText("Query Name: "); label1.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { int width = label1.getBounds().width; GC gc = new GC(Display.getCurrent().getActiveShell()); if (gc != null) { gc.setFont(label1.getFont()); Point pt = gc.stringExtent(queryName); if (pt.x <= width) { label1.setText(queryName); gc.dispose(); return; } int charWidth = pt.x / queryName.length(); int charNum = width / charWidth; label1.setText(queryName.substring(0, charNum - 6) + "..."); // System.out.println("size: "+label1.getSize() // + "; width"+width+ // " font width: "+pt.x+"char width: "+pt.x/ // queryName.length()); gc.dispose(); } } }); label1.addMouseTrackListener(new MouseTrackListener() { public void mouseEnter(MouseEvent arg0) { top_composite.setForeground(getDisplay().getSystemColor(SWT.COLOR_YELLOW)); } public void mouseExit(MouseEvent arg0) { top_composite.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLACK)); } public void mouseHover(MouseEvent arg0) { top_composite.setForeground(getDisplay().getSystemColor(SWT.COLOR_YELLOW)); } }); } { DropTarget target1 = new DropTarget(top_composite, DND.DROP_COPY); // RowData target1LData = new RowData(); // target1.setLayoutData(target1LData); target1.setTransfer(types); target1.addDropListener(new DropTargetAdapter() { @SuppressWarnings("unchecked") public void drop(DropTargetEvent event) { if (event.data == null) { event.detail = DND.DROP_NONE; return; } try { SAXBuilder parser = new SAXBuilder(); String xmlContent = (String) event.data; java.io.StringReader xmlStringReader = new java.io.StringReader(xmlContent); org.jdom.Document tableDoc = parser.build(xmlStringReader); org.jdom.Element tableXml = tableDoc.getRootElement().getChild("query_master", Namespace.getNamespace("http://www.i2b2.org/xsd/cell/crc/psm/1.1/")); if (tableXml == null) { tableXml = tableDoc.getRootElement().getChild("query_instance", Namespace.getNamespace("http://www.i2b2.org/xsd/cell/crc/psm/1.1/")); if (tableXml == null) { MessageBox mBox = new MessageBox(top_composite.getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("You can not drop this item here."); mBox.open(); event.detail = DND.DROP_NONE; return; } else { try { QueryInstanceData ndata = new QueryInstanceData(); // ndata.name(tableXml.getChildText( // "name")); // label1.setText("Query Name: " + // ndata.name()); ndata.xmlContent(null); ndata.id(tableXml.getChildTextTrim("query_instance_id")); ndata.userId(tableXml.getChildTextTrim("user_id")); ndata.name(tableXml.getChildTextTrim("name")); insertNodes(ndata); setSelection(tree1.getItemCount() - 1); } catch (Exception e) { e.printStackTrace(); return; } event.detail = DND.DROP_NONE; return; } } try { JAXBUtil jaxbUtil = AnalysisJAXBUtil.getJAXBUtil(); QueryMasterData ndata = new QueryMasterData(); ndata.name(tableXml.getChildText("name")); // label1.setText("Query Name: " + // ndata.name()); ndata.xmlContent(null); ndata.id(tableXml.getChildTextTrim("query_master_id")); ndata.userId(tableXml.getChildTextTrim("user_id")); // get query instance String xmlRequest = ndata.writeContentQueryXML(); // lastRequestMessage(xmlRequest); String xmlResponse = QueryClient.sendQueryRequestREST(xmlRequest); // lastResponseMessage(xmlResponse); JAXBElement jaxbElement = jaxbUtil.unMashallFromString(xmlResponse); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); BodyType bt = messageType.getMessageBody(); InstanceResponseType instanceResponseType = (InstanceResponseType) new JAXBUnWrapHelper() .getObjectByClass(bt.getAny(), InstanceResponseType.class); QueryInstanceData instanceData = null; XMLGregorianCalendar startDate = null; for (QueryInstanceType queryInstanceType : instanceResponseType .getQueryInstance()) { QueryInstanceData runData = new QueryInstanceData(); runData.visualAttribute("FA"); runData.tooltip("The results of the query run"); runData.id(new Integer(queryInstanceType.getQueryInstanceId()).toString()); XMLGregorianCalendar cldr = queryInstanceType.getStartDate(); runData.name(ndata.name()); if (instanceData == null) { startDate = cldr; instanceData = runData; } else { if (cldr.toGregorianCalendar() .compareTo(startDate.toGregorianCalendar()) > 0) { startDate = cldr; instanceData = runData; } } } insertNodes(instanceData); if (treeItem.getItemCount() == 0) { getDisplay().syncExec(new Runnable() { public void run() { TreeItem treeItem1 = new TreeItem(treeItem, SWT.NONE); treeItem1.setText("No results to display"); treeItem1.setForeground(getDisplay().getSystemColor(SWT.COLOR_RED)); treeItem1.setExpanded(true); treeItem1.setImage(SWTResourceManager .getImage("edu/harvard/i2b2/analysis/ui/leaf.jpg")); JFreeChart chart = createNoDataChart(createEmptyDataset()); composite1.getChildren()[0].dispose(); ChartComposite frame = new ChartComposite(composite1, SWT.NONE, chart, true, true, false, true, true); frame.pack(); composite1.layout(); tree1.select(treeItem1); return; } }); } else { setSelection(tree1.getItemCount() - 1); } } catch (Exception e) { e.printStackTrace(); return; } event.detail = DND.DROP_NONE; } catch (Exception e) { e.printStackTrace(); event.detail = DND.DROP_NONE; return; } } @Override public void dragLeave(DropTargetEvent event) { super.dragLeave(event); top_composite.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLACK)); } public void dragEnter(DropTargetEvent event) { event.detail = DND.DROP_COPY; top_composite.setForeground(getDisplay().getSystemColor(SWT.COLOR_YELLOW)); } }); } top_composite.addMouseTrackListener(new MouseTrackListener() { public void mouseEnter(MouseEvent arg0) { top_composite.setForeground(getDisplay().getSystemColor(SWT.COLOR_YELLOW)); } public void mouseExit(MouseEvent arg0) { top_composite.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLACK)); } public void mouseHover(MouseEvent arg0) { top_composite.setForeground(getDisplay().getSystemColor(SWT.COLOR_YELLOW)); } }); } { composite1 = new Composite(right_composite, SWT.BORDER); FillLayout composite1Layout = new FillLayout(org.eclipse.swt.SWT.HORIZONTAL); GridData composite1LData = new GridData(); composite1LData.grabExcessHorizontalSpace = true; composite1LData.grabExcessVerticalSpace = true; composite1LData.horizontalAlignment = GridData.FILL; composite1LData.verticalAlignment = GridData.FILL; composite1.setLayoutData(composite1LData); composite1.setLayout(composite1Layout); // composite1.setBackground(SWTResourceManager.getColor(255, // 255, // 0)); getDisplay().syncExec(new Runnable() { public void run() { JFreeChart chart = createEmptyChart(createEmptyDataset()); /* final ChartComposite frame = */new ChartComposite(composite1, SWT.NONE, chart, true, true, false, true, true); } }); } } { // label2 = new Label(top_composite, SWT.NONE); // label2.setText("2512+3 patients"); // label2.setBounds(254, 7, 108, 19); } { DropTarget target2 = new DropTarget(tree1, DND.DROP_COPY); target2.setTransfer(types); target2.addDropListener(new DropTargetAdapter() { public void dragEnter(DropTargetEvent event) { event.detail = DND.DROP_COPY; } @SuppressWarnings("unchecked") public void drop(DropTargetEvent event) { if (event.data == null) { event.detail = DND.DROP_NONE; return; } try { SAXBuilder parser = new SAXBuilder(); String xmlContent = (String) event.data; java.io.StringReader xmlStringReader = new java.io.StringReader(xmlContent); org.jdom.Document tableDoc = parser.build(xmlStringReader); org.jdom.Element tableXml = tableDoc.getRootElement().getChild("query_master", Namespace.getNamespace("http://www.i2b2.org/xsd/cell/crc/psm/1.1/")); if (tableXml == null) { tableXml = tableDoc.getRootElement().getChild("query_instance", Namespace.getNamespace("http://www.i2b2.org/xsd/cell/crc/psm/1.1/")); if (tableXml == null) { MessageBox mBox = new MessageBox(tree1.getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("You can not drop this item here."); mBox.open(); event.detail = DND.DROP_NONE; return; } else { try { // JAXBUtil jaxbUtil = // AnalysisJAXBUtil.getJAXBUtil(); QueryInstanceData ndata = new QueryInstanceData(); // ndata.name(tableXml.getChildText("name")); // label1.setText("Query Name: " + // ndata.name()); ndata.xmlContent(null); ndata.id(tableXml.getChildTextTrim("query_instance_id")); ndata.userId(tableXml.getChildTextTrim("user_id")); ndata.name(tableXml.getChildTextTrim("name")); // clearTree(); insertNodes(ndata); setSelection(tree1.getItemCount() - 1); } catch (Exception e) { e.printStackTrace(); return; } event.detail = DND.DROP_NONE; return; } } try { JAXBUtil jaxbUtil = AnalysisJAXBUtil.getJAXBUtil(); QueryMasterData ndata = new QueryMasterData(); ndata.name(tableXml.getChildText("name")); // label1.setText("Query Name: " + ndata.name()); ndata.xmlContent(null); ndata.id(tableXml.getChildTextTrim("query_master_id")); ndata.userId(tableXml.getChildTextTrim("user_id")); // get query instance String xmlRequest = ndata.writeContentQueryXML(); // lastRequestMessage(xmlRequest); String xmlResponse = QueryClient.sendQueryRequestREST(xmlRequest); // lastResponseMessage(xmlResponse); JAXBElement jaxbElement = jaxbUtil.unMashallFromString(xmlResponse); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); BodyType bt = messageType.getMessageBody(); InstanceResponseType instanceResponseType = (InstanceResponseType) new JAXBUnWrapHelper() .getObjectByClass(bt.getAny(), InstanceResponseType.class); QueryInstanceData instanceData = null; XMLGregorianCalendar startDate = null; for (QueryInstanceType queryInstanceType : instanceResponseType.getQueryInstance()) { QueryInstanceData runData = new QueryInstanceData(); runData.visualAttribute("FA"); runData.tooltip("The results of the query run"); runData.id(new Integer(queryInstanceType.getQueryInstanceId()).toString()); XMLGregorianCalendar cldr = queryInstanceType.getStartDate(); runData.name(ndata.name()); if (instanceData == null) { startDate = cldr; instanceData = runData; } else { if (cldr.toGregorianCalendar().compareTo(startDate.toGregorianCalendar()) > 0) { startDate = cldr; instanceData = runData; } } } // clearTree(); insertNodes(instanceData); setSelection(tree1.getItemCount() - 1); } catch (Exception e) { e.printStackTrace(); return; } event.detail = DND.DROP_NONE; } catch (Exception e) { e.printStackTrace(); event.detail = DND.DROP_NONE; return; } } }); } sashForm.setWeights(new int[] { 30, 70 }); sashForm.setSashWidth(1); }