Skip to main content
aboutsummaryrefslogblamecommitdiffstats
blob: 12620a155f7d65a4282b10a343e0abcdab2d4c13 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                                                
                                                    

                                                                   
                                                                       
                                                           


                                         























                                                                                 


                        













                                                                                       

                                                                             






















                                                                                  


                            



                               


                                 



                                
/*******************************************************************************
 * Copyright (c) 2006, 2007 Sybase, Inc. and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     Sybase, Inc. - initial API and implementation
 *******************************************************************************/
package org.eclipse.jst.pagedesigner.tableedit;

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Cursors;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.LineBorder;
import org.eclipse.gef.DragTracker;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.handles.AbstractHandle;

/**
 * @author mengbo
 * @version 1.5
 */
public abstract class TableSideItemHandle extends AbstractHandle {
	private boolean _isRow;

	private int _index;

	/**
	 * @param owner 
	 * @param isRow 
	 * @param index 
	 * 
	 */
	public TableSideItemHandle(GraphicalEditPart owner, boolean isRow, int index) {
		super(owner, new EmptyLocator());
		this._isRow = isRow;
		this._index = index;
		initialize();
	}

	/**
	 * 
	 */
	private void initialize() {
		this.setOpaque(false);
		LineBorder border1 = new LineBorder(ColorConstants.green, 1);
		this.setBorder(border1);
		this.setCursor(Cursors.ARROW);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.draw2d.Figure#paintFigure(org.eclipse.draw2d.Graphics)
	 */
	protected void paintFigure(Graphics graphics) {
		graphics.setXORMode(true);
		graphics.setBackgroundColor(ColorConstants.darkGray);
		graphics.fillRectangle(getBounds());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.gef.handles.AbstractHandle#createDragTracker()
	 */
	protected DragTracker createDragTracker() {
		return new TableSideItemDragTracker(getOwner(), _isRow, _index);
	}

	/**
	 * @return the index
	 */
	public int getIndex() {
		return _index;
	}

	/**
	 * @return true if is row
	 */
	public boolean isRow() {
		return _isRow;
	}
}

Back to the top