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

The following examples show how to use org.eclipse.swt.SWT#LINE_SOLID . 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: 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 2
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 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: 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 5
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 6
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 7
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 8
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 9
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 10
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 11
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 12
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 13
Source File: NGC.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public int getLineSolidStyle() {
    return SWT.LINE_SOLID;
}
 
Example 14
Source File: ProblemView.java    From tlaplus with MIT License 4 votes vote down vote up
/**
 * Fill data
 * @param specLoaded
 */
private void fillData(Spec specLoaded)
{
    if (specLoaded == null)
    {
        hide();
        return;
    } else
    {

        // retrieve the markers associated with the loaded spec
        IMarker[] markers = TLAMarkerHelper.getProblemMarkers(specLoaded.getProject(), null);

        if (markers == null || markers.length == 0)
        {
            hide();
        }

        // sort the markers
        List<IMarker> markersList = new ArrayList<IMarker>(Arrays.asList(markers));
        Collections.sort(markersList, new MarkerComparator());

        // Bug fix: 2 June 2010.  It takes forever if
        // there are a large number of markers, which
        // can easily happen if you remove a definition
        // that's used hundreds of times.
        int iterations = Math.min(markers.length, 20);
        for (int j = 0; j < iterations; j++)
        {
            final IMarker problem = markersList.get(j);

            // listener
            Listener listener = new Listener() {
                // goto marker on click
                public void handleEvent(Event event)
                {
                    TLAMarkerHelper.gotoMarker(problem, ((event.stateMask & SWT.MOD1) != 0));
                }
            };

            // contents of the item
            Composite problemItem = new Composite(bar, SWT.LINE_SOLID);
            problemItem.setLayout(new RowLayout(SWT.VERTICAL));
            problemItem.addListener(SWT.MouseDown, listener);

            String[] lines = problem.getAttribute(IMarker.MESSAGE, "").split("\n");
            for (int i = 0; i < lines.length; i++)
            {
                StyledText styledText = new StyledText(problemItem, SWT.INHERIT_DEFAULT);
                styledText.setEditable(false);
                styledText.setCursor(styledText.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
                styledText.setText(lines[i]);
                styledText.addListener(SWT.MouseDown, listener);

                if (isErrorLine(lines[i], problem))
                {
                    StyleRange range = new StyleRange();
                    range.underline = true;
                    range.foreground = styledText.getDisplay().getSystemColor(SWT.COLOR_RED);
                    range.start = 0;
                    range.length = lines[i].length();
                    styledText.setStyleRange(range);
                }
            }

            ExpandItem item = new ExpandItem(bar, SWT.NONE, 0);
            item.setExpanded(true);
            
            String markerType = TLAMarkerHelper.getType(problem);
            item.setText(AdapterFactory.getMarkerTypeAsText(markerType) + " " + AdapterFactory.getSeverityAsText(problem.getAttribute(IMarker.SEVERITY,
                    IMarker.SEVERITY_ERROR)));
            item.setHeight(problemItem.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
            item.setControl(problemItem);
            item.addListener(SWT.MouseDown, listener);
        }
    }
    return ;
}
 
Example 15
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 16
Source File: AbstractSettings.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public int getTodayLineStyle() {
	return SWT.LINE_SOLID;
}
 
Example 17
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 18
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 19
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 20
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( );
	

}