
org.enhydra.xml.xhtml.dom.xerces.XHTMLTableRowElementImpl Maven / Gradle / Ivy
The newest version!
/*
* Enhydra Java Application Server Project
*
* The contents of this file are subject to the Enhydra Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License on
* the Enhydra web site ( http://www.enhydra.org/ ).
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific terms governing rights and limitations
* under the License.
*
* The Initial Developer of the Original Code is DigitalSesame
* Portions created by DigitalSesame are Copyright (C) 1997-2000 DigitalSesame
* All Rights Reserved.
*
* Contributor(s):
* Rex Tsai
* David Li
*
* $Id: XHTMLTableRowElementImpl.java,v 1.2 2005/01/26 08:29:24 jkjome Exp $
*/
package org.enhydra.xml.xhtml.dom.xerces;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.html.HTMLCollection;
import org.w3c.dom.html.HTMLElement;
import org.w3c.dom.html.HTMLTableCellElement;
import org.w3c.dom.html.HTMLTableElement;
import org.w3c.dom.html.HTMLTableSectionElement;
public class XHTMLTableRowElementImpl
extends XHTMLElementImpl
implements org.enhydra.xml.xhtml.dom.XHTMLTableRowElement
{
public XHTMLTableRowElementImpl (XHTMLDocumentBase owner, String namespaceURI, String tagName) {
super( owner, namespaceURI, tagName);
}
public void setId (String newValue) {
setAttribute("id", newValue);
}
public String getId () {
return getAttribute ("id");
}
public void setLang (String newValue) {
setAttribute("lang", newValue);
}
public String getLang () {
return getAttribute ("lang");
}
public void setDir (String newValue) {
setAttribute("dir", newValue);
}
public String getDir () {
return getAttribute ("dir");
}
public void setClassName (String newValue) {
setAttribute("class", newValue);
}
public String getClassName () {
return getAttribute ("class");
}
public void setTitle (String newValue) {
setAttribute("title", newValue);
}
public String getTitle () {
return getAttribute ("title");
}
public void setAlign (String newValue) {
setAttribute("align", newValue);
}
public String getAlign () {
return getAttribute ("align");
}
public void setBgColor (String newValue) {
setAttribute("bgcolor", newValue);
}
public String getBgColor () {
return getAttribute ("bgcolor");
}
public void setVAlign (String newValue) {
setAttribute("valign", newValue);
}
public String getVAlign () {
return getAttribute ("valign");
}
public void setOnKeyUp (String newValue) {
setAttribute("onkeyup", newValue);
}
public String getOnKeyUp () {
return getAttribute ("onkeyup");
}
public void setStyle (String newValue) {
setAttribute("style", newValue);
}
public String getStyle () {
return getAttribute ("style");
}
public void setOnMouseDown (String newValue) {
setAttribute("onmousedown", newValue);
}
public String getOnMouseDown () {
return getAttribute ("onmousedown");
}
public void setOnKeyPress (String newValue) {
setAttribute("onkeypress", newValue);
}
public String getOnKeyPress () {
return getAttribute ("onkeypress");
}
public void setOnDblClick (String newValue) {
setAttribute("ondblclick", newValue);
}
public String getOnDblClick () {
return getAttribute ("ondblclick");
}
public void setOnKeyDown (String newValue) {
setAttribute("onkeydown", newValue);
}
public String getOnKeyDown () {
return getAttribute ("onkeydown");
}
public void setOnMouseMove (String newValue) {
setAttribute("onmousemove", newValue);
}
public String getOnMouseMove () {
return getAttribute ("onmousemove");
}
public void setOnMouseUp (String newValue) {
setAttribute("onmouseup", newValue);
}
public String getOnMouseUp () {
return getAttribute ("onmouseup");
}
public void setXmlLang (String newValue) {
setAttribute("xml:lang", newValue);
}
public String getXmlLang () {
return getAttribute ("xml:lang");
}
public void setOnMouseOut (String newValue) {
setAttribute("onmouseout", newValue);
}
public String getOnMouseOut () {
return getAttribute ("onmouseout");
}
public void setOnClick (String newValue) {
setAttribute("onclick", newValue);
}
public String getOnClick () {
return getAttribute ("onclick");
}
public void setOnMouseOver (String newValue) {
setAttribute("onmouseover", newValue);
}
public String getOnMouseOver () {
return getAttribute ("onmouseover");
}
public void setChOff (String newValue) {
setAttribute("charoff", newValue);
}
public String getChOff () {
return getAttribute ("charoff");
}
public int getRowIndex() {
Node parent;
parent = getParentNode();
if ( parent instanceof HTMLTableSectionElement )
parent = parent.getParentNode();
if ( parent instanceof HTMLTableElement )
return getRowIndex( parent );;
return -1;
}
public void setRowIndex( int rowIndex ) {
Node parent;
parent = getParentNode();
if ( parent instanceof HTMLTableSectionElement )
parent = parent.getParentNode();
if ( parent instanceof HTMLTableElement )
((XHTMLTableElementImpl)parent).insertRowX( rowIndex, this );
}
public int getSectionRowIndex() {
Node parent;
parent = getParentNode();
if ( parent instanceof HTMLTableSectionElement )
return getRowIndex( parent );
else
return -1;
}
public void setSectionRowIndex( int sectionRowIndex ) {
Node parent;
parent = getParentNode();
if ( parent instanceof HTMLTableSectionElement )
( (XHTMLTableSectionElementImpl) parent ).insertRowX( sectionRowIndex, this );
}
int getRowIndex( Node parent ) {
NodeList rows;
int i;
// Use getElementsByTagName() which creates a snapshot of all the
// TR elements under the TABLE/section. Access to the returned NodeList
// is very fast and the snapshot solves many synchronization problems.
rows = ( (HTMLElement) parent ).getElementsByTagName( "TR" );
for ( i = 0 ; i < rows.getLength() ; ++i )
if ( rows.item( i ) == this )
return i;
return -1;
}
public HTMLCollection getCells() {
if ( _cells == null )
_cells = new XHTMLCollectionImpl( this, XHTMLCollectionImpl.CELL );
return _cells;
}
public void setCells( HTMLCollection cells ) {
Node child;
int i;
child = getFirstChild();
while ( child != null )
{
removeChild( child );
child = child.getNextSibling();
}
i = 0;
child = cells.item( i );
while ( child != null )
{
appendChild ( child );
++i;
child = cells.item( i );
}
}
public HTMLElement insertCell( int index ) {
Node child;
HTMLElement newCell;
newCell = new XHTMLTableCellElementImpl( (XHTMLDocumentBase) getOwnerDocument(), getNamespaceURI(), "TD" );
child = getFirstChild();
while ( child != null )
{
if ( child instanceof HTMLTableCellElement )
{
if ( index == 0 )
{
insertBefore( newCell, child );
return newCell;
}
--index;
}
child = child.getNextSibling();
}
appendChild( newCell );
return newCell;
}
public void deleteCell( int index ) {
Node child;
child = getFirstChild();
while ( child != null ) {
if ( child instanceof HTMLTableCellElement ) {
if ( index == 0 ) {
removeChild ( child );
return;
}
--index;
}
child = child.getNextSibling();
}
}
public String getCh() {
String ch;
// Make sure that the access key is a single character.
ch = getAttribute( "char" );
if ( ch != null && ch.length() > 1 )
ch = ch.substring( 0, 1 );
return ch;
}
public void setCh( String ch ) {
// Make sure that the access key is a single character.
if ( ch != null && ch.length() > 1 )
ch = ch.substring( 0, 1 );
setAttribute( "char", ch );
}
HTMLCollection _cells;
;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy