org.eclipse.swt.graphics.LineAttributes Java Examples

The following examples show how to use org.eclipse.swt.graphics.LineAttributes. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SwtGc.java    From hop with Apache License 2.0 6 votes vote down vote up
public void setLineStyle( ELineStyle lineStyle ) {
  switch ( lineStyle ) {
    case DASHDOT:
      gc.setLineStyle( SWT.LINE_DASHDOT );
      break;
    case SOLID:
      gc.setLineStyle( SWT.LINE_SOLID );
      break;
    case DOT:
      gc.setLineStyle( SWT.LINE_DOT );
      break;
    case DASH:
      gc.setLineStyle( SWT.LINE_DASH );
      break;
    case PARALLEL:
      gc.setLineAttributes( new LineAttributes(
        gc.getLineWidth(), SWT.CAP_FLAT, SWT.JOIN_MITER, SWT.LINE_CUSTOM, new float[] { 5, 3, }, 0, 10 ) );
      break;
    default:
      break;
  }
}
 
Example #2
Source File: SWTGC.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void setLineStyle( ELineStyle lineStyle ) {
  switch ( lineStyle ) {
    case DASHDOT:
      gc.setLineStyle( SWT.LINE_DASHDOT );
      break;
    case SOLID:
      gc.setLineStyle( SWT.LINE_SOLID );
      break;
    case DOT:
      gc.setLineStyle( SWT.LINE_DOT );
      break;
    case DASH:
      gc.setLineStyle( SWT.LINE_DASH );
      break;
    case PARALLEL:
      gc.setLineAttributes( new LineAttributes(
        gc.getLineWidth(), SWT.CAP_FLAT, SWT.JOIN_MITER, SWT.LINE_CUSTOM, new float[] { 5, 3, }, 0, 10 ) );
      break;
    default:
      break;
  }
}
 
Example #3
Source File: SWTDirectGC.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void setLineStyle( ELineStyle lineStyle ) {
  switch ( lineStyle ) {
    case DASHDOT:
      gc.setLineStyle( SWT.LINE_DASHDOT );
      break;
    case SOLID:
      gc.setLineStyle( SWT.LINE_SOLID );
      break;
    case DOT:
      gc.setLineStyle( SWT.LINE_DOT );
      break;
    case DASH:
      gc.setLineStyle( SWT.LINE_DASH );
      break;
    case PARALLEL:
      gc.setLineAttributes( new LineAttributes(
        gc.getLineWidth(), SWT.CAP_FLAT, SWT.JOIN_MITER, SWT.LINE_CUSTOM, new float[] { 5, 3, }, 0, 10 ) );
      break;
    default:
      break;
  }
}
 
Example #4
Source File: IndentGuidePainter.java    From IndentGuide with MIT License 6 votes vote down vote up
private void handleDrawRequest(GC gc, int x, int y, int w, int h) {
	int startLine = fTextWidget.getLineIndex(y);
	int endLine = fTextWidget.getLineIndex(y + h - 1);
	if (startLine <= endLine && startLine < fTextWidget.getLineCount()) {
		Color fgColor = gc.getForeground();
		LineAttributes lineAttributes = gc.getLineAttributes();
		gc.setForeground(Activator.getDefault().getColor());
		gc.setLineStyle(lineStyle);
		gc.setLineWidth(lineWidth);
		spaceWidth = gc.getAdvanceWidth(' ');
		if (fIsAdvancedGraphicsPresent) {
			int alpha = gc.getAlpha();
			gc.setAlpha(this.lineAlpha);
			drawLineRange(gc, startLine, endLine, x, w);
			gc.setAlpha(alpha);
		} else {
			drawLineRange(gc, startLine, endLine, x, w);
		}
		gc.setForeground(fgColor);
		gc.setLineAttributes(lineAttributes);
	}
}
 
Example #5
Source File: IndentGuidesPainter.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
private void handleDrawRequest(GC gc, int x, int y, int w, int h) {
	int startLine = fTextWidget.getLineIndex(y);
	int endLine = fTextWidget.getLineIndex(y + h - 1);
	if (startLine <= endLine && startLine < fTextWidget.getLineCount()) {
		Color fgColor = gc.getForeground();
		LineAttributes lineAttributes = gc.getLineAttributes();
		gc.setForeground(color);
		gc.setLineStyle(lineStyle);
		gc.setLineWidth(lineWidth);
		if (fIsAdvancedGraphicsPresent) {
			int alpha = gc.getAlpha();
			gc.setAlpha(this.lineAlpha);
			drawLineRange(gc, startLine, endLine, x, w);
			gc.setAlpha(alpha);
		} else {
			drawLineRange(gc, startLine, endLine, x, w);
		}
		gc.setForeground(fgColor);
		gc.setLineAttributes(lineAttributes);
	}
}
 
Example #6
Source File: BidiLayout.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
protected void startPushMode() {
	final Image image = new Image (styledText.getDisplay(), 20, 20);
	GC gc = new GC (image);
	gc.setBackground (styledText.getDisplay().getSystemColor(SWT.COLOR_BLACK));
	gc.fillRectangle (0, 0, 20, 20);
	gc.setForeground (styledText.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	gc.setLineAttributes(new LineAttributes(2));
	gc.drawLine (0, 13, gc.getFontMetrics().getAverageCharWidth(), 13);
	gc.dispose ();
	defaultCaret = styledText.getCaret();
	Caret cc = new Caret(styledText, 0);
	cc.setImage(image);
	styledText.setCaret(cc);
	int carOffset = styledText.getCaretOffset();


	String str = reverseStr(styledText.getText());
	styledText.setText(str);
	indxPushSegmentStart = carOffset;
	styledText.setCaretOffset(getUpdatedCaret(carOffset));
	if (!isWidgetReversed) {
		setBidiKeyboardLanguage();
	} else {
		setNonBidiKeyboardLanguage();
	}
}
 
Example #7
Source File: SwtDirectGc.java    From hop with Apache License 2.0 6 votes vote down vote up
public void setLineStyle( ELineStyle lineStyle ) {
  switch ( lineStyle ) {
    case DASHDOT:
      gc.setLineStyle( SWT.LINE_DASHDOT );
      break;
    case SOLID:
      gc.setLineStyle( SWT.LINE_SOLID );
      break;
    case DOT:
      gc.setLineStyle( SWT.LINE_DOT );
      break;
    case DASH:
      gc.setLineStyle( SWT.LINE_DASH );
      break;
    case PARALLEL:
      gc.setLineAttributes( new LineAttributes(
        gc.getLineWidth(), SWT.CAP_FLAT, SWT.JOIN_MITER, SWT.LINE_CUSTOM, new float[] { 5, 3, }, 0, 10 ) );
      break;
    default:
      break;
  }
}
 
Example #8
Source File: YAxisDynamicRenderer.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public YAxisDynamicRenderer ( final ChartRenderer chart )
{
    super ( chart );
    this.chart = chart;

    this.lineAttributes = new LineAttributes ( 1.0f, SWT.CAP_FLAT, SWT.JOIN_BEVEL, SWT.LINE_SOLID, new float[0], 0.0f, 0.0f );
}
 
Example #9
Source File: XAxisDynamicRenderer.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public XAxisDynamicRenderer ( final ChartRenderer chart )
{
    super ( chart );
    this.chart = chart;

    this.lineAttributes = new LineAttributes ( 1.0f, SWT.CAP_FLAT, SWT.JOIN_BEVEL, SWT.LINE_SOLID, new float[0], 0.0f, 0.0f );
    this.labelSpacing = 20;
}
 
Example #10
Source File: LineInput.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public static Image makePreview ( final Display display, final LineAttributes lineAttributes, final Color lineColor, final Point p )
{
    final Image img = new Image ( display, p.x, p.y );

    final GC gc = new GC ( img );
    try
    {
        gc.setForeground ( img.getDevice ().getSystemColor ( SWT.COLOR_WHITE ) );
        gc.setBackground ( img.getDevice ().getSystemColor ( SWT.COLOR_WHITE ) );
        gc.fillRectangle ( 0, 0, p.x, p.y );

        gc.setLineAttributes ( lineAttributes );

        if ( lineColor != null )
        {
            gc.setForeground ( lineColor );
        }

        gc.drawLine ( 0, p.y / 2, p.x, p.y / 2 );
    }
    finally
    {
        gc.dispose ();
    }

    return img;
}
 
Example #11
Source File: ItemObserver.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public LevelRuler ( final ChartRenderer manager, final String prefix, final YAxis y, final int style, final int alpha, final float lineWidth )
{
    this.prefix = prefix;

    this.manager = manager;

    this.alpha = alpha;

    this.ruler = new PositionYRuler ( y, style );
    this.ruler.setAlpha ( this.alpha );
    this.ruler.setLineAttributes ( new LineAttributes ( lineWidth ) );
    this.manager.addRenderer ( this.ruler, 200 );
}
 
Example #12
Source File: MouseDragZoomer.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void render ( final Graphics g, final Rectangle clientRectangle )
{
    if ( this.selection != null )
    {
        final Rectangle chartRect = this.chart.getClientAreaProxy ().getClientRectangle ();

        g.setLineAttributes ( new LineAttributes ( 1.0f ) );
        g.setForeground ( null );

        g.drawRectangle ( this.selection.x + chartRect.x, this.selection.y + chartRect.y, this.selection.width, this.selection.height );
    }
}
 
Example #13
Source File: AbstractLineRender.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
public AbstractLineRender ( final ChartRenderer chart, final SeriesData abstractSeriesData )
{
    super ( chart, abstractSeriesData );
    this.lineAttributes = new LineAttributes ( 1.0f );
}
 
Example #14
Source File: AbstractLineRender.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
public void setLineAttributes ( final LineAttributes lineAttributes )
{
    this.lineAttributes = lineAttributes;
}
 
Example #15
Source File: AbstractLineRender.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
public LineAttributes getLineAttributes ()
{
    return this.lineAttributes;
}
 
Example #16
Source File: AbstractRuler.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
public void setLineAttributes ( final LineAttributes lineAttributes )
{
    this.lineAttributes = lineAttributes;
}
 
Example #17
Source File: Draw2DGraphics.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void setLineAttributes ( final LineAttributes lineAttributes )
{
    this.g.setLineAttributes ( lineAttributes );
}
 
Example #18
Source File: SWTPainter.java    From tuxguitar with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void setLineWidth(float width) {
	this.getControl().setLineAttributes(new LineAttributes((width == THINNEST_LINE_WIDTH ? 1f : width)));
}
 
Example #19
Source File: SWTGraphics.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void setLineAttributes ( final LineAttributes lineAttributes )
{
    this.gc.setLineAttributes ( lineAttributes );
}
 
Example #20
Source File: Graphics.java    From neoscada with Eclipse Public License 1.0 votes vote down vote up
public void setLineAttributes ( LineAttributes lineAttributes );