001: /*
002: * CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
003: * NETSCAPE COMMUNICATIONS CORPORATION
004: *
005: * Copyright (c) 1996 Netscape Communications Corporation.
006: * All Rights Reserved.
007: * Use of this Source Code is subject to the terms of the applicable
008: * license agreement from Netscape Communications Corporation.
009: */
010:
011: package query;
012:
013: import netscape.application.Button;
014: import netscape.application.InternalWindow;
015: import netscape.application.Size;
016:
017: public class QueryPalette extends InternalWindow {
018: private Button adjBtn;
019: private Button andBtn;
020: private Button orBtn;
021:
022: private Button eqBtn;
023: private Button neBtn;
024: private Button geBtn;
025: private Button leBtn;
026: private Button gtBtn;
027: private Button ltBtn;
028:
029: private Button delBtn;
030:
031: public QueryPalette(int x, int y) {
032: setTitle("Q");
033:
034: Size andorSize = new Size();
035: Size compareSize = new Size();
036: Size otherSize = new Size();
037: Size windSize = new Size();
038:
039: andBtn = graphical.Header.buttonMacro(Messages.OP_AND, this );
040: andorSize.union(andBtn.minSize());
041: addSubview(andBtn);
042:
043: orBtn = graphical.Header.buttonMacro(Messages.OP_OR, this );
044: andorSize.union(orBtn.minSize());
045: addSubview(orBtn);
046:
047: adjBtn = graphical.Header.buttonMacro(Messages.OP_ADJ, this );
048: andorSize.union(adjBtn.minSize());
049: addSubview(adjBtn);
050:
051: andBtn.sizeTo(andorSize.width, andorSize.height);
052: orBtn.sizeTo(andorSize.width, andorSize.height);
053: adjBtn.sizeTo(andorSize.width, andorSize.height);
054:
055: eqBtn = graphical.Header.buttonMacro(Messages.OP_EQ, this );
056: compareSize.union(eqBtn.minSize());
057: addSubview(eqBtn);
058:
059: neBtn = graphical.Header.buttonMacro(Messages.OP_NE, this );
060: compareSize.union(neBtn.minSize());
061: addSubview(neBtn);
062:
063: geBtn = graphical.Header.buttonMacro(Messages.OP_GE, this );
064: compareSize.union(geBtn.minSize());
065: addSubview(geBtn);
066:
067: leBtn = graphical.Header.buttonMacro(Messages.OP_LE, this );
068: compareSize.union(leBtn.minSize());
069: addSubview(leBtn);
070:
071: gtBtn = graphical.Header.buttonMacro(Messages.OP_GT, this );
072: compareSize.union(gtBtn.minSize());
073: addSubview(gtBtn);
074:
075: ltBtn = graphical.Header.buttonMacro(Messages.OP_LT, this );
076: compareSize.union(ltBtn.minSize());
077: addSubview(ltBtn);
078:
079: eqBtn.sizeTo(compareSize.width, compareSize.height);
080: neBtn.sizeTo(compareSize.width, compareSize.height);
081: geBtn.sizeTo(compareSize.width, compareSize.height);
082: leBtn.sizeTo(compareSize.width, compareSize.height);
083: gtBtn.sizeTo(compareSize.width, compareSize.height);
084: ltBtn.sizeTo(compareSize.width, compareSize.height);
085:
086: delBtn = graphical.Header.buttonMacro(Messages.OP_DEL, this );
087: otherSize.union(delBtn.minSize());
088: addSubview(delBtn);
089:
090: windSize.union(andorSize);
091: windSize.union(new Size((compareSize.width * 3),
092: compareSize.height));
093: windSize.union(otherSize);
094:
095: andBtn
096: .moveTo(
097: ((windSize.width == andorSize.width) ? graphical.Header.WIDGETHGAP
098: : graphical.Header.WIDGETHGAP
099: + ((windSize.width - andorSize.width) / 2)),
100: graphical.Header.WIDGETVGAP);
101: orBtn.moveTo(andBtn.x(), andBtn.y() + andorSize.height);
102: adjBtn.moveTo(andBtn.x(), orBtn.y() + andorSize.height);
103:
104: eqBtn
105: .moveTo(
106: ((windSize.width == (compareSize.width * 3)) ? graphical.Header.WIDGETHGAP
107: : graphical.Header.WIDGETHGAP
108: + ((windSize.width - (compareSize.width * 3)) / 2)),
109: adjBtn.y() + compareSize.height
110: + graphical.Header.WIDGETVGAP);
111: neBtn.moveTo(eqBtn.x(), eqBtn.y() + compareSize.height);
112: geBtn.moveTo(eqBtn.x() + compareSize.width, eqBtn.y());
113: leBtn.moveTo(eqBtn.x() + compareSize.width, neBtn.y());
114: gtBtn.moveTo(eqBtn.x() + (compareSize.width * 2), eqBtn.y());
115: ltBtn.moveTo(eqBtn.x() + (compareSize.width * 2), neBtn.y());
116:
117: delBtn
118: .moveTo(
119: ((windSize.width == otherSize.width) ? graphical.Header.WIDGETHGAP
120: : graphical.Header.WIDGETHGAP
121: + ((windSize.width - otherSize.width) / 2)),
122: neBtn.y() + compareSize.height
123: + graphical.Header.WIDGETVGAP);
124:
125: Size size = windowSizeForContentSize(windSize.width
126: + (graphical.Header.WIDGETHGAP * 2), delBtn.y()
127: + delBtn.height() + graphical.Header.WIDGETVGAP);
128: setBounds(x, y, size.width, size.height);
129: }
130:
131: public void performCommand(String command, Object arg) {
132: if (Messages.OP_AND.equals(command)) {
133: } else if (Messages.OP_OR.equals(command)) {
134: } else if (Messages.OP_ADJ.equals(command)) {
135: } else {
136: // super.performCommand( command, arg );
137: }
138: }
139: }
|