Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » seperating label text and image in a label(seperating label text and image in a label)
seperating label text and image in a label [message #722596] Tue, 06 September 2011 09:49
karthick9686@gmail.com Missing name
Messages: 41
Registered: July 2011
Member




import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.EllipseAnchor;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.OrderedLayout;
import org.eclipse.draw2d.ToolbarLayout;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Image;

public class EndEventFigure
extends Figure
implements FlowElementFigure
{
public EndEventFigure()
{
final ToolbarLayout layout = new ToolbarLayout();
layout.setStretchMinorAxis( false );
layout.setSpacing( 1 );
layout.setMinorAlignment( OrderedLayout.ALIGN_CENTER );
setLayoutManager( layout );
setOpaque( false );

name = new Label();

name.setOpaque( true );

image = new Label();

image.setIcon( EndEventFigure.icon );

image.setOpaque( true );

add( image );

add( getLabel() );
}

@Override
public Rectangle getCellEditorRectangle()
{
return name.getBounds().getCopy();
}

@Override
public ConnectionAnchor getConnectionAnchor()
{
if( connectionAnchor == null )
{
connectionAnchor = new EllipseAnchor( this );
}
return connectionAnchor;
}

/**
* @see com.bpminspire.inspire.bpmn.designer.figure.FlowElementFigure#getIcon()
*/
@Override
public Image getIcon()
{
// TODO Auto-generated method stub
return null;
}

public Label getLabel()
{
return name;
}

@Override
public String getNameLabel()
{
return name.getText();
}

/**
* @see com.bpminspire.inspire.bpmn.designer.figure.FlowElementFigure#setIcon(org.eclipse.swt.graphics.Image)
*/
@Override
public void setIcon( final Image image )
{
// TODO Auto-generated method stub

}

@Override
public void setNameLabel( final String text )
{
name.setText( text );
}

private final Label image;

private static final Image icon = Utils.createImage( "icons32/end_none_event.png" );

private final Label name;

private ConnectionAnchor connectionAnchor;

}


now when i start editing . the textlabel does not show text beyound the bounds of the figure. i want the text label to be resized independant of the shape label . i have attached the sample screen shot.

  • Attachment: gef.doc
    (Size: 238.00KB, Downloaded 191 times)

[Updated on: Tue, 06 September 2011 09:49]

Report message to a moderator

Previous Topic:Creating collapsable and expandable figures
Next Topic:How to calculate the cursor Position in a Eclipse graphical editor ??
Goto Forum:
  


Current Time: Tue Oct 21 13:41:13 GMT 2014

Powered by FUDForum. Page generated in 0.02632 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software