Search in sources :

Example 1 with ImageFigure

use of org.eclipse.draw2d.ImageFigure in project tdi-studio-se by Talend.

the class ConnectionTraceFigure method setTraceData.

public void setTraceData(TraceData data, boolean flag, boolean traceFlag) {
    if (data != null) {
        List childrens = this.getChildren();
        childrens.clear();
        boolean noVarNameDefined = false;
        Figure outlineFigure = new Figure();
        outlineFigure.setLayoutManager(new ToolbarLayout(true));
        int title1With = 0;
        int title2With = 0;
        if (tooltip != null) {
            collapseButton = new CollapseFigure();
            collapseButton.setCollapsed(connection.getConnectionTrace().isCollapse());
            collapseButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent event) {
                    connection.getConnectionTrace().setCollapse(!connection.getConnectionTrace().isCollapse());
                    collapseButton.setCollapsed(connection.getConnectionTrace().isCollapse());
                    refreshCollapseStatus();
                }
            });
            if (flag == true) {
                outlineFigure.add(collapseButton);
            }
        }
        // int sepIndex = data.indexOf(FIELD_SEP); // index separator for row name
        //
        // String dataWithoutRowName = data.substring(sepIndex + 1);
        // sepIndex = dataWithoutRowName.indexOf(FIELD_SEP);
        int lineNumber = data.getNbLine();
        SimpleHtmlFigure titleFigure = new SimpleHtmlFigure();
        //$NON-NLS-1$
        titleFigure.setText("");
        titleFigure.setText(//$NON-NLS-1$
        "<font color='#0000FF'> <b> " + connection.getConnectionLabel().getLabelText() + //$NON-NLS-1$ 
        "</b></font>");
        if (tooltip != null) {
            titleFigure.setBackgroundColor(ColorConstants.white);
            titleFigure.setOpaque(false);
        }
        titleFigure.getPreferredSize().expand(20, 2);
        title1With = titleFigure.getPreferredSize().width;
        SimpleHtmlFigure titleFigureSe = new SimpleHtmlFigure();
        //$NON-NLS-1$ //$NON-NLS-2$
        titleFigureSe.setText(" <font color='#808080'>Current row : " + lineNumber + "</font>");
        if (tooltip != null) {
            titleFigureSe.setBackgroundColor(ColorConstants.white);
            titleFigureSe.setOpaque(false);
        }
        titleFigureSe.getPreferredSize().expand(20, 2);
        title2With = titleFigureSe.getPreferredSize().width;
        if (flag == true) {
            outlineFigure.add(titleFigure);
        }
        ImageFigure figure = new ImageFigure(getTraceConnectionImage(flag));
        outlineFigure.add(figure);
        if (flag == true) {
            outlineFigure.add(titleFigureSe);
        }
        outlineFigure.setBorder(new LineBorder(ColorConstants.darkGray, SWT.LEFT | SWT.RIGHT | SWT.TOP | SWT.BOTTOM));
        outlineFigure.setOpaque(true);
        add(outlineFigure);
        Dimension size = titleFigure.getPreferredSize().getCopy();
        int variableWidth = 0;
        int valueWidth = 0;
        // String lineInfo = dataWithoutRowName.substring(sepIndex + 1);
        // ArrayList columnValueList = new ArrayList();
        // int lastLocation = 0;
        // int endLocation = lineInfo.indexOf(FIELD_SEP, lastLocation);
        // while (endLocation != -1) {
        // columnValueList.add(lineInfo.substring(lastLocation, endLocation + 1));
        // lastLocation = endLocation + 2;
        // endLocation = lineInfo.indexOf(FIELD_SEP, lastLocation);
        // }
        // if (columnValueList.size() > 0 && connection.traceColumn.size() == 0
        // && connection.getPropertyValue(EParameterName.TRACES_CONNECTION_FILTER.getName()) != null) {
        // Object value = connection.getPropertyValue(EParameterName.TRACES_CONNECTION_FILTER.getName());
        // lineInfo = "";
        // for (Object o : columnValueList) {
        // for (Object o1 : (ArrayList) value) {
        // if (o1 instanceof HashMap) {
        // String columnValue = o.toString();
        // if (columnValue.indexOf("=") > 0) {
        // if (((HashMap) o1).get(IConnection.TRACE_SCHEMA_COLUMN).toString()
        // .equals(columnValue.substring(0, columnValue.indexOf("=")).trim())
        // && Boolean.TRUE.toString().equals(
        // ((HashMap) o1).get(IConnection.TRACE_SCHEMA_COLUMN_CHECKED).toString())) {
        // lineInfo += columnValue;
        // break;
        // }
        // }
        // }
        // }
        // }
        // }
        // if (columnValueList.size() > 0 && (connection.traceColumn.size() > 0 || connection.setNullColumn ==
        // true)) {
        // lineInfo = "";
        // Object value = connection.getPropertyValue(EParameterName.TRACES_CONNECTION_FILTER.getName());
        // int columnNum = 0;
        // for (Object o : columnValueList) {
        // if (connection.traceColumn != null && connection.traceColumn.contains(columnNum)) {
        // lineInfo += o.toString();
        // } else {
        // for (Object o1 : (ArrayList) value) {
        // if (((HashMap) o1).get(IConnection.TRACE_SCHEMA_COLUMN).toString()
        // .equals(o.toString().substring(0, o.toString().indexOf("=")).trim())
        // && Boolean.TRUE.toString().equals(
        // ((HashMap) o1).get(IConnection.TRACE_SCHEMA_COLUMN_CHECKED).toString())) {
        // lineInfo += o.toString();
        // break;
        // }
        // }
        // }
        // columnNum++;
        // }
        // }
        // StringTokenizer st = new StringTokenizer(lineInfo, FIELD_SEP);
        List<Map<String, Object>> columnsCheckInfo = null;
        if (data.getData() != null) {
            columnsCheckInfo = TracesConnectionUtils.getTraceConnectionFilterValues(connection);
            Iterator<String> iterator = data.getData().keySet().iterator();
            while (iterator.hasNext()) {
                String columnLabel = iterator.next();
                if (columnsCheckInfo != null && !isColumnChecked(columnsCheckInfo, columnLabel)) {
                    continue;
                }
                // String str = st.nextToken();
                // int valueStart = str.indexOf(FIELD_EQUAL);
                // if (valueStart != -1) {
                String formatedVariable = //$NON-NLS-1$
                "<font color='#000000'>  <b>" + columnLabel + //$NON-NLS-1$
                "</b></font>";
                //$NON-NLS-1$ //$NON-NLS-2$
                String formatedValue = "<font color='#FF8040'> <b>" + data.getData().get(columnLabel) + "</b></font>";
                SimpleHtmlFigure var = new SimpleHtmlFigure();
                var.setText(formatedVariable);
                SimpleHtmlFigure value = new SimpleHtmlFigure();
                value.setText(formatedValue);
                Dimension varSize = var.getPreferredSize();
                varSize.expand(0, 3);
                var.setPreferredSize(varSize);
                if (varSize.width > variableWidth) {
                    variableWidth = varSize.width;
                }
                Dimension valueSize = value.getPreferredSize();
                valueSize.expand(0, 3);
                value.setPreferredSize(valueSize);
                if (valueSize.width > valueWidth) {
                    valueWidth = valueSize.width;
                }
                size.expand(0, varSize.height);
            // } else {
            // noVarNameDefined = true;
            //                    String formatedValue = "<font color='#FF8040'> <b>" + str + "</b></font>"; //$NON-NLS-1$ //$NON-NLS-2$
            // SimpleHtmlFigure value = new SimpleHtmlFigure();
            // value.setText(formatedValue);
            // Dimension valueSize = value.getPreferredSize();
            // if (valueSize.width > valueWidth) {
            // valueWidth = valueSize.width;
            // }
            // size.expand(0, valueSize.height);
            // }
            }
        }
        variableWidth += 10;
        valueWidth += 10;
        if (variableWidth < title1With) {
            variableWidth = title1With;
        }
        if (valueWidth < title2With) {
            valueWidth = title2With;
        }
        // if (maximized) {
        if (variableWidth < MAX_VARIABLE_WIDTH) {
            variableWidth = MAX_VARIABLE_WIDTH;
        }
        if (valueWidth < MAX_VALUE_WIDTH) {
            valueWidth = MAX_VALUE_WIDTH;
        }
        if ((variableWidth + valueWidth) < titleFigure.getPreferredSize().width) {
            valueWidth = titleFigure.getPreferredSize().width - variableWidth;
        }
        if (noVarNameDefined) {
            if (titleFigure.getPreferredSize().width > valueWidth) {
                valueWidth = titleFigure.getPreferredSize().width;
            }
        }
        // st = new StringTokenizer(lineInfo, FIELD_SEP);
        int nbVar = 0;
        if (data.getData() != null) {
            Iterator<String> iterator = data.getData().keySet().iterator();
            while (iterator.hasNext()) {
                String columnLabel = iterator.next();
                if (columnsCheckInfo != null && !isColumnChecked(columnsCheckInfo, columnLabel)) {
                    continue;
                }
                // int valueStart = str.indexOf(FIELD_EQUAL);
                // if (valueStart != -1) {
                String formatedVariable = //$NON-NLS-1$
                "<font color='#000000'>  <b>" + columnLabel + //$NON-NLS-1$
                "</b></font>";
                //$NON-NLS-1$ //$NON-NLS-2$
                String formatedValue = "<font color='#FF8040'> <b>" + data.getData().get(columnLabel) + "</b></font>";
                SimpleHtmlFigure var = new SimpleHtmlFigure();
                var.setText(formatedVariable);
                SimpleHtmlFigure value = new SimpleHtmlFigure();
                value.setText(formatedValue);
                Dimension valueSize = value.getPreferredSize();
                valueSize.expand(0, 3);
                value.setPreferredSize(valueSize);
                value.setPreferredSize(valueWidth, valueSize.height);
                var.setBorder(new LineBorder(ColorConstants.darkGray, SWT.RIGHT));
                Dimension varSize = var.getPreferredSize();
                varSize.expand(0, 3);
                var.setPreferredSize(varSize);
                var.setPreferredSize(variableWidth, varSize.height);
                ToolbarLayout variableLayout = new ToolbarLayout(true);
                variableFigure = new Figure();
                variableFigure.setLayoutManager(variableLayout);
                variableFigure.add(var);
                variableFigure.add(value);
                if (flag == true) {
                    add(variableFigure);
                }
            // } else {
            //                    String formatedValue = "<font color='#FF8040'> <b> " + str + "</b></font>"; //$NON-NLS-1$ //$NON-NLS-2$
            // SimpleHtmlFigure value = new SimpleHtmlFigure();
            // value.setText(formatedValue);
            //
            // Dimension valueSize = value.getPreferredSize();
            // valueSize.expand(0, 3);
            // value.setPreferredSize(valueSize);
            // value.setPreferredSize(valueWidth, valueSize.height);
            //
            // ToolbarLayout variableLayout = new ToolbarLayout(true);
            // variableFigure = new Figure();
            // variableFigure.setLayoutManager(variableLayout);
            // variableFigure.add(value);
            // if (flag == true) {
            // add(variableFigure);
            // }
            // }
            }
            if (tooltip != null) {
                if (variableFigure != null) {
                    variableFigure.setBorder(new LineBorder(ColorConstants.darkGray, SWT.LEFT | SWT.RIGHT));
                }
            }
            if (variableFigure != null) {
                variableFigure.setOpaque(true);
            }
            if ((nbVar % 2) != 0) {
                if (tooltip != null) {
                    if (variableFigure != null) {
                        variableFigure.setBackgroundColor(ColorConstants.white);
                    }
                }
            } else {
                if (variableFigure != null) {
                    variableFigure.setBackgroundColor(BACKGROUND);
                }
            }
            nbVar++;
        }
        if (tooltip != null) {
            if (variableFigure != null) {
                variableFigure.setBorder(new LineBorder(ColorConstants.darkGray, SWT.LEFT | SWT.BOTTOM | SWT.RIGHT));
            }
        }
        if (maximized) {
            this.setVariableFigureBorder();
        }
        if (noVarNameDefined) {
            size.width = valueWidth;
        } else {
            size.width = variableWidth + valueWidth;
        }
        if (size.width < titleFigure.getPreferredSize().width) {
            size.width = titleFigure.getPreferredSize().width;
        }
        // size.width = size.width * 2;
        size.expand(5, 3);
        setPreferredSize(size);
        setVisible(true);
        if (!flag) {
            this.remove(outlineFigure);
            add(figure);
        }
    } else {
        if (traceFlag) {
            Image enableImage = getTraceConnectionImage(flag);
            setPreferredSize(enableImage.getImageData().width, enableImage.getImageData().height);
            this.getChildren().clear();
            ImageFigure figure = new ImageFigure(enableImage);
            add(figure);
            setVisible(true);
        } else {
            setPreferredSize(0, 0);
            setVisible(false);
        }
    }
    if (tooltip != null) {
        if (flag) {
            tooltip.setTraceData(data, flag, traceFlag);
        } else {
            tooltip.setTraceData(data, flag, false);
        }
    }
    contents = new ArrayList(getChildren());
    refreshCollapseStatus();
}
Also used : ActionEvent(org.eclipse.draw2d.ActionEvent) ArrayList(java.util.ArrayList) Dimension(org.eclipse.draw2d.geometry.Dimension) Image(org.eclipse.swt.graphics.Image) EImage(org.talend.commons.ui.runtime.image.EImage) ECoreImage(org.talend.commons.ui.runtime.image.ECoreImage) IFigure(org.eclipse.draw2d.IFigure) ImageFigure(org.eclipse.draw2d.ImageFigure) SimpleHtmlFigure(org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure) Figure(org.eclipse.draw2d.Figure) SimpleHtmlFigure(org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure) ToolbarLayout(org.eclipse.draw2d.ToolbarLayout) ActionListener(org.eclipse.draw2d.ActionListener) ArrayList(java.util.ArrayList) List(java.util.List) ImageFigure(org.eclipse.draw2d.ImageFigure) Map(java.util.Map)

Example 2 with ImageFigure

use of org.eclipse.draw2d.ImageFigure in project tdi-studio-se by Talend.

the class JobletContainerFigure method setProgressData.

public void setProgressData(RectangleFigure progressBarFigure, Double extentString, int extent) {
    progressBarFigure.getChildren().clear();
    int nodeX = progressBarFigure.getLocation().x;
    int nodeY = progressBarFigure.getLocation().y;
    if (extentString == 10) {
        ImageFigure progressDataFigure = new ImageFigure();
        Image image = ImageProvider.getImage(ECoreImage.MRGREEBAR);
        progressDataFigure.setImage(image);
        progressDataFigure.setVisible(true);
        progressBarFigure.add(progressDataFigure);
    } else if (extentString > 0 && extentString < 10) {
        for (int i = 0; i < extentString; i++) {
            ImageFigure progressDataFigure = new ImageFigure();
            Image image = ImageProvider.getImage(ECoreImage.MRREDBAR);
            progressDataFigure.setImage(image);
            progressDataFigure.setVisible(true);
            progressBarFigure.add(progressDataFigure);
            int imageWith = image.getImageData().width;
            if (i != 0) {
                Point point = new Point(nodeX + i * imageWith, nodeY);
                progressDataFigure.setLocation(point);
            }
        }
        for (int j = 0; j < (10 - extentString); j++) {
            ImageFigure progressDataFigure = new ImageFigure();
            Image image = ImageProvider.getImage(ECoreImage.MRGRAYBAR);
            progressDataFigure.setImage(image);
            progressDataFigure.setVisible(true);
            progressBarFigure.add(progressDataFigure);
            int imageWith = image.getImageData().width;
            if (j != 0) {
                Point point = new Point(nodeX + extentString * imageWith + j * imageWith, nodeY);
                progressDataFigure.setLocation(point);
            }
        }
    } else if (extentString == 0) {
        progressBarFigure.getChildren().clear();
    }
}
Also used : ImageFigure(org.eclipse.draw2d.ImageFigure) Point(org.eclipse.draw2d.geometry.Point) Image(org.eclipse.swt.graphics.Image) EImage(org.talend.commons.ui.runtime.image.EImage) ECoreImage(org.talend.commons.ui.runtime.image.ECoreImage) Point(org.eclipse.draw2d.geometry.Point)

Example 3 with ImageFigure

use of org.eclipse.draw2d.ImageFigure in project tdi-studio-se by Talend.

the class ConnectionResumingFigure method setResumingCheckPoint.

public void setResumingCheckPoint(boolean traceFlag) {
    if (traceFlag) {
        Image enableImage = getResumingConnectionImage();
        setPreferredSize(enableImage.getImageData().width, enableImage.getImageData().height);
        this.getChildren().clear();
        ImageFigure figure = new ImageFigure(enableImage);
        add(figure);
        setVisible(true);
    } else {
        setPreferredSize(0, 0);
        setVisible(false);
    }
// if (tooltip != null) {
// tooltip.setTraceData(data, flag, traceFlag);
// }
}
Also used : ImageFigure(org.eclipse.draw2d.ImageFigure) Image(org.eclipse.swt.graphics.Image) ECoreImage(org.talend.commons.ui.runtime.image.ECoreImage)

Example 4 with ImageFigure

use of org.eclipse.draw2d.ImageFigure in project tdi-studio-se by Talend.

the class NodeProgressBarFigure method setProgressData.

public void setProgressData(Double extent) {
    List childs = this.getChildren();
    childs.clear();
    if (extent == 0) {
        return;
    }
    Figure baseFigure = new Figure();
    baseFigure.setLayoutManager(new ToolbarLayout(true));
    baseFigure.setVisible(true);
    Double extentString = Math.floor(extent / 10);
    Double extentFlag = Math.floor(extent);
    Figure progressBarFigure = new Figure();
    progressBarFigure.setBorder(new LineBorder(ColorConstants.black, 1));
    progressBarFigure.setLayoutManager(new ToolbarLayout(true));
    progressBarFigure.setSize(60, 10);
    progressBarFigure.setPreferredSize(60, 10);
    progressBarFigure.setVisible(true);
    SimpleHtmlFigure dataFigure = new SimpleHtmlFigure();
    dataFigure.setVisible(true);
    // Font font = new Font(Display.getDefault(), "Arial", 9, SWT.ITALIC);
    // dataFigure.setFont(font);
    //
    //        dataFigure.setText(extentFlag.intValue() + "%");//$NON-NLS-1$
    dataFigure.setText(//$NON-NLS-1$
    "<font color='#000000'> <b> " + extentFlag.intValue() + "%" + //$NON-NLS-1$ //$NON-NLS-2$
    "</b></font>");
    // dataFigure.setSize(27, 12);
    // dataFigure.setPreferredSize(27, 12);
    int nodeX = progressBarFigure.getLocation().x;
    int nodeY = progressBarFigure.getLocation().y;
    if (extentString == 0) {
        if (extent > 0 && extent < 1) {
            ImageFigure progressDataFigure = new ImageFigure();
            Image image = ImageProvider.getImage(ECoreImage.PROGRESSGRAYBAR);
            progressDataFigure.setImage(image);
            progressDataFigure.setVisible(true);
            progressBarFigure.add(progressDataFigure);
        } else if (extent >= 1 && extent < 10) {
            ImageFigure progressDataFigure = new ImageFigure();
            Image image = ImageProvider.getImage(ECoreImage.PROGRESSGRAYGEBAR);
            progressDataFigure.setImage(image);
            progressDataFigure.setVisible(true);
            progressBarFigure.add(progressDataFigure);
        }
    } else if (extentString == 10) {
        ImageFigure progressDataFigure = new ImageFigure();
        Image image = ImageProvider.getImage(ECoreImage.PROGRESSGREEBAR);
        progressDataFigure.setImage(image);
        progressDataFigure.setVisible(true);
        progressBarFigure.add(progressDataFigure);
    } else if (extentString > 0 && extentString < 10) {
        for (int i = 0; i < extentString; i++) {
            ImageFigure progressDataFigure = new ImageFigure();
            Image image = ImageProvider.getImage(ECoreImage.PROGRESSBAR);
            progressDataFigure.setImage(image);
            progressDataFigure.setVisible(true);
            progressBarFigure.add(progressDataFigure);
            int imageWith = image.getImageData().width;
            if (i != 0) {
                Point point = new Point(nodeX + i * imageWith, nodeY);
                progressDataFigure.setLocation(point);
            }
        }
        for (int j = 0; j < (10 - extentString); j++) {
            ImageFigure progressDataFigure = new ImageFigure();
            Image image = ImageProvider.getImage(ECoreImage.PROGRESSBARBlACK);
            progressDataFigure.setImage(image);
            progressDataFigure.setVisible(true);
            progressBarFigure.add(progressDataFigure);
            int imageWith = image.getImageData().width;
            if (j != 0) {
                Point point = new Point(nodeX + extentString * imageWith + j * imageWith, nodeY);
                progressDataFigure.setLocation(point);
            }
        }
    }
    baseFigure.setSize(dataFigure.getPreferredSize().width + progressBarFigure.getPreferredSize().width, dataFigure.getPreferredSize().height);
    baseFigure.setPreferredSize(dataFigure.getPreferredSize().width + progressBarFigure.getPreferredSize().width, dataFigure.getPreferredSize().height);
    baseFigure.add(progressBarFigure);
    baseFigure.add(dataFigure);
    this.add(baseFigure);
    this.setSize(baseFigure.getSize());
}
Also used : ToolbarLayout(org.eclipse.draw2d.ToolbarLayout) LineBorder(org.eclipse.draw2d.LineBorder) List(java.util.List) ImageFigure(org.eclipse.draw2d.ImageFigure) Point(org.eclipse.draw2d.geometry.Point) Image(org.eclipse.swt.graphics.Image) ECoreImage(org.talend.commons.ui.runtime.image.ECoreImage) Point(org.eclipse.draw2d.geometry.Point) Figure(org.eclipse.draw2d.Figure) ImageFigure(org.eclipse.draw2d.ImageFigure) SimpleHtmlFigure(org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure) SimpleHtmlFigure(org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure)

Example 5 with ImageFigure

use of org.eclipse.draw2d.ImageFigure in project cogtool by cogtool.

the class FrameUIModel method setUpFrameContents.

/**
     * Set up the contents of the frame.
     * This creates the scalable figure and sets the initial scaling.
     *
     * The layout manager is also created with an XYLayout to allow absolute
     * positioning of elements.
     *
     * All structures needed to support drawing and selecting objects are
     * created here.
     *
     * @param double Scale: used to set the initial size of the contents.
     */
protected void setUpFrameContents(double scale) {
    // Set up the content pane
    // Create the underlying contents pane.
    // And set the contents pane's default widget color.
    contents = new ScalableFrameFigure(frame.getWidgetColor());
    contents.setScale(scale);
    contents.setLayoutManager(new XYLayout());
    // Create a new graphical widget for each widget in Frame.
    Iterator<IWidget> modelWidgets = frame.getWidgets().iterator();
    while (modelWidgets.hasNext()) {
        IWidget w = modelWidgets.next();
        createGraphicalWidget(w);
    }
    // Initialize the background image
    backgroundImage = new ImageFigure();
    final byte[] bgImg = frame.getBackgroundImage();
    if (bgImg != null) {
        if (lazyLoading) {
            // Use a thread to load the image, then set it later
            ThreadManager.IWorkThread imageLoadThread = new CogToolWorkThread() {

                protected Image img = null;

                public void doWork() {
                    // Performed by the scheduled thread
                    img = new Image(null, new ByteArrayInputStream(bgImg));
                }

                @Override
                public void doneCallback() {
                    // Performed by the main UI thread
                    if (img != null) {
                        if (isDisposed) {
                            img.dispose();
                        } else {
                            backgroundImage.setImage(img);
                        }
                    }
                    // TODO: We might want to add a real logging package
                    if (exBucket.containsExceptions()) {
                        // TODO: It is unclear what to do here.  Maybe
                        // we should just replace failed images with red
                        // Xs rather than popping up a dialog box
                        System.err.println(exBucket);
                    //                                RcvrExceptionHandler.recoverWorkThread(this,
                    //                                                                       interaction);
                    }
                }
            };
            ThreadManager.startNewThread(imageLoadThread, 2);
        } else {
            try {
                // = AUIModel.imageCache.get(frame);
                Image img = null;
                if (img == null) {
                    img = new Image(null, new ByteArrayInputStream(bgImg));
                //                        AUIModel.imageCache.put(frame, img);
                }
                backgroundImage.setImage(img);
            } catch (SWTException ex) {
                throw new GraphicsUtil.ImageException("Setting frame background image failed", ex);
            }
        }
        backgroundImage.setBounds(PrecisionUtilities.getDraw2DRectangle(frame.getBackgroundBounds()));
    }
    // Always align the picture to top left corner
    backgroundImage.setAlignment(PositionConstants.NORTH | PositionConstants.WEST);
    // Resize to preferred size.
    DoubleSize s = getPreferredSize();
    // Set the size of the contents area to fit all elements.
    contents.setSize(PrecisionUtilities.round(s.width), PrecisionUtilities.round(s.height));
    // Draw all widgets.
    drawWidgets();
}
Also used : Image(org.eclipse.swt.graphics.Image) DoubleSize(edu.cmu.cs.hcii.cogtool.model.DoubleSize) CogToolWorkThread(edu.cmu.cs.hcii.cogtool.CogToolWorkThread) SWTException(org.eclipse.swt.SWTException) ByteArrayInputStream(java.io.ByteArrayInputStream) XYLayout(org.eclipse.draw2d.XYLayout) ImageFigure(org.eclipse.draw2d.ImageFigure) GraphicsUtil(edu.cmu.cs.hcii.cogtool.util.GraphicsUtil) ThreadManager(edu.cmu.cs.hcii.cogtool.util.ThreadManager) ScalableFrameFigure(edu.cmu.cs.hcii.cogtool.view.ScalableFrameFigure) IWidget(edu.cmu.cs.hcii.cogtool.model.IWidget)

Aggregations

ImageFigure (org.eclipse.draw2d.ImageFigure)10 Image (org.eclipse.swt.graphics.Image)6 ECoreImage (org.talend.commons.ui.runtime.image.ECoreImage)4 List (java.util.List)3 Figure (org.eclipse.draw2d.Figure)3 IFigure (org.eclipse.draw2d.IFigure)3 ToolbarLayout (org.eclipse.draw2d.ToolbarLayout)3 Point (org.eclipse.draw2d.geometry.Point)3 Label (org.eclipse.draw2d.Label)2 LineBorder (org.eclipse.draw2d.LineBorder)2 MarginBorder (org.eclipse.draw2d.MarginBorder)2 Rectangle (org.eclipse.draw2d.geometry.Rectangle)2 EImage (org.talend.commons.ui.runtime.image.EImage)2 SimpleHtmlFigure (org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure)2 CogToolWorkThread (edu.cmu.cs.hcii.cogtool.CogToolWorkThread)1 DoubleSize (edu.cmu.cs.hcii.cogtool.model.DoubleSize)1 IWidget (edu.cmu.cs.hcii.cogtool.model.IWidget)1 GraphicsUtil (edu.cmu.cs.hcii.cogtool.util.GraphicsUtil)1 ThreadManager (edu.cmu.cs.hcii.cogtool.util.ThreadManager)1 ScalableFrameFigure (edu.cmu.cs.hcii.cogtool.view.ScalableFrameFigure)1