001: package org.drools.brms.client.common;
002:
003: /*
004: * Copyright 2005 JBoss Inc
005: *
006: * Licensed under the Apache License, Version 2.0 (the "License");
007: * you may not use this file except in compliance with the License.
008: * You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: */
018:
019: import com.google.gwt.user.client.ui.Composite;
020:
021: public abstract class DirtyableComposite extends Composite implements
022: DirtyableWidget {
023: protected boolean dirtyflag = false;
024:
025: /*
026: * (non-Javadoc)
027: *
028: * @see org.drools.brms.client.common.isDirtable#isDirty()
029: */
030: public boolean isDirty() {
031: return this .dirtyflag;
032: }
033:
034: /*
035: * (non-Javadoc)
036: *
037: * @see org.drools.brms.client.common.isDirtable#resetDirty()
038: */
039: public void resetDirty() {
040: this .dirtyflag = false;
041: }
042:
043: /*
044: * (non-Javadoc)
045: *
046: * @see org.drools.brms.client.common.isDirtable#makeDirty()
047: */
048: public void makeDirty() {
049: this .dirtyflag = true;
050: }
051:
052: public static native int getHeight() /*-{
053: var yScroll;
054:
055: if ($wnd.innerHeight && $wnd.scrollMaxY) {
056: yScroll = $wnd.innerHeight + $wnd.scrollMaxY;
057: }
058: else if ($doc.body.scrollHeight > $doc.body.offsetHeight){ // all but Explorer Mac
059: yScroll = $doc.body.scrollHeight;
060: }
061: else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
062: yScroll = $doc.body.offsetHeight;
063: }
064:
065: var windowHeight;
066: if (self.innerHeight) { // all except Explorer
067: windowHeight = self.innerHeight;
068: }
069: else if ($doc.documentElement && $doc.documentElement.clientHeight) { // Explorer 6 Strict Mode
070: windowHeight = $doc.documentElement.clientHeight;
071: }
072: else if ($doc.body) { // other Explorers
073: windowHeight = $doc.body.clientHeight;
074: }
075:
076: // for small pages with total height less then height of the viewport
077: if(yScroll < windowHeight){
078: pageHeight = windowHeight;
079: }
080: else {
081: pageHeight = yScroll;
082: }
083: return pageHeight;
084: }-*/;
085:
086: public static native int getWidth() /*-{
087: var xScroll;
088:
089: if ($wnd.innerHeight && $wnd.scrollMaxY) {
090: xScroll = $doc.body.scrollWidth;
091: }
092: else if ($doc.body.scrollHeight > $doc.body.offsetHeight){ // all but Explorer Mac
093: xScroll = $doc.body.scrollWidth;
094: }
095: else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
096: xScroll = $doc.body.offsetWidth;
097: }
098:
099: var windowHeight;
100: if (self.innerHeight) { // all except Explorer
101: windowWidth = self.innerWidth;
102: }
103: else if ($doc.documentElement && $doc.documentElement.clientHeight) { // Explorer 6 Strict Mode
104: windowWidth = $doc.documentElement.clientWidth;
105: }
106: else if ($doc.body) { // other Explorers
107: windowWidth = $doc.body.clientWidth;
108: }
109:
110: // for small pages with total width less then width of the viewport
111: if(xScroll < windowWidth){
112: pageWidth = windowWidth;
113: }
114: else {
115: pageWidth = xScroll;
116: }
117: return pageWidth;
118: }-*/;
119:
120: }
|