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());
}
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);
}
}
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);
}
}
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);
}
}
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;
}
Aggregations