/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Implements a FrameSetView, intended to support the HTML
* <FRAMESET> tag. Supports the ROWS and COLS attributes.
*
* @author Sunita Mani
*
* Credit also to the hotjava browser engineers that
* worked on making the allocation of space algorithms
* conform to the HTML 4.0 standard and also be netscape
* compatible.
*
*/
int[] percentChildren;
int[] absoluteChildren;
int[] relativeChildren;
int percentTotals;
int absoluteTotals;
int relativeTotals;
/**
* Constructs a FrameSetView for the given element.
*
* @param elem the element that this view is responsible for
*/
}
/**
* Parses the ROW or COL attributes and returns
* an array of strings that represent the space
* distribution.
*
*/
if (attributes != null) {
}
}
int n = getViewCount();
int i = 0;
for (; i < nTokens; i++) {
// As per the spec, 100% is the same as *
// hence the mapping.
//
items[i] = "*";
}
}
// extend spec if we have more children than specified
// in ROWS or COLS attribute
items[i] = "*";
}
return items;
}
/**
* Initializes a number of internal state variables
* that store information about space allocation
* for the frames contained within the frameset.
*/
private void init() {
} else {
}
percentChildren[i] = -1;
relativeChildren[i] = -1;
absoluteChildren[i] = -1;
relativeChildren[i] =
relativeTotals += relativeChildren[i];
} else {
relativeChildren[i] = 1;
relativeTotals += 1;
}
percentTotals += percentChildren[i];
} else {
}
}
if (percentTotals > 100) {
if (percentChildren[i] > 0) {
percentChildren[i] =
}
}
percentTotals = 100;
}
}
/**
* Perform layout for the major axis of the box (i.e. the
* axis that it represents). The results of the layout should
* be placed in the given arrays which represent the allocations
* to the children along the major axis.
*
* @param targetSpan the total span given to the view, which
* whould be used to layout the children
* @param axis the axis being layed out
* @param offsets the offsets from the origin of the view for
* each of the child views; this is a return value and is
* filled in by the implementation of this method
* @param spans the span of each child view; this is a return
* value and is filled in by the implementation of this method
* @return the offset and span for each child view in the
* offsets and spans parameters
*/
int[] spans) {
init();
}
axis),
}
int n = getViewCount();
if ((v instanceof FrameView) || (v instanceof FrameSetView)) {
(int) v.getMaximumSpan(axis),
0.5f);
sIndex++;
} else {
float a = v.getAlignment(axis);
}
}
return reqs;
}
/**
* This method is responsible for returning in span[] the
* span for each child view along the major axis. it
* computes this based on the information that extracted
*/
if (targetSpan == 0) {
return;
}
int tempSpace = 0;
int remainingSpace = targetSpan;
// allocate the absolute's first, they have
// precedence
//
if (absoluteChildren[i] > 0) {
span[i] = absoluteChildren[i];
remainingSpace -= span[i];
}
}
// then deal with percents.
//
remainingSpace -= span[i];
remainingSpace -= span[i];
}
}
// allocate remainingSpace to relative
if (relativeChildren[i] > 0) {
span[i] = (remainingSpace *
relativeChildren[i]) / relativeTotals;
}
}
} else if (remainingSpace > 0) {
// There are no relative columns and the space has been
// under- or overallocated. In this case, turn all the
// percentage and pixel specified columns to percentage
// columns based on the ratio of their pixel count to the
// total "virtual" size. (In the case of percentage columns,
// the pixel count would equal the specified percentage
// of the screen size.
// This action is in accordance with the HTML
// 4.0 spec (see section 8.3, the end of the discussion of
// the FRAMESET tag). The precedence of percentage and pixel
// specified columns is unclear (spec seems to indicate that
// they share priority, however, unspecified what happens when
// overallocation occurs.)
// addendum is that we behave similiar to netscape in that specified
// widths have precedance over percentage widths...
// ok we know what our total space is, and we know how large each
// column should be relative to each other... therefore we can use
// that relative information to deduce their percentages of a whole
// and then scale them appropriately for the correct size
remainingSpace -= span[i];
}
// this is for just in case there is something left over.. if there is we just
// add it one pixel at a time to the frames in order.. We shouldn't really ever get
// here and if we do it shouldn't be with more than 1 pixel, maybe two.
int i = 0;
while (remainingSpace != 0) {
if (remainingSpace < 0) {
span[i++]--;
}
else {
span[i++]++;
}
// just in case there are more pixels than frames...should never happen..
}
}
}
/*
* Users have been known to type things like "%25" and "25 %". Deal
* with it.
*/
int result = 0;
}
}
return result;
}
}