Search in sources :

Example 1 with LineBorder

use of org.eclipse.draw2d.LineBorder 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 2 with LineBorder

use of org.eclipse.draw2d.LineBorder in project cubrid-manager by CUBRID.

the class TableFigure method setHovered.

/**
	 * Set hover state to the figure
	 *
	 * @param isHovered
	 */
public void setHovered(boolean isHovered) {
    LineBorder lineBorder = (LineBorder) getBorder();
    if (isHovered) {
        this.setBackgroundColor(hoverBackgroundColor);
        lineBorder.setColor(hoverBorderColor);
    } else {
        this.setBackgroundColor(defaultBackgroundColor);
        lineBorder.setColor(defaultBorderColor);
    }
}
Also used : LineBorder(org.eclipse.draw2d.LineBorder)

Example 3 with LineBorder

use of org.eclipse.draw2d.LineBorder in project cubrid-manager by CUBRID.

the class TableFigure method setDisabled.

public void setDisabled(boolean isDisable) {
    LineBorder lineBorder = (LineBorder) getBorder();
    if (isDisable) {
        this.setBackgroundColor(disableBackgroundColor);
        lineBorder.setColor(disableBorderColor);
    } else {
        setSelected(isSelected);
    }
}
Also used : LineBorder(org.eclipse.draw2d.LineBorder)

Example 4 with LineBorder

use of org.eclipse.draw2d.LineBorder in project cubrid-manager by CUBRID.

the class TableFigure method setNormalState.

public void setNormalState() {
    LineBorder lineBorder = (LineBorder) this.getBorder();
    this.setBackgroundColor(defaultBackgroundColor);
    lineBorder.setColor(defaultBorderColor);
    if (lineBorder.getWidth() != 1 && !isSelected()) {
        lineBorder.setWidth(1);
    }
}
Also used : LineBorder(org.eclipse.draw2d.LineBorder)

Example 5 with LineBorder

use of org.eclipse.draw2d.LineBorder in project cubrid-manager by CUBRID.

the class TableFigure method setSelected.

public void setSelected(boolean isSelected) {
    LineBorder lineBorder = (LineBorder) getBorder();
    if (isSelected) {
        this.setBackgroundColor(selectedBackgroundColor);
        lineBorder.setColor(selectedBorderColor);
    } else {
        this.setBackgroundColor(defaultBackgroundColor);
        lineBorder.setColor(defaultBorderColor);
    }
    if (lineBorder.getWidth() != 1 && !isSelected) {
        lineBorder.setWidth(1);
    }
    this.isSelected = isSelected;
}
Also used : LineBorder(org.eclipse.draw2d.LineBorder)

Aggregations

LineBorder (org.eclipse.draw2d.LineBorder)15 Label (org.eclipse.draw2d.Label)4 Figure (org.eclipse.draw2d.Figure)3 IFigure (org.eclipse.draw2d.IFigure)3 MarginBorder (org.eclipse.draw2d.MarginBorder)3 ToolbarLayout (org.eclipse.draw2d.ToolbarLayout)3 Image (org.eclipse.swt.graphics.Image)3 ImageFigure (org.eclipse.draw2d.ImageFigure)2 RectangleFigure (org.eclipse.draw2d.RectangleFigure)2 ScrollPane (org.eclipse.draw2d.ScrollPane)2 Point (org.eclipse.draw2d.geometry.Point)2 ECoreImage (org.talend.commons.ui.runtime.image.ECoreImage)2 SimpleHtmlFigure (org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure)2 TableFigure (com.cubrid.common.ui.er.figures.TableFigure)1 List (java.util.List)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 EImage (org.talend.commons.ui.runtime.image.EImage)1 Node (org.talend.designer.core.ui.editor.nodes.Node)1 GenericFigure (org.talend.designer.gefabstractmap.figures.GenericFigure)1 VarNodeTextLabel (org.talend.designer.gefabstractmap.figures.VarNodeTextLabel)1