use of org.eclipse.swt.events.PaintEvent in project netxms by netxms.
the class SplashHandler method init.
/* (non-Javadoc)
* @see org.eclipse.ui.splash.AbstractSplashHandler#init(org.eclipse.swt.widgets.Shell)
*/
public void init(Shell splash) {
super.init(splash);
instance = this;
String progressRectString = null;
String messageRectString = null;
String foregroundColorString = null;
IProduct product = Platform.getProduct();
if (product != null) {
progressRectString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT);
messageRectString = product.getProperty(IProductConstants.STARTUP_MESSAGE_RECT);
foregroundColorString = product.getProperty(IProductConstants.STARTUP_FOREGROUND_COLOR);
}
if (progressRectString != null) {
Rectangle progressRect = StringConverter.asRectangle(progressRectString, new Rectangle(10, 10, 300, 15));
setProgressRect(progressRect);
}
if (messageRectString != null) {
Rectangle messageRect = StringConverter.asRectangle(messageRectString, new Rectangle(10, 35, 300, 15));
setMessageRect(messageRect);
}
int foregroundColorInteger;
try {
foregroundColorInteger = Integer.parseInt(foregroundColorString, 16);
} catch (Exception ex) {
// off white
foregroundColorInteger = 0xD2D7FF;
}
setForeground(new RGB((foregroundColorInteger & 0xFF0000) >> 16, (foregroundColorInteger & 0xFF00) >> 8, foregroundColorInteger & 0xFF));
final Color versionColor = new Color(Display.getCurrent(), 224, 224, 224);
// $NON-NLS-1$
final Font versionFont = new Font(Display.getCurrent(), "Verdana", 9, SWT.NONE);
// $NON-NLS-1$ //$NON-NLS-2$
final String versionText = Messages.get().SplashHandler_Version + NXCommon.VERSION + " (" + BuildNumber.TEXT + ")";
// $NON-NLS-1$
final String copyrightText = "\u00A9 2003-2018 Raden Solutions";
final Composite content = getContent();
content.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
e.gc.setForeground(versionColor);
e.gc.setFont(versionFont);
int y = 240;
Point size = e.gc.textExtent(copyrightText);
e.gc.drawText(copyrightText, 485 - size.x, y, true);
y += size.y + 2;
size = e.gc.textExtent(versionText);
e.gc.drawText(versionText, 485 - size.x, y, true);
}
});
content.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
versionColor.dispose();
versionFont.dispose();
}
});
}
use of org.eclipse.swt.events.PaintEvent in project netxms by netxms.
the class ScreenshotView method createPartControl.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
parent.setLayout(new FillLayout());
scroller = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
canvas = new Canvas(scroller, SWT.NONE);
canvas.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
GC gc = e.gc;
if (image != null) {
gc.drawImage(image, 0, 0);
gc.drawText(imageInfo, 10, image.getImageData().height + 10);
} else if (errorMessage != null) {
gc.setForeground(canvas.getDisplay().getSystemColor(SWT.COLOR_DARK_RED));
gc.setFont(JFaceResources.getBannerFont());
gc.drawText(errorMessage, 10, 10, true);
}
}
});
scroller.setContent(canvas);
scroller.setExpandVertical(true);
scroller.setExpandHorizontal(true);
scroller.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
updateScrollerSize();
}
});
activateContext();
createActions();
contributeToActionBars();
refresh();
}
use of org.eclipse.swt.events.PaintEvent in project netxms by netxms.
the class AvailabilityChart method createClientArea.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.widgets.DashboardElement#createClientArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createClientArea(Composite parent) {
Composite clientArea = new Composite(parent, SWT.NONE);
colors = new ColorCache(clientArea);
GridLayout layout = new GridLayout();
layout.numColumns = 4;
clientArea.setLayout(layout);
dayChart = createChart(clientArea, Messages.get().AvailabilityChart_Today);
weekChart = createChart(clientArea, Messages.get().AvailabilityChart_ThisWeek);
monthChart = createChart(clientArea, Messages.get().AvailabilityChart_ThisMonth);
Canvas legend = new Canvas(clientArea, SWT.NONE);
legend.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
paintLegend(e.gc);
}
});
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
legend.setLayoutData(gd);
return clientArea;
}
use of org.eclipse.swt.events.PaintEvent in project liferay-ide by liferay.
the class LayoutTplPreviewEditor method _refreshViewer.
private void _refreshViewer(GraphicalViewer viewer) {
Control control = viewer.getControl();
control.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
EditPart editPage = getGraphicalViewer().getContents();
editPage.refresh();
control.removePaintListener(this);
}
});
}
use of org.eclipse.swt.events.PaintEvent in project whole by wholeplatform.
the class LanguageWorkbenchSplashHandler method init.
public void init(Shell splash) {
super.init(splash);
IProduct product = Platform.getProduct();
if (product == null) {
getContent();
return;
}
String progressPosition = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT);
setProgressRect(StringConverter.asRectangle(progressPosition, new Rectangle(0, 0, 300, 15)));
String messagePosition = product.getProperty(IProductConstants.STARTUP_MESSAGE_RECT);
setMessageRect(StringConverter.asRectangle(messagePosition, new Rectangle(0, 35, 300, 15)));
String foreground = product.getProperty(IProductConstants.STARTUP_FOREGROUND_COLOR);
int foregroundColor;
try {
foregroundColor = Integer.parseInt(foreground, 16);
} catch (NumberFormatException e) {
// off white
foregroundColor = 0xD2D7FF;
}
setForeground(new RGB((foregroundColor & 0xFF0000) >> 16, (foregroundColor & 0xFF00) >> 8, foregroundColor & 0xFF));
getContent().addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.setForeground(getForeground());
e.gc.drawText(Platform.getBundle("org.whole.product.lw").getVersion().toString(), 250, 52, true);
}
});
}
Aggregations