Java Code Examples for org.eclipse.swt.SWT#LINE_DOT

The following examples show how to use org.eclipse.swt.SWT#LINE_DOT . 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: LineAttributesComposite.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private LineStyle getModelLineStyle( int iStyle )
{
	switch ( iStyle )
	{
		case SWT.LINE_SOLID :
			return LineStyle.SOLID_LITERAL;
		case SWT.LINE_DASH :
			return LineStyle.DASHED_LITERAL;
		case SWT.LINE_DASHDOT :
			return LineStyle.DASH_DOTTED_LITERAL;
		case SWT.LINE_DOT :
			return LineStyle.DOTTED_LITERAL;
		default :
			return null;
	}
}
 
Example 2
Source File: LineAttributesComposite.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private int getSWTLineStyle( LineStyle style )
{
	if ( style.equals( LineStyle.DASHED_LITERAL ) )
	{
		return SWT.LINE_DASH;
	}
	else if ( style.equals( LineStyle.DASH_DOTTED_LITERAL ) )
	{
		return SWT.LINE_DASHDOT;
	}
	else if ( style.equals( LineStyle.DOTTED_LITERAL ) )
	{
		return SWT.LINE_DOT;
	}
	else
	{
		return SWT.LINE_SOLID;
	}
}
 
Example 3
Source File: GanttLineAttributesComposite.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Converts the specified SWT line style constant to a chart model's
 * LineStyle object
 */
private LineStyle getModelLineStyle( int iStyle )
{
	switch ( iStyle )
	{
		case SWT.LINE_SOLID :
			return LineStyle.SOLID_LITERAL;
		case SWT.LINE_DASH :
			return LineStyle.DASHED_LITERAL;
		case SWT.LINE_DASHDOT :
			return LineStyle.DASH_DOTTED_LITERAL;
		case SWT.LINE_DOT :
			return LineStyle.DOTTED_LITERAL;
		default :
			return null;
	}
}
 
Example 4
Source File: GanttLineAttributesComposite.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Converts the specified model line style to an appropriate SWT line style
 * constant
 */
private int getSWTLineStyle( LineStyle style )
{
	if ( style.equals( LineStyle.DASHED_LITERAL ) )
	{
		return SWT.LINE_DASH;
	}
	else if ( style.equals( LineStyle.DASH_DOTTED_LITERAL ) )
	{
		return SWT.LINE_DASHDOT;
	}
	else if ( style.equals( LineStyle.DOTTED_LITERAL ) )
	{
		return SWT.LINE_DOT;
	}
	else
	{
		return SWT.LINE_SOLID;
	}
}
 
Example 5
Source File: ChartUIExtensionUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Converts the specified model line style to an appropriate SWT line style
 * constant
 */
public static int getSWTLineStyle( LineStyle style )
{
	if ( LineStyle.DASHED_LITERAL.equals( style ) )
	{
		return SWT.LINE_DASH;
	}
	else if ( LineStyle.DASH_DOTTED_LITERAL.equals( style ) )
	{
		return SWT.LINE_DASHDOT;
	}
	else if ( LineStyle.DOTTED_LITERAL.equals( style ) )
	{
		return SWT.LINE_DOT;
	}
	else
	{
		return SWT.LINE_SOLID;
	}
}
 
Example 6
Source File: BoxSettingsImpl.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
private int swtLineStyle(final int index) {
	switch (index) {
		case 0:
			return SWT.LINE_SOLID;
		case 1:
			return SWT.LINE_DOT;
		case 2:
			return SWT.LINE_DASH;
		case 3:
			return SWT.LINE_DASHDOT;
		case 4:
			return SWT.LINE_DASHDOTDOT;
	}
	return 0;
}
 
Example 7
Source File: BorderStyle.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
public static int toSWT(LineStyleEnum line) {
    if (line == null) throw new IllegalArgumentException("null");
    if (line.equals(SOLID)) return SWT.LINE_SOLID;
    else if (line.equals(DASHED)) return SWT.LINE_DASH;
    else if (line.equals(DOTTED)) return SWT.LINE_DOT;
    else if (line.equals(DASHDOT)) return SWT.LINE_DASHDOT;
    else if (line.equals(DASHDOTDOT)) return SWT.LINE_DASHDOTDOT;
    else return SWT.LINE_SOLID;
}
 
Example 8
Source File: BorderStyle.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public static int toSWT(LineStyleEnum line) {
    if (line == null) throw new IllegalArgumentException("null");
    if (line.equals(SOLID)) return SWT.LINE_SOLID;
    else if (line.equals(DASHED)) return SWT.LINE_DASH;
    else if (line.equals(DOTTED)) return SWT.LINE_DOT;
    else if (line.equals(DASHDOT)) return SWT.LINE_DASHDOT;
    else if (line.equals(DASHDOTDOT)) return SWT.LINE_DASHDOTDOT;
    else return SWT.LINE_SOLID;
}
 
Example 9
Source File: LineStyleChooserComposite.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public LineStyleChooserComposite( Composite parent, int style,
		int iLineStyle )
{
	this( parent, style, iLineStyle, new Integer[]{
			SWT.NONE, SWT.LINE_SOLID, SWT.LINE_DASH, SWT.LINE_DASHDOT, SWT.LINE_DOT
	} );
}
 
Example 10
Source File: LineAttributesComposite.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Provides a method to override line styles list
 * 
 * @return style identifier array
 */
protected Integer[] getLineStyleItems( )
{
	return new Integer[]{
			SWT.LINE_SOLID, SWT.LINE_DASH, SWT.LINE_DASHDOT, SWT.LINE_DOT
	};
}
 
Example 11
Source File: SwtRendererImpl.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void drawOval( OvalRenderEvent ore ) throws ChartException
{
	iv.modifyEvent( ore );
	
	// CHECK IF THE LINE ATTRIBUTES ARE CORRECTLY DEFINED
	final LineAttributes lia = ore.getOutline( );
	if ( !validateLineAttributes( ore.getSource( ), lia ) )
	{
		return;
	}

	// SETUP THE FOREGROUND COLOR (DARKER BACKGROUND IF DEFINED AS NULL)
	final Color cFG = (Color) validateEdgeColor( lia.getColor( ),
			ore.getBackground( ),
			_ids );
	if ( cFG == null )
	{
		return;
	}

	// DRAW THE OVAL WITH THE SPECIFIED LINE ATTRIBUTES
	final int iOldLineStyle = _gc.getLineStyle( );
	final int iOldLineWidth = _gc.getLineWidth( );
	int iLineStyle = SWT.LINE_SOLID;
	switch ( lia.getStyle( ).getValue( ) )
	{
		case ( LineStyle.DOTTED                                                                                                                                                                                                                                                                  ) :
			iLineStyle = SWT.LINE_DOT;
			break;
		case ( LineStyle.DASH_DOTTED                                                                                                                                                                                                                                                                  ) :
			iLineStyle = SWT.LINE_DASHDOT;
			break;
		case ( LineStyle.DASHED                                                                                                                                                                                                                                                                  ) :
			iLineStyle = SWT.LINE_DASH;
			break;
	}
	_gc.setLineStyle( iLineStyle );
	_gc.setLineWidth( lia.getThickness( ) );
	final Bounds bo = ore.getBounds( );
	_gc.setForeground( cFG );

	R31Enhance.setAlpha( _gc, lia.getColor( ) );

	_gc.drawOval( (int) ( ( bo.getLeft( ) + dTranslateX ) * dScale ),
			(int) ( ( bo.getTop( ) + dTranslateY ) * dScale ),
			(int) ( bo.getWidth( ) * dScale ),
			(int) ( bo.getHeight( ) * dScale ) );

	_gc.setLineStyle( iOldLineStyle );
	_gc.setLineWidth( iOldLineWidth );
	cFG.dispose( );
	

}
 
Example 12
Source File: DefaultTimelineStyleProvider.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public int getGridLineStyle() {
	return SWT.LINE_DOT;
}
 
Example 13
Source File: SwtRendererImpl.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void drawArea( AreaRenderEvent are ) throws ChartException
{
	iv.modifyEvent( are );
	
	// CHECK IF THE LINE ATTRIBUTES ARE CORRECTLY DEFINED
	final LineAttributes lia = are.getOutline( );
	if ( !validateLineAttributes( are.getSource( ), lia ) )
	{
		return;
	}

	// SETUP THE FOREGROUND COLOR (DARKER BACKGROUND IF DEFINED AS NULL)
	final Color cFG = (Color) validateEdgeColor( lia.getColor( ),
			are.getBackground( ),
			_ids );
	if ( cFG == null ) // IF UNDEFINED, EXIT
	{
		return;
	}

	// BUILD THE GENERAL PATH STRUCTURE
	final Path gp = new Path( ( (SwtDisplayServer) _ids ).getDevice( ) );
	PrimitiveRenderEvent pre;
	for ( int i = 0; i < are.getElementCount( ); i++ )
	{
		pre = are.getElement( i );
		if ( pre instanceof ArcRenderEvent )
		{
			final ArcRenderEvent acre = (ArcRenderEvent) pre;

			gp.addArc( (float) acre.getTopLeft( ).getX( ),
					(float) acre.getTopLeft( ).getY( ),
					(float) acre.getWidth( ),
					(float) acre.getHeight( ),
					(float) acre.getStartAngle( ),
					(float) acre.getAngleExtent( ) );
		}
		else if ( pre instanceof LineRenderEvent )
		{
			final LineRenderEvent lre = (LineRenderEvent) pre;
			gp.moveTo( (float) lre.getStart( ).getX( ),
					(float) lre.getStart( ).getY( ) );
			gp.lineTo( (float) lre.getEnd( ).getX( ), (float) lre.getEnd( )
					.getY( ) );
		}
	}

	// DRAW THE PATH
	final int iOldLineStyle = _gc.getLineStyle( );
	final int iOldLineWidth = _gc.getLineWidth( );
	int iLineStyle = SWT.LINE_SOLID;
	switch ( lia.getStyle( ).getValue( ) )
	{
		case ( LineStyle.DOTTED                                                                                                                                                                                                                                                                  ) :
			iLineStyle = SWT.LINE_DOT;
			break;
		case ( LineStyle.DASH_DOTTED                                                                                                                                                                                                                                                                  ) :
			iLineStyle = SWT.LINE_DASHDOT;
			break;
		case ( LineStyle.DASHED                                                                                                                                                                                                                                                                  ) :
			iLineStyle = SWT.LINE_DASH;
			break;
	}
	_gc.setLineStyle( iLineStyle );
	_gc.setLineWidth( lia.getThickness( ) );
	_gc.setForeground( cFG );

	R31Enhance.setAlpha( _gc, lia.getColor( ) );

	_gc.drawPath( gp );

	// Restore state
	_gc.setLineStyle( iOldLineStyle );
	_gc.setLineWidth( iOldLineWidth );

	// Free resource
	gp.dispose( );
	cFG.dispose( );

}
 
Example 14
Source File: SwtRendererImpl.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void drawArc( ArcRenderEvent are ) throws ChartException
{
	iv.modifyEvent( are );
	
	// CHECK IF THE LINE ATTRIBUTES ARE CORRECTLY DEFINED
	final LineAttributes lia = are.getOutline( );
	if ( !validateLineAttributes( are.getSource( ), lia ) )
	{
		return;
	}

	// SETUP THE FOREGROUND COLOR (DARKER BACKGROUND IF DEFINED AS NULL)
	final Color cFG = (Color) validateEdgeColor( lia.getColor( ),
			are.getBackground( ),
			_ids );
	if ( cFG == null )
	{
		return;
	}

	// DRAW THE ARC WITH THE SPECIFIED LINE ATTRIBUTES
	final int iOldLineStyle = _gc.getLineStyle( );
	final int iOldLineWidth = _gc.getLineWidth( );
	int iLineStyle = SWT.LINE_SOLID;
	switch ( lia.getStyle( ).getValue( ) )
	{
		case LineStyle.DOTTED :
			iLineStyle = SWT.LINE_DOT;
			break;
		case LineStyle.DASH_DOTTED :
			iLineStyle = SWT.LINE_DASHDOT;
			break;
		case LineStyle.DASHED :
			iLineStyle = SWT.LINE_DASH;
			break;
	}
	_gc.setLineStyle( iLineStyle );
	_gc.setLineWidth( lia.getThickness( ) );
	_gc.setForeground( cFG );

	R31Enhance.setAlpha( _gc, lia.getColor( ) );

	drawArc( _gc,
			( (SwtDisplayServer) _ids ).getDevice( ),
			are,
			dTranslateX,
			dTranslateY,
			dScale );

	_gc.setLineStyle( iOldLineStyle );
	_gc.setLineWidth( iOldLineWidth );
	cFG.dispose( );
	

}
 
Example 15
Source File: SwtRendererImpl.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void drawPolygon( PolygonRenderEvent pre ) throws ChartException
{
	iv.modifyEvent( pre );
	// CHECK IF THE LINE ATTRIBUTES ARE CORRECTLY DEFINED
	final LineAttributes lia = pre.getOutline( );
	if ( !validateLineAttributes( pre.getSource( ), lia ) )
	{
		return;
	}

	// SETUP THE FOREGROUND COLOR (DARKER BACKGROUND IF DEFINED AS NULL)
	final Color cFG = (Color) validateEdgeColor( lia.getColor( ),
			pre.getBackground( ),
			_ids );
	if ( cFG == null )
	{
		return;
	}

	final int iOldLineStyle = _gc.getLineStyle( );
	final int iOldLineWidth = _gc.getLineWidth( );

	int iLineStyle = SWT.LINE_SOLID;
	switch ( lia.getStyle( ).getValue( ) )
	{
		case ( LineStyle.DOTTED                                                                                                                                                                                                                                                                  ) :
			iLineStyle = SWT.LINE_DOT;
			break;
		case ( LineStyle.DASH_DOTTED                                                                                                                                                                                                                                                                  ) :
			iLineStyle = SWT.LINE_DASHDOT;
			break;
		case ( LineStyle.DASHED                                                                                                                                                                                                                                                                  ) :
			iLineStyle = SWT.LINE_DASH;
			break;
	}

	_gc.setLineStyle( iLineStyle );
	_gc.setLineWidth( lia.getThickness( ) );
	_gc.setForeground( cFG );

	R31Enhance.setAlpha( _gc, lia.getColor( ) );

	_gc.drawPolygon( getCoordinatesAsInts( pre.getPoints( ),
			TRUNCATE,
			dTranslateX,
			dTranslateY,
			dScale ) );

	_gc.setLineStyle( iOldLineStyle );
	_gc.setLineWidth( iOldLineWidth );
	cFG.dispose( );
	

}
 
Example 16
Source File: SwtRendererImpl.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void drawRectangle( RectangleRenderEvent rre ) throws ChartException
{
	iv.modifyEvent( rre  );
	// CHECK IF THE LINE ATTRIBUTES ARE CORRECTLY DEFINED
	final LineAttributes lia = rre.getOutline( );
	if ( !validateLineAttributes( rre.getSource( ), lia ) )
	{
		return;
	}

	// SETUP THE FOREGROUND COLOR (DARKER BACKGROUND IF DEFINED AS NULL)
	final Color cFG = (Color) validateEdgeColor( lia.getColor( ),
			rre.getBackground( ),
			_ids );
	if ( cFG == null )
	{
		return;
	}

	// DRAW THE RECTANGLE WITH THE APPROPRIATE LINE STYLE
	final int iOldLineStyle = _gc.getLineStyle( );
	final int iOldLineWidth = _gc.getLineWidth( );
	int iLineStyle = SWT.LINE_SOLID;
	switch ( lia.getStyle( ).getValue( ) )
	{
		case ( LineStyle.DOTTED                                                                                                                                                                                                                                                                  ) :
			iLineStyle = SWT.LINE_DOT;
			break;
		case ( LineStyle.DASH_DOTTED                                                                                                                                                                                                                                                                  ) :
			iLineStyle = SWT.LINE_DASHDOT;
			break;
		case ( LineStyle.DASHED                                                                                                                                                                                                                                                                  ) :
			iLineStyle = SWT.LINE_DASH;
			break;
	}
	_gc.setLineStyle( iLineStyle );
	_gc.setLineWidth( lia.getThickness( ) );
	final Bounds bo = normalizeBounds( rre.getBounds( ) );
	_gc.setForeground( cFG );

	R31Enhance.setAlpha( _gc, lia.getColor( ) );

	_gc.drawRectangle( (int) ( ( bo.getLeft( ) + dTranslateX ) * dScale ),
			(int) ( ( bo.getTop( ) + dTranslateY ) * dScale ),
			(int) ( bo.getWidth( ) * dScale ) - 1,
			(int) ( bo.getHeight( ) * dScale ) - 1 );

	_gc.setLineStyle( iOldLineStyle );
	_gc.setLineWidth( iOldLineWidth );
	cFG.dispose( );
	

}
 
Example 17
Source File: SwtRendererImpl.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void drawLine( LineRenderEvent lre ) throws ChartException
{
	iv.modifyEvent( lre  );
	// CHECK IF THE LINE ATTRIBUTES ARE CORRECTLY DEFINED
	final LineAttributes lia = lre.getLineAttributes( );
	if ( !validateLineAttributes( lre.getSource( ), lia )
			|| lia.getColor( ) == null )
	{
		return;
	}

	// DRAW THE LINE
	final int iOldLineStyle = _gc.getLineStyle( );
	final int iOldLineWidth = _gc.getLineWidth( );
	final Color cFG = (Color) _ids.getColor( lia.getColor( ) );
	int iLineStyle = SWT.LINE_SOLID;
	switch ( lia.getStyle( ).getValue( ) )
	{
		case ( LineStyle.DOTTED                                                                                                                                                                                                                                                                  ) :
			iLineStyle = SWT.LINE_DOT;
			break;
		case ( LineStyle.DASH_DOTTED                                                                                                                                                                                                                                                                  ) :
			iLineStyle = SWT.LINE_DASHDOT;
			break;
		case ( LineStyle.DASHED                                                                                                                                                                                                                                                                  ) :
			iLineStyle = SWT.LINE_DASH;
			break;
	}
	_gc.setLineStyle( iLineStyle );
	_gc.setLineWidth( lia.getThickness( ) );
	final Location lo1 = lre.getStart( );
	final Location lo2 = lre.getEnd( );
	_gc.setForeground( cFG );

	R31Enhance.setAlpha( _gc, lia.getColor( ) );

	_gc.drawLine( (int) ( ( lo1.getX( ) + dTranslateX ) * dScale ),
			(int) ( ( lo1.getY( ) + dTranslateY ) * dScale ),
			(int) ( ( lo2.getX( ) + dTranslateX ) * dScale ),
			(int) ( ( lo2.getY( ) + dTranslateY ) * dScale ) );

	_gc.setLineStyle( iOldLineStyle );
	_gc.setLineWidth( iOldLineWidth );
	cFG.dispose( );


}
 
Example 18
Source File: SwtTextRenderer.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private final void renderBorder( IChartComputation cComp, GC gc, Label la, int iLabelLocation,
		Location lo ) throws ChartException
{
	// RENDER THE OUTLINE/BORDER
	final LineAttributes lia = la.getOutline( );
	if ( lia != null
			&& lia.isVisible( )
			&& lia.getColor( ) != null )
	{
		RotatedRectangle rr = cComp.computePolygon( _sxs,
				iLabelLocation,
				la,
				lo.getX( ),
				lo.getY( ),
				null );

		final int iOldLineStyle = gc.getLineStyle( );
		final int iOldLineWidth = gc.getLineWidth( );

		final Color cFG = (Color) _sxs.getColor( lia.getColor( ) );
		gc.setForeground( cFG );

		R31Enhance.setAlpha( gc, lia.getColor( ) );

		int iLineStyle = SWT.LINE_SOLID;
		switch ( lia.getStyle( ).getValue( ) )
		{
			case ( LineStyle.DOTTED                      ) :
				iLineStyle = SWT.LINE_DOT;
				break;
			case ( LineStyle.DASH_DOTTED                      ) :
				iLineStyle = SWT.LINE_DASHDOT;
				break;
			case ( LineStyle.DASHED                      ) :
				iLineStyle = SWT.LINE_DASH;
				break;
		}
		gc.setLineStyle( iLineStyle );
		gc.setLineWidth( lia.getThickness( ) );

		gc.drawPolygon( rr.getSwtPoints( ) );

		gc.setLineStyle( iOldLineStyle );
		gc.setLineWidth( iOldLineWidth );
		cFG.dispose( );
	}
}
 
Example 19
Source File: AbstractInformationControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
protected void createHorizontalSeparator(Composite parent) {
	Label separator= new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.LINE_DOT);
	separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
 
Example 20
Source File: NGC.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public int getLineDotStyle() {
    return SWT.LINE_DOT;
}