org.eclipse.draw2d.FigureListener Java Examples

The following examples show how to use org.eclipse.draw2d.FigureListener. 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: GaugeFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public GaugeFigure() {
	super();
	transparent = true;
	scale.setScaleLineVisible(false);
	scale.setTickLabelSide(LabelSide.Secondary);
	ramp.setRampWidth(10);
	
	valueLabel = new Label();	
	valueLabel.setFont(DEFAULT_LABEL_FONT);
	
	unitLabel = new Label();
	unitLabel.setFont(DEFAULT_LABEL_FONT);
	
	titleLabel = new Label();
	titleLabel.setFont(DEFAULT_LABEL_FONT);
	
	needle = new Needle();
	needle.setFill(true);
	needle.setOutline(false);
	
	needleCenter = new NeedleCenter();
	needleCenter.setOutline(false);
	
	setLayoutManager(new GaugeLayout());
	add(ramp, GaugeLayout.RAMP);
	add(scale, GaugeLayout.SCALE);		
	add(valueLabel, GaugeLayout.VALUE_LABEL);
	add(unitLabel, GaugeLayout.UNIT_LABEL);
	add(titleLabel, GaugeLayout.TITLE_LABEL);
	add(needle, GaugeLayout.NEEDLE);
	add(needleCenter, GaugeLayout.NEEDLE_CENTER);		
	addFigureListener(new FigureListener() {			
		public void figureMoved(IFigure source) {
			ramp.setDirty(true);
			revalidate();	
		}
	});	
	
}
 
Example #2
Source File: MeterFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public MeterFigure() {
	super();
	//TODO, remove this if clip is supported by RAP
	if(SWT.getPlatform().startsWith("rap"))//$NON-NLS-1$
		ramp.setVisible(false);
	setTransparent(false);
	scale.setScaleLineVisible(false);
	
	((RoundScale)scale).setStartAngle(180-SPACE_ANGLE);
	((RoundScale)scale).setEndAngle(SPACE_ANGLE);
	ramp.setRampWidth(12);
	setLoColor(XYGraphMediaFactory.getInstance().getColor(XYGraphMediaFactory.COLOR_YELLOW));
	setHiColor(XYGraphMediaFactory.getInstance().getColor(XYGraphMediaFactory.COLOR_YELLOW));
	
	valueLabel = new Label();		
	valueLabel.setFont(DEFAULT_LABEL_FONT);
	needle = new Needle();
	needle.setFill(true);
	needle.setOutline(false);
	
//	needleCenter = new Ellipse();
//	needleCenter.setOutline(false);
	
	setLayoutManager(new XMeterLayout());
	add(ramp, XMeterLayout.RAMP);
	add(scale, XMeterLayout.SCALE);			
	add(needle, XMeterLayout.NEEDLE);
//	add(needleCenter, XMeterLayout.NEEDLE_CENTER);		
	add(valueLabel, XMeterLayout.VALUE_LABEL);
	
	addFigureListener(new FigureListener() {			
		public void figureMoved(IFigure source) {
			ramp.setDirty(true);
			revalidate();	
		}
	});	
	
}
 
Example #3
Source File: ProgressBarFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public ProgressBarFigure() {
	
	super();
	scale.setScaleLineVisible(false);
	scale.setTickLabelSide(LabelSide.Secondary);
	
	if(horizontal) {
		((LinearScale)scale).setOrientation(Orientation.HORIZONTAL);
		scale.setTickLabelSide(LabelSide.Primary);		
		marker.setLabelSide(LabelSide.Secondary);			
	}else {
		((LinearScale)scale).setOrientation(Orientation.VERTICAL);
		scale.setTickLabelSide(LabelSide.Primary);		
		marker.setLabelSide(LabelSide.Secondary);	
	}		
	
	track = new Track();		

	label = new Label();
	label.setOpaque(false);		
	
	thumb = new Thumb();
	thumb.setVisible(indicatorMode);
	
	setLayoutManager(new ProgressBarLayout());
	add(scale, ProgressBarLayout.SCALE);
	add(marker, ProgressBarLayout.MARKERS);
	add(track, ProgressBarLayout.TRACK);
	add(thumb, ProgressBarLayout.THUMB);
	add(label, ProgressBarLayout.LABEL);

	addFigureListener(new FigureListener() {			
		public void figureMoved(IFigure source) {
			revalidate();				
		}
	});	
}
 
Example #4
Source File: KnobFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public KnobFigure() {
	super();
	transparent = true;
	scale.setScaleLineVisible(false);
	ramp.setRampWidth(12);		
	valueLabel = new Label();		
	valueLabel.setFont(DEFAULT_LABEL_FONT);
	bulb = new Bulb();
	
	thumb = new Thumb();
	thumb.setOutline(false);
	setLayoutManager(new KnobLayout());
	add(ramp, KnobLayout.RAMP);
	add(bulb, KnobLayout.BULB);		
	add(scale, KnobLayout.SCALE);		
	add(valueLabel, KnobLayout.VALUE_LABEL);
	
	add(thumb, KnobLayout.THUMB);		
	addFigureListener(new FigureListener() {			
		public void figureMoved(IFigure source) {
			ramp.setDirty(true);
			revalidate();	
		}
	});	
	
	
}
 
Example #5
Source File: UpdateSizeLaneSelectionEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 
 */
public UpdateSizeLaneSelectionEditPolicy() {
    figureListener = new FigureListener() {

        @Override
        public void figureMoved(final IFigure source) {
            hideSelection();
            if(hasFocus || state == EditPart.SELECTED || state == EditPart.SELECTED_PRIMARY){
                showSelection();
            }
        }
    };
}
 
Example #6
Source File: AbstractSwitchLaneSelectionEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 
 */
public AbstractSwitchLaneSelectionEditPolicy() {
	figureListener = new FigureListener() {

		public void figureMoved(IFigure source) {
			hideSelection();
			if(hasFocus || state == EditPart.SELECTED || state == EditPart.SELECTED_PRIMARY){
				showSelection();
			}
		}
	};
}
 
Example #7
Source File: SwitchPoolSelectionEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 
 */
public SwitchPoolSelectionEditPolicy() {
	figureListener = new FigureListener() {

		public void figureMoved(IFigure source) {
			hideSelection();
			if(hasFocus || state == EditPart.SELECTED || state == EditPart.SELECTED_PRIMARY){
				showSelection();
			}
		}
	};
}
 
Example #8
Source File: UpdateSizePoolSelectionEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 
 */
public UpdateSizePoolSelectionEditPolicy() {
    figureListener = new FigureListener() {

        public void figureMoved(IFigure source) {
            hideSelection();
            if(hasFocus || state == EditPart.SELECTED || state == EditPart.SELECTED_PRIMARY){
                showSelection();
            }
        }
    };
}
 
Example #9
Source File: ComponentMeterFigure.java    From arx with Apache License 2.0 5 votes vote down vote up
public ComponentMeterFigure() {
    super();
    setTransparent(false);
    scale.setScaleLineVisible(false);
    
    ((RoundScale)scale).setStartAngle(180-SPACE_ANGLE);
    ((RoundScale)scale).setEndAngle(SPACE_ANGLE);
    ramp.setRampWidth(12);
    setLoColor(XYGraphMediaFactory.getInstance().getColor(XYGraphMediaFactory.COLOR_YELLOW));
    setHiColor(XYGraphMediaFactory.getInstance().getColor(XYGraphMediaFactory.COLOR_YELLOW));
    
    valueLabel = new Label();       
    valueLabel.setFont(DEFAULT_LABEL_FONT);
    needle = new Needle();
    needle.setFill(true);
    needle.setOutline(false);
    
    setLayoutManager(new XMeterLayout());
    add(ramp, XMeterLayout.RAMP);
    add(scale, XMeterLayout.SCALE);         
    add(needle, XMeterLayout.NEEDLE);
    add(valueLabel, XMeterLayout.VALUE_LABEL);
    
    addFigureListener(new FigureListener() {            
        public void figureMoved(IFigure source) {
            ramp.setDirty(true);
            revalidate();   
        }
    }); 
    
}
 
Example #10
Source File: SelectionFeedbackEditPolicy.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public SelectionFeedbackEditPolicy(final EClass eClass) {

	feedBackFigure = new RoundedRectangle(){
		protected void fillShape(Graphics graphics) {
			Rectangle r = getBounds() ;

			Point topLeft = r.getTopLeft();
			Point bottomRight = r.getBottomRight();
			Color backGroundColor = null ;
			if(useSelectionColor){
				backGroundColor = ColorRegistry.getInstance().getColor(selectionColor) ;
			}else{
				backGroundColor=FiguresHelper.getFeedbackColor(eClass) ;
			}


			Pattern pattern = new Pattern(Display.getCurrent(), topLeft.x,
					topLeft.y, bottomRight.x, bottomRight.y,
					backGroundColor,30, backGroundColor,60);

			graphics.setBackgroundPattern(pattern);
			graphics.fillRoundRectangle(r, 20, 20) ;
			graphics.setAlpha(0) ;
			graphics.setBackgroundPattern(null);	
			pattern.dispose();

		};
	} ;


	figureListener = new FigureListener() {

		public void figureMoved(IFigure source) {
			hideFeedback();
			List<?> selectedEditPart = getHost().getViewer().getSelectedEditParts() ;
			if(selectedEditPart.contains(getHost())){

				if(!figureIsDisplayed()){
					showFeedback(zoomManager.getZoom());
				}
			}
		}
	};

}