01: /* uDig - User Friendly Desktop Internet GIS client
02: * http://udig.refractions.net
03: * (C) 2004, Refractions Research Inc.
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation;
08: * version 2.1 of the License.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: */
15: package net.refractions.udig.project.ui.summary;
16:
17: import java.util.Collection;
18:
19: import org.eclipse.jface.dialogs.Dialog;
20: import org.eclipse.jface.dialogs.IDialogConstants;
21: import org.eclipse.jface.viewers.ITableLabelProvider;
22: import org.eclipse.jface.viewers.ITreeContentProvider;
23: import org.eclipse.jface.viewers.LabelProvider;
24: import org.eclipse.jface.viewers.TreeViewer;
25: import org.eclipse.jface.viewers.Viewer;
26: import org.eclipse.swt.SWT;
27: import org.eclipse.swt.graphics.Image;
28: import org.eclipse.swt.graphics.Point;
29: import org.eclipse.swt.layout.GridData;
30: import org.eclipse.swt.widgets.Composite;
31: import org.eclipse.swt.widgets.Control;
32: import org.eclipse.swt.widgets.Shell;
33: import org.eclipse.swt.widgets.Tree;
34: import org.eclipse.swt.widgets.TreeColumn;
35:
36: /**
37: * Displays a set of summary information in a Table
38: *
39: * @author Jesse
40: * @since 1.1.0
41: */
42: public class SummaryDialog extends Dialog {
43:
44: private String title;
45: private SummaryControl summary;
46:
47: /**
48: * @param parentShell
49: */
50: public SummaryDialog(Shell parentShell, String title,
51: Collection<SummaryData> data) {
52: super (parentShell);
53: this .title = title;
54: this .summary = new SummaryControl(data);
55: setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE
56: | SWT.APPLICATION_MODAL | getDefaultOrientation());
57: }
58:
59: @Override
60: protected void configureShell(Shell newShell) {
61: super .configureShell(newShell);
62: newShell.setText(title);
63: }
64:
65: @Override
66: protected Point getInitialSize() {
67: return new Point(600, 400);
68: }
69:
70: @Override
71: protected void createButtonsForButtonBar(Composite parent) {
72: createButton(parent, IDialogConstants.OK_ID,
73: IDialogConstants.OK_LABEL, true);
74: }
75:
76: @Override
77: protected Control createDialogArea(Composite parent) {
78: return summary.createControl(parent);
79: }
80: }
|