/*
* 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.
*/
/**
* Provides the look and feel for a plain text editor. In this
* implementation the default UI is extended to act as a simple
* view factory.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans<sup><font size="-2">TM</font></sup>
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Timothy Prinzing
*/
/**
* Creates a UI for a JTextArea.
*
* @param ta a text area
* @return the UI
*/
return new BasicTextAreaUI();
}
/**
* Constructs a new BasicTextAreaUI object.
*/
public BasicTextAreaUI() {
super();
}
/**
* Fetches the name used as a key to look up properties through the
* UIManager. This is used as a prefix to all the standard
* text properties.
*
* @return the name ("TextArea")
*/
return "TextArea";
}
protected void installDefaults() {
super.installDefaults();
//the fix for 4785160 is undone
}
/**
* This method gets called when a bound property is changed
* on the associated JTextComponent. This is a hook
* which UI implementations may change to reflect how the
* UI displays bound properties of JTextComponent subclasses.
* This is implemented to rebuild the View when the
* <em>WrapLine</em> or the <em>WrapStyleWord</em> property changes.
*
* @param evt the property change event
*/
super.propertyChange(evt);
// rebuild the view
modelChanged();
}
}
/**
* The method is overridden to take into account caret width.
*
* @param c the editor component
* @return the preferred size
* @throws IllegalArgumentException if invalid value is passed
*
* @since 1.5
*/
return super.getPreferredSize(c);
//the fix for 4785160 is undone
}
/**
* The method is overridden to take into account caret width.
*
* @param c the editor component
* @return the minimum size
* @throws IllegalArgumentException if invalid value is passed
*
* @since 1.5
*/
return super.getMinimumSize(c);
//the fix for 4785160 is undone
}
/**
* Creates the view for an element. Returns a WrappedPlainView or
* PlainView.
*
* @param elem the element
* @return the view
*/
// build a view that support bidi
return createI18N(elem);
} else {
JTextComponent c = getComponent();
if (c instanceof JTextArea) {
View v;
if (area.getLineWrap()) {
} else {
}
return v;
}
}
return null;
}
return new PlainParagraph(elem);
}
}
return null;
}
/**
* Returns the baseline.
*
* @throws NullPointerException {@inheritDoc}
* @throws IllegalArgumentException {@inheritDoc}
* @see javax.swing.JComponent#getBaseline(int, int)
* @since 1.6
*/
getProperty("i18n");
if (fieldBaseline < 0) {
return -1;
}
return baseline + fieldBaseline;
}
return -1;
}
}
/**
* Returns an enum indicating how the baseline of the component
* changes as the size changes.
*
* @throws NullPointerException {@inheritDoc}
* @see javax.swing.JComponent#getBaseline(int, int)
* @since 1.6
*/
JComponent c) {
super.getBaselineResizeBehavior(c);
}
/**
* Paragraph for representing plain-text lines that support
* bidirectional text.
*/
super(elem);
layoutPool.setParent(this);
}
}
}
protected void setPropertiesFromAttributes() {
Component c = getContainer();
} else {
}
}
/**
* Fetch the constraining span to flow against for
* the given child index.
*/
Component c = getContainer();
if (c instanceof JTextArea) {
if (! area.getLineWrap()) {
// no limit if unwrapped
}
}
return super.getFlowSpan(index);
}
SizeRequirements r) {
Component c = getContainer();
if (c instanceof JTextArea) {
if (! area.getLineWrap()) {
// min is pref if unwrapped
} else {
// We have been initially set to MAX_VALUE, but we
// don't want this as our preferred.
}
}
}
return req;
}
/**
* Sets the size of the view. If the size has changed, layout
* is redone. The size is the full size of the view including
* the inset areas.
*
* @param width the width >= 0
* @param height the height >= 0
*/
preferenceChanged(null, true, true);
}
}
/**
* This class can be used to represent a logical view for
* a flow. It keeps the children updated to reflect the state
* of the model, gives the logical child views access to the
* view hierarchy, and calculates a preferred span. It doesn't
*/
super(elem);
}
}
return 0;
}
DocumentEvent e, ViewFactory f) {
return false;
}
super.loadChildren(f);
} else {
append(v);
}
}
if( getViewCount() != 1 )
throw new Error("One child view is assumed.");
return v.getPreferredSpan(axis);
}
/**
* Forward the DocumentEvent to the given child view. This
* is implemented to reparent the child to the logical view
* (the children may have been parented by a row in the flow
* if they fit without breaking) and then execute the superclass
* behavior.
*
* @param v the child view to forward the event to.
* @param e the change information from the associated document
* @param a the current allocation of the view
* @param f the factory to use to rebuild if the view has children
* @see #forwardUpdate
* @since 1.3
*/
Shape a, ViewFactory f) {
v.setParent(this);
super.forwardUpdateToView(v, e, a, f);
}
// The following methods don't do anything useful, they
// simply keep the class from being abstract.
}
return false;
}
return false;
}
return null;
}
}
}
}
}