
com.globalmentor.swing.text.xml.XMLAnonymousParagraphView Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of globalmentor-swing Show documentation
Show all versions of globalmentor-swing Show documentation
GlobalMentor Java Swing library.
The newest version!
/*
* Copyright © 1996-2009 GlobalMentor, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.globalmentor.swing.text.xml;
/**
* A paragraph view for wrapping around a subset of child elements because other block child elements exist.
* @author Garret Wilson
*/
public class XMLAnonymousParagraphView //TODO del this class if we don't need
{
/** The attributes of the anonymous block view. */
//TODO del if not needed protected final AttributeSet attributeSet;
/**
* Fetches the attributes to use when rendering. This view uses its own anonymous attributes instead of the attributes of the element it represents.
* @return The attributes of the anonymous block view.
*/
/*TODO del if not needed
public AttributeSet getAttributes()
{
return attributeSet; //return our attributes
}
*/
/** The child elements for which this anonymous view is responsible. */
//TODO del if not needed protected final Element[] ownedElements;
/**
* Constructs an anonymous paragraph view for the given element.
* @param element The element this view is responsible for, although in most cases an anonymous view is not responsible for the entire element.
* @param attributes The attributes for the anonymous view.
* @param childElements The children of element
for which this anonymous view is responsible.
*/
/*TODO del if not needed
public XMLAnonymousParagraphView(final Element element, final AttributeSet attributes, final Element[] childElements)
{
super(element); //construct the parent view
attributeSet=attributes; //set the attributes for this view
ownedElements=childElements; //save our children
}
*/
/**
* Loads all of the children to initialize the view. This is called by the setParent
method. This is reimplemented to not load any children
* directly, as they are created in the process of formatting. If the layoutPool variable is null
, an instance of LogicalView
is
* created to represent the logical view that is used in the process of formatting. This version of loadChildren
is implemented to return
* specifically a XMLParagraphView.LogicalView
, so that that view can implement its own special version of child view construction.
* @param viewFactory The view factory to use for child view creation.
*/
/*TODO del if not needed
protected void loadChildren(ViewFactory f)
{
if(layoutPool==null) { //if there is no layout pool
//TODO del Log.trace("XMLParagraphView.loadChildren() creating new logical view");
layoutPool=new LogicalView(getElement()); //create our own brand of logical view that will correctly create paragraph child views
}
//we only need to load views if we previously had no views in the pool;
//this is to compensate for FlowView, which unconditionally loads children
//when there are no child views, even if there are views in the pool
final boolean needsLoading=layoutPool.getViewCount()==0;
layoutPool.setParent(this); //tell the layout pool that we're its parent, so that it can begin creating its child views
//TODO del Log.trace("layout pool has "+layoutPool.getViewCount()+" children.");
//TODO del Log.trace("layout child is of type: "+layoutPool.getView(0).getClass().getName());
if(needsLoading) { //if we really need to load things
//TODO del Log.trace("Updating the strategy and stuff");
final int poolViewCount=layoutPool.getViewCount(); //find out how many views are in the pool
//see if there are only object views present, how many inline views there are, etc.
boolean onlyObjectsPresent=true; //assume there are only objects present in this paragraph
int inlineViewCount=0; //we'll keep a record of how many inline views there are
//TODO fix boolean firstInlineViewHasMultipleWords=false; //assume the first inline view has multiple words
for(int i=0; i1 || !isInTableCell)); //if there are only objects present in this paragraph, or if there's only one inline view in a table cell, we won't indent
//This synthetic insertUpdate call gives the strategy a chance to initialize.
strategy.insertUpdate( this, null, null );
}
}
*/
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy