Package tk.eclipse.plugin.htmleditor.gefutils

Source Code of tk.eclipse.plugin.htmleditor.gefutils.LabelArrowConnection

package tk.eclipse.plugin.htmleditor.gefutils;

import org.eclipse.draw2d.BendpointConnectionRouter;
import org.eclipse.draw2d.ConnectionLocator;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.PolygonDecoration;
import org.eclipse.draw2d.PolylineConnection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;

/**
* @author Naoki Takezoe
*/
public class LabelArrowConnection extends PolylineConnection {
 
  private Label label = new Label();
 
  public LabelArrowConnection(){
    this(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
  }
 
  public LabelArrowConnection(Color color){
    add(label, new ConnectionLocator(this, ConnectionLocator.MIDDLE));
    setConnectionRouter(new BendpointConnectionRouter());
    setTargetDecoration(new PolygonDecoration());
    if(color!=null){
      setForegroundColor(color);
    }
  }
 
  public Label getLabel(){
    return label;
  }
 
  public void setText(String text){
    label.setText(text);
  }
 
}
TOP

Related Classes of tk.eclipse.plugin.htmleditor.gefutils.LabelArrowConnection

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.