001/*
002 * Copyright (c) 2003-2010 The Regents of the University of California.
003 * All rights reserved.
004 *
005 * '$Author: welker $'
006 * '$Date: 2010-05-06 05:21:26 +0000 (Thu, 06 May 2010) $' 
007 * '$Revision: 24234 $'
008 * 
009 * Permission is hereby granted, without written agreement and without
010 * license or royalty fees, to use, copy, modify, and distribute this
011 * software and its documentation for any purpose, provided that the above
012 * copyright notice and the following two paragraphs appear in all copies
013 * of this software.
014 *
015 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
016 * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
017 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
018 * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
019 * SUCH DAMAGE.
020 *
021 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
022 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
024 * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
025 * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
026 * ENHANCEMENTS, OR MODIFICATIONS.
027 *
028 */
029
030package org.ecoinformatics.seek.querybuilder;
031
032import java.awt.Rectangle;
033
034/**
035 * This class is derived from DBSelectTableModelItem so we can pick up some
036 * basic funcationality for getting and setting of the name and criteria etc.
037 */
038public class DBWhereListCellBase extends DBSelectTableModelItem implements
039                DBWhereIFace {
040        protected DBWhereOperator mParent = null;
041        protected Rectangle mRect = new Rectangle();
042        protected int mDepth = 1;
043        protected boolean mIsDragOver = false;
044
045        /**
046         * Constructor
047         * 
048         * @param aParent
049         *            the parent object
050         */
051        public DBWhereListCellBase(DBWhereOperator aParent) {
052                super();
053                mParent = aParent;
054        }
055
056        /**
057         * Returns the parent
058         * 
059         * @return parent object
060         */
061        public DBWhereOperator getParent() {
062                return mParent;
063        }
064
065        /**
066         * Sets the depth
067         * 
068         * @param aDepth
069         *            the new depth
070         */
071        public void setDepth(int aDepth) {
072                mDepth = aDepth;
073        }
074
075        /**
076         * Returns the depth
077         * 
078         * @return depth
079         */
080        public int getDepth() {
081                return mDepth;
082        }
083
084        /**
085         * Sets the bounds of the item
086         */
087        public void setBounds(Rectangle aRect) {
088                mRect.setBounds(aRect);
089        }
090
091        /**
092         * Returns the bounds
093         * 
094         * @return rectange of the bounds
095         */
096        public Rectangle getBounds() {
097                return mRect;
098        }
099
100        /**
101         * Return if it is an operator
102         * 
103         * @return boolean indicating if it is an operator
104         */
105        public boolean isOperator() {
106                return false;
107        }
108
109        /**
110         * Sets whether it is currently being dragged over
111         * 
112         * @param aVal
113         *            true if dragged over otherwise false
114         */
115        public void setDragOver(boolean aVal) {
116                mIsDragOver = aVal;
117        }
118
119        /**
120         * Returns if it is currently be dragged over
121         * 
122         * @return true if it is currently be dragged over
123         */
124        public boolean isDragOver() {
125                return mIsDragOver;
126        }
127
128        /*
129         * Returns the name
130         * 
131         * @see java.lang.Object#toString()
132         */
133        public String toString() {
134                return mName;
135        }
136
137        /*
138         * Returns the name
139         * 
140         * @see java.lang.Object#toString()
141         */
142        public String toString(boolean aUseSymbols) {
143                return toString();
144        }
145
146}