Example usage for org.eclipse.swt.widgets Label setText

List of usage examples for org.eclipse.swt.widgets Label setText

Introduction

In this page you can find the example usage for org.eclipse.swt.widgets Label setText.

Prototype

public void setText(String text) 

Source Link

Document

Sets the receiver's text.

Usage

From source file:org.jfree.experimental.chart.swt.editor.SWTTitleEditor.java

/**
 * Standard constructor: builds a panel for displaying/editing the
 * properties of the specified title.//from  w  w  w .j ava  2  s.c o  m
 *
 * @param title  the title, which should be changed.
 */
SWTTitleEditor(Composite parent, int style, Title title) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    TextTitle t = (title != null ? (TextTitle) title : new TextTitle(localizationResources.getString("Title")));
    this.showTitle = (title != null);
    this.titleFont = SWTUtils.toSwtFontData(getDisplay(), t.getFont(), true);
    this.titleColor = SWTUtils.toSwtColor(getDisplay(), t.getPaint());

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));
    // row 1
    Label label = new Label(general, SWT.NONE);
    label.setText(localizationResources.getString("Show_Title"));
    GridData gridData = new GridData();
    gridData.horizontalSpan = 2;
    label.setLayoutData(gridData);
    this.showTitleCheckBox = new Button(general, SWT.CHECK);
    this.showTitleCheckBox.setSelection(this.showTitle);
    this.showTitleCheckBox.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
    this.showTitleCheckBox.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            SWTTitleEditor.this.showTitle = SWTTitleEditor.this.showTitleCheckBox.getSelection();
        }
    });
    // row 2
    new Label(general, SWT.NONE).setText(localizationResources.getString("Text"));
    this.titleField = new Text(general, SWT.BORDER);
    this.titleField.setText(t.getText());
    this.titleField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    new Label(general, SWT.NONE).setText("");
    // row 3
    new Label(general, SWT.NONE).setText(localizationResources.getString("Font"));
    this.fontField = new Text(general, SWT.BORDER);
    this.fontField.setText(this.titleFont.toString());
    this.fontField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    this.selectFontButton = new Button(general, SWT.PUSH);
    this.selectFontButton.setText(localizationResources.getString("Select..."));
    this.selectFontButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            // Create the font-change dialog
            FontDialog dlg = new FontDialog(getShell());
            dlg.setText(localizationResources.getString("Font_Selection"));
            dlg.setFontList(new FontData[] { SWTTitleEditor.this.titleFont });
            if (dlg.open() != null) {
                // Dispose of any fonts we have created
                if (SWTTitleEditor.this.font != null) {
                    SWTTitleEditor.this.font.dispose();
                }
                // Create the new font and set it into the title 
                // label
                SWTTitleEditor.this.font = new Font(getShell().getDisplay(), dlg.getFontList());
                //titleField.setFont(font);
                SWTTitleEditor.this.fontField.setText(SWTTitleEditor.this.font.getFontData()[0].toString());
                SWTTitleEditor.this.titleFont = SWTTitleEditor.this.font.getFontData()[0];
            }
        }
    });
    // row 4
    new Label(general, SWT.NONE).setText(localizationResources.getString("Color"));
    // Use a SwtPaintCanvas to show the color, note that we must set the 
    // heightHint.
    final SWTPaintCanvas colorCanvas = new SWTPaintCanvas(general, SWT.NONE, this.titleColor);
    GridData canvasGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    canvasGridData.heightHint = 20;
    colorCanvas.setLayoutData(canvasGridData);
    this.selectColorButton = new Button(general, SWT.PUSH);
    this.selectColorButton.setText(localizationResources.getString("Select..."));
    this.selectColorButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            // Create the color-change dialog
            ColorDialog dlg = new ColorDialog(getShell());
            dlg.setText(localizationResources.getString("Title_Color"));
            dlg.setRGB(SWTTitleEditor.this.titleColor.getRGB());
            RGB rgb = dlg.open();
            if (rgb != null) {
                // create the new color and set it to the 
                // SwtPaintCanvas
                SWTTitleEditor.this.titleColor = new Color(getDisplay(), rgb);
                colorCanvas.setColor(SWTTitleEditor.this.titleColor);
            }
        }
    });
}

From source file:com.rcp.wbw.demo.editor.SWTTitleEditor.java

/**
 * Standard constructor: builds a panel for displaying/editing the
 * properties of the specified title.//from   w ww.  ja  v a2 s.  c o m
 * 
 * @param parent
 *            the parent.
 * @param style
 *            the style.
 * @param title
 *            the title, which should be changed.
 * 
 */
SWTTitleEditor(Composite parent, int style, Title title) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    TextTitle t = (title != null ? (TextTitle) title : new TextTitle(localizationResources.getString("Title")));
    this.showTitle = (title != null);
    this.titleFont = SWTUtils.toSwtFontData(getDisplay(), t.getFont(), true);
    this.titleColor = SWTUtils.toSwtColor(getDisplay(), t.getPaint());

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));
    // row 1
    Label label = new Label(general, SWT.NONE);
    label.setText(localizationResources.getString("Show_Title"));
    GridData gridData = new GridData();
    gridData.horizontalSpan = 2;
    label.setLayoutData(gridData);
    this.showTitleCheckBox = new Button(general, SWT.CHECK);
    this.showTitleCheckBox.setSelection(this.showTitle);
    this.showTitleCheckBox.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
    this.showTitleCheckBox.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            SWTTitleEditor.this.showTitle = SWTTitleEditor.this.showTitleCheckBox.getSelection();
        }
    });
    // row 2
    new Label(general, SWT.NONE).setText(localizationResources.getString("Text"));
    this.titleField = new Text(general, SWT.BORDER);
    this.titleField.setText(t.getText());
    this.titleField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    new Label(general, SWT.NONE).setText("");
    // row 3
    new Label(general, SWT.NONE).setText(localizationResources.getString("Font"));
    this.fontField = new Text(general, SWT.BORDER);
    this.fontField.setText(this.titleFont.toString());
    this.fontField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    this.selectFontButton = new Button(general, SWT.PUSH);
    this.selectFontButton.setText(localizationResources.getString("Select..."));
    this.selectFontButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            // Create the font-change dialog
            FontDialog dlg = new FontDialog(getShell());
            dlg.setText(localizationResources.getString("Font_Selection"));
            dlg.setFontList(new FontData[] { SWTTitleEditor.this.titleFont });
            if (dlg.open() != null) {
                // Dispose of any fonts we have created
                if (SWTTitleEditor.this.font != null) {
                    SWTTitleEditor.this.font.dispose();
                }
                // Create the new font and set it into the title
                // label
                SWTTitleEditor.this.font = new Font(getShell().getDisplay(), dlg.getFontList());
                // titleField.setFont(font);
                SWTTitleEditor.this.fontField.setText(SWTTitleEditor.this.font.getFontData()[0].toString());
                SWTTitleEditor.this.titleFont = SWTTitleEditor.this.font.getFontData()[0];
            }
        }
    });
    // row 4
    new Label(general, SWT.NONE).setText(localizationResources.getString("Color"));
    // Use a SwtPaintCanvas to show the color, note that we must set the
    // heightHint.
    final SWTPaintCanvas colorCanvas = new SWTPaintCanvas(general, SWT.NONE, this.titleColor);
    GridData canvasGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    canvasGridData.heightHint = 20;
    colorCanvas.setLayoutData(canvasGridData);
    this.selectColorButton = new Button(general, SWT.PUSH);
    this.selectColorButton.setText(localizationResources.getString("Select..."));
    this.selectColorButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            // Create the color-change dialog
            ColorDialog dlg = new ColorDialog(getShell());
            dlg.setText(localizationResources.getString("Title_Color"));
            dlg.setRGB(SWTTitleEditor.this.titleColor.getRGB());
            RGB rgb = dlg.open();
            if (rgb != null) {
                // create the new color and set it to the
                // SwtPaintCanvas
                SWTTitleEditor.this.titleColor = new Color(getDisplay(), rgb);
                colorCanvas.setColor(SWTTitleEditor.this.titleColor);
            }
        }
    });
}

From source file:SWTBrowser.java

public SWTBrowser() {
    shell.setLayout(new GridLayout());

    ToolBar toolBar = new ToolBar(shell, SWT.FLAT | SWT.RIGHT);
    final ToolBarManager manager = new ToolBarManager(toolBar);

    Composite compositeLocation = new Composite(shell, SWT.NULL);
    compositeLocation.setLayout(new GridLayout(3, false));
    compositeLocation.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label labelAddress = new Label(compositeLocation, SWT.NULL);
    labelAddress.setText("Address");

    textLocation = new Text(compositeLocation, SWT.SINGLE | SWT.BORDER);
    textLocation.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Button buttonGo = new Button(compositeLocation, SWT.NULL);
    buttonGo.setImage(new Image(shell.getDisplay(), "java2s.gif"));

    browser = new Browser(shell, SWT.BORDER);
    browser.setLayoutData(new GridData(GridData.FILL_BOTH));

    Composite compositeStatus = new Composite(shell, SWT.NULL);
    compositeStatus.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    compositeStatus.setLayout(new GridLayout(2, false));

    labelStatus = new Label(compositeStatus, SWT.NULL);
    labelStatus.setText("Ready");
    labelStatus.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    final ProgressBar progressBar = new ProgressBar(compositeStatus, SWT.SMOOTH);

    Listener openURLListener = new Listener() {
        public void handleEvent(Event event) {
            browser.setUrl(textLocation.getText());
        }// w  w  w .j  a  va  2s.c  om
    };

    buttonGo.addListener(SWT.Selection, openURLListener);
    textLocation.addListener(SWT.DefaultSelection, openURLListener);

    // Adds tool bar items using actions.
    final Action actionBackward = new Action("&Backword", ImageDescriptor.createFromFile(null, "java2s.gif")) {
        public void run() {
            browser.back();
        }
    };
    actionBackward.setEnabled(false); // action is disabled at start up.

    final Action actionForward = new Action("&Forward",
            ImageDescriptor.createFromFile(null, "icons/web/forward.gif")) {
        public void run() {
            browser.forward();
        }
    };
    actionForward.setEnabled(false); // action is disabled at start up.

    Action actionStop = new Action("&Stop", ImageDescriptor.createFromFile(null, "icons/web/stop.gif")) {
        public void run() {
            browser.stop();
        }
    };

    Action actionRefresh = new Action("&Refresh",
            ImageDescriptor.createFromFile(null, "icons/web/refresh.gif")) {
        public void run() {
            browser.refresh();
        }
    };

    Action actionHome = new Action("&Home", ImageDescriptor.createFromFile(null, "icons/web/home.gif")) {
        public void run() {
            browser.setUrl("http://www.eclipse.org");
        }
    };

    manager.add(actionBackward);
    manager.add(actionForward);
    manager.add(actionStop);
    manager.add(actionRefresh);
    manager.add(actionHome);

    manager.update(true);
    toolBar.pack();

    browser.addLocationListener(new LocationListener() {
        public void changing(LocationEvent event) {
            // Displays the new location in the text field.
            textLocation.setText(event.location);
        }

        public void changed(LocationEvent event) {
            // Update tool bar items.
            actionBackward.setEnabled(browser.isBackEnabled());
            actionForward.setEnabled(browser.isForwardEnabled());
            manager.update(false);
        }
    });

    browser.addProgressListener(new ProgressListener() {
        public void changed(ProgressEvent event) {
            progressBar.setMaximum(event.total);
            progressBar.setSelection(event.current);
        }

        public void completed(ProgressEvent event) {
            progressBar.setSelection(0);
        }
    });

    browser.addStatusTextListener(new StatusTextListener() {
        public void changed(StatusTextEvent event) {
            labelStatus.setText(event.text);
        }
    });

    browser.addTitleListener(new TitleListener() {
        public void changed(TitleEvent event) {
            shell.setText(event.title + " - powered by SWT");
        }
    });

    initialize(display, browser);

    shell.setSize(500, 400);
    shell.open();
    //textUser.forceFocus();

    //browser.setText(
    //   "<html><body>" + "<h1>SWT &amp; JFace </h1>" + "</body/html>");

    // Set up the event loop.
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            // If no more entries in event queue
            display.sleep();
        }
    }

    display.dispose();
}

From source file:WordJumbles.java

public WordJumbles(String word) {
    this.word = word;

    shell.setText("Word Jumbles");

    labelsRowOne = new Label[word.length()];
    labelsRowTwo = new Label[word.length()];

    int width = 40;

    // In the production version, you need to implement random permutation
    // generation.
    // Apache Jakarta Commons provides this function, see
    // org.apache.commons.math.random.RandomDataImpl
    int[] randomPermutation = { 5, 2, 6, 3, 1, 4, 0 };

    for (int i = 0; i < word.length(); i++) {
        final Label labelRowOne = new Label(shell, SWT.BORDER);
        labelsRowOne[i] = labelRowOne;//from www .j ava 2  s  . c om
        labelRowOne.setBounds(10 + width * i, 10, width - 5, width - 5);
        labelRowOne.setFont(font);
        labelRowOne.setText(word.charAt(randomPermutation[i]) + "");
        labelRowOne.setAlignment(SWT.CENTER);

        setDragSource(labelRowOne);
        //setDropTarget(labelRowOne);

        final Label labelRowTwo = new Label(shell, SWT.BORDER);
        labelsRowTwo[i] = labelRowTwo;
        labelRowTwo.setBounds(10 + width * i, 20 + width, width - 5, width - 5);
        labelRowTwo.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
        labelRowTwo.setFont(font);
        labelRowTwo.setAlignment(SWT.CENTER);

        setDragSource(labelRowTwo);
        //setDropTarget(labelRowTwo);
    }

    shell.pack();
    shell.open();
    //textUser.forceFocus();

    // Set up the event loop.
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            // If no more entries in event queue
            display.sleep();
        }
    }

    display.dispose();
}

From source file:org.eclipse.swt.examples.browserexample.BrowserExample.java

public BrowserExample(Composite parent, boolean top) {
    this.parent = parent;
    try {// w  w  w  .j  a  va  2 s .c  o  m
        browser = new Browser(parent, SWT.BORDER);
    } catch (SWTError e) {
        error = e;
        /* Browser widget could not be instantiated */
        parent.setLayout(new FillLayout());
        Label label = new Label(parent, SWT.CENTER | SWT.WRAP);
        label.setText(getResourceString("BrowserNotCreated"));
        label.requestLayout();
        return;
    }
    initResources();
    final Display display = parent.getDisplay();
    browser.setData("org.eclipse.swt.examples.browserexample.BrowserApplication", this);
    browser.addOpenWindowListener(event -> {
        Shell shell = new Shell(display);
        if (icon != null)
            shell.setImage(icon);
        shell.setLayout(new FillLayout());
        BrowserExample app = new BrowserExample(shell, false);
        app.setShellDecoration(icon, true);
        event.browser = app.getBrowser();
    });
    if (top) {
        browser.setUrl(getResourceString("Startup"));
        show(false, null, null, true, true, true, true);
    } else {
        browser.addVisibilityWindowListener(VisibilityWindowListener.showAdapter(e -> {
            Browser browser = (Browser) e.widget;
            BrowserExample app = (BrowserExample) browser
                    .getData("org.eclipse.swt.examples.browserexample.BrowserApplication");
            app.show(true, e.location, e.size, e.addressBar, e.menuBar, e.statusBar, e.toolBar);
        }));
        browser.addCloseWindowListener(event -> {
            Browser browser = (Browser) event.widget;
            Shell shell = browser.getShell();
            shell.close();
        });
    }
}

From source file:org.eclipse.swt.examples.graphics.GradientDialog.java

/**
 * Creates the controls of the dialog./*  w  ww  .jav a2  s .co  m*/
 * */
public void createDialogControls(final Shell parent) {
    final Display display = parent.getDisplay();

    // message
    Label message = new Label(parent, SWT.NONE);
    message.setText(GraphicsExample.getResourceString("GradientDlgMsg"));
    GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gridData.horizontalSpan = 2;
    message.setLayoutData(gridData);

    // default colors are white and black
    if (rgb1 == null || rgb2 == null) {
        rgb1 = display.getSystemColor(SWT.COLOR_WHITE).getRGB();
        rgb2 = display.getSystemColor(SWT.COLOR_BLACK).getRGB();
    }

    // canvas
    canvas = new Canvas(parent, SWT.NONE);
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.widthHint = 200;
    gridData.heightHint = 100;
    canvas.setLayoutData(gridData);
    canvas.addListener(SWT.Paint, e -> {
        Image preview = null;
        Point size = canvas.getSize();
        Color color1 = new Color(display, rgb1);
        Color color2 = new Color(display, rgb2);
        preview = GraphicsExample.createImage(display, color1, color2, size.x, size.y);
        if (preview != null) {
            e.gc.drawImage(preview, 0, 0);
        }
        preview.dispose();
        color1.dispose();
        color2.dispose();
    });

    // composite used for both color buttons
    Composite colorButtonComp = new Composite(parent, SWT.NONE);

    // layout buttons
    RowLayout layout = new RowLayout();
    layout.type = SWT.VERTICAL;
    layout.pack = false;
    colorButtonComp.setLayout(layout);

    // position composite
    gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    colorButtonComp.setLayoutData(gridData);

    ColorMenu colorMenu = new ColorMenu();

    // color controls: first color
    colorButton1 = new Button(colorButtonComp, SWT.PUSH);
    colorButton1.setText(GraphicsExample.getResourceString("GradientDlgButton1"));
    Color color1 = new Color(display, rgb1);
    Image img1 = GraphicsExample.createImage(display, color1);
    color1.dispose();
    colorButton1.setImage(img1);
    resources.add(img1);
    menu1 = colorMenu.createMenu(parent.getParent(), gb -> {
        rgb1 = gb.getBgColor1().getRGB();
        colorButton1.setImage(gb.getThumbNail());
        if (canvas != null)
            canvas.redraw();
    });
    colorButton1.addListener(SWT.Selection, event -> {
        final Button button = (Button) event.widget;
        final Composite parent1 = button.getParent();
        Rectangle bounds = button.getBounds();
        Point point = parent1.toDisplay(new Point(bounds.x, bounds.y));
        menu1.setLocation(point.x, point.y + bounds.height);
        menu1.setVisible(true);
    });

    // color controls: second color
    colorButton2 = new Button(colorButtonComp, SWT.PUSH);
    colorButton2.setText(GraphicsExample.getResourceString("GradientDlgButton2"));
    Color color2 = new Color(display, rgb2);
    Image img2 = GraphicsExample.createImage(display, color2);
    color2.dispose();
    colorButton2.setImage(img2);
    resources.add(img2);
    menu2 = colorMenu.createMenu(parent.getParent(), gb -> {
        rgb2 = gb.getBgColor1().getRGB();
        colorButton2.setImage(gb.getThumbNail());
        if (canvas != null)
            canvas.redraw();
    });
    colorButton2.addListener(SWT.Selection, event -> {
        final Button button = (Button) event.widget;
        final Composite parent1 = button.getParent();
        Rectangle bounds = button.getBounds();
        Point point = parent1.toDisplay(new Point(bounds.x, bounds.y));
        menu2.setLocation(point.x, point.y + bounds.height);
        menu2.setVisible(true);
    });

    // composite used for ok and cancel buttons
    Composite okCancelComp = new Composite(parent, SWT.NONE);

    // layout buttons
    RowLayout rowLayout = new RowLayout();
    rowLayout.pack = false;
    rowLayout.marginTop = 5;
    okCancelComp.setLayout(rowLayout);

    // position composite
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
    gridData.horizontalSpan = 2;
    okCancelComp.setLayoutData(gridData);

    // OK button
    okButton = new Button(okCancelComp, SWT.PUSH);
    okButton.setText("&OK");
    okButton.addListener(SWT.Selection, event -> {
        returnVal = SWT.OK;
        parent.close();
    });

    // cancel button
    cancelButton = new Button(okCancelComp, SWT.PUSH);
    cancelButton.setText("&Cancel");
    cancelButton.addListener(SWT.Selection, event -> parent.close());
}

From source file:eu.stratosphere.addons.visualization.swt.SWTGateToolTip.java

public SWTGateToolTip(Shell parent, ManagementGate managementGate, int x, int y) {
    super(parent, x, y);

    int height;/*from w  ww.ja va  2  s  .  co m*/

    this.managementGate = managementGate;

    if (managementGate.isInputGate()) {
        setTitle("Input Gate " + managementGate.getIndex());
    } else {
        setTitle("Output Gate " + managementGate.getIndex());
    }

    final Color backgroundColor = getShell().getBackground();
    final Color foregroundColor = getShell().getForeground();

    final GateVisualizationData gateVisualizationData = (GateVisualizationData) managementGate.getAttachment();

    if (gateVisualizationData.isProfilingEnabled()) {
        this.chart = createChart(gateVisualizationData, backgroundColor);
        this.chart.setLayoutData(new GridData(GridData.FILL_BOTH));
        height = 200;
    } else {
        this.chart = null;
        height = 100;
    }

    final Composite tableComposite = new Composite(getShell(), SWT.NONE);
    tableComposite.setBackground(backgroundColor);
    tableComposite.setForeground(foregroundColor);

    final GridLayout tableGridLayout = new GridLayout(2, false);
    tableGridLayout.marginHeight = 0;
    tableGridLayout.marginLeft = 0;
    tableComposite.setLayout(tableGridLayout);

    // Channel type
    ChannelType channelType;
    if (managementGate.isInputGate()) {
        channelType = managementGate.getVertex().getGroupVertex().getBackwardEdge(managementGate.getIndex())
                .getChannelType();
    } else {
        channelType = managementGate.getVertex().getGroupVertex().getForwardEdge(managementGate.getIndex())
                .getChannelType();
    }

    final Label channelTypeTextLabel = new Label(tableComposite, SWT.NONE);
    channelTypeTextLabel.setBackground(backgroundColor);
    channelTypeTextLabel.setForeground(foregroundColor);
    channelTypeTextLabel.setText("Channel type:");

    this.channelTypeLabel = new Label(tableComposite, SWT.NONE);
    this.channelTypeLabel.setBackground(backgroundColor);
    this.channelTypeLabel.setForeground(foregroundColor);
    this.channelTypeLabel.setText(channelType.toString());

    if (!this.managementGate.isInputGate()) {
        final ManagementGroupEdge groupEdge = this.managementGate.getVertex().getGroupVertex()
                .getForwardEdge(this.managementGate.getIndex());
        final GroupEdgeVisualizationData groupEdgeVisualizationData = (GroupEdgeVisualizationData) groupEdge
                .getAttachment();

        if (groupEdgeVisualizationData.isIOBottleneck()) {
            this.warningComposite = createWarningComposite(WARNINGTEXT, SWT.ICON_WARNING);
            height += ICONSIZE;
        } else {
            this.warningComposite = null;
        }
    } else {
        this.warningComposite = null;
    }

    getShell().setSize(WIDTH, height);

    finishInstantiation(x, y, WIDTH, false);
}

From source file:edu.isistan.carcha.plugin.editors.DXMIEditor.java

/**
 * Creates the DDD list page./*from   w w  w  . j  a  v a  2s  .co m*/
 */
void createListPage() {
    final Composite composite = new Composite(getContainer(), SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 4));
    composite.setLayout(new GridLayout());
    Label concernLabel = new Label(composite, SWT.BORDER);
    concernLabel.setText("Design Decisions");
    concernLabel.setToolTipText("This are the Design Decisions detected in the architectural document");
    GridData gridData = new GridData(SWT.LEFT, SWT.LEFT, false, false);
    concernLabel.setLayoutData(gridData);

    ddsViewer = new TableViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    createColumns(composite, ddsViewer);

    final Table table = ddsViewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    ddsViewer.setContentProvider(new ArrayContentProvider());

    getSite().setSelectionProvider(ddsViewer);
    // define layout for the viewer
    gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    ddsViewer.getControl().setLayoutData(gridData);

    int index = addPage(composite);
    setPageText(index, "List");
}

From source file:SWTBrowserDemo.java

public SWTBrowserDemo(Composite parent, boolean top) {
    this.parent = parent;
    try {/*from w ww  .j a  v  a2  s .co m*/
        browser = new Browser(parent, SWT.BORDER);
    } catch (SWTError e) {
        error = e;
        /* Browser widget could not be instantiated */
        parent.setLayout(new FillLayout());
        Label label = new Label(parent, SWT.CENTER | SWT.WRAP);
        label.setText(getResourceString("BrowserNotCreated"));
        parent.layout(true);
        return;
    }
    initResources();
    final Display display = parent.getDisplay();
    browser.setData("org.eclipse.swt.examples.browserexample.BrowserApplication", this);
    browser.addOpenWindowListener(new OpenWindowListener() {
        public void open(WindowEvent event) {
            Shell shell = new Shell(display);
            if (icon != null)
                shell.setImage(icon);
            shell.setLayout(new FillLayout());
            SWTBrowserDemo app = new SWTBrowserDemo(shell, false);
            app.setShellDecoration(icon, true);
            event.browser = app.getBrowser();
        }
    });
    if (top) {
        browser.setUrl(getResourceString("Startup"));
        show(false, null, null, true, true, true, true);
    } else {
        browser.addVisibilityWindowListener(new VisibilityWindowListener() {
            public void hide(WindowEvent e) {
            }

            public void show(WindowEvent e) {
                Browser browser = (Browser) e.widget;
                SWTBrowserDemo app = (SWTBrowserDemo) browser
                        .getData("org.eclipse.swt.examples.browserexample.BrowserApplication");
                app.show(true, e.location, e.size, e.addressBar, e.menuBar, e.statusBar, e.toolBar);
            }
        });
        browser.addCloseWindowListener(new CloseWindowListener() {
            public void close(WindowEvent event) {
                Browser browser = (Browser) event.widget;
                Shell shell = browser.getShell();
                shell.close();
            }
        });
    }
}

From source file:de.dekarlab.moneybuilder.view.AnalyticsView.java

/**
 * Create GUI method./*  w w  w. j ava  2s  .com*/
 */
protected void initView() throws Exception {
    // init layout
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    setLayout(layout);
    Label lblReport = new Label(this, SWT.NONE);
    lblReport.setText(App.getGuiProp("analytics.reports"));

    cmbReports = new Combo(this, SWT.READ_ONLY);
    cmbReports.add(App.getGuiProp("report.allperiods.capital"));
    cmbReports.add(App.getGuiProp("report.allperiods.pl"));
    cmbReports.add(App.getGuiProp("report.income"));
    cmbReports.add(App.getGuiProp("report.expenses"));
    cmbReports.add(App.getGuiProp("report.assets"));
    cmbReports.add(App.getGuiProp("report.liability"));
    cmbReports.add(App.getGuiProp("report.profit"));
    cmbReports.select(0);
    createChart();
    // select by default
    cmbReports.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event arg0) {
            createChart();
        }
    });
}