⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htmlbasedcomponent.java

📁 非常接近C/S操作方式的Java Ajax框架-ZK 用ZK框架使你的B/S应用程序更漂亮更易操作。 官网:www.zkoss.org
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* HtmlBasedComponent.java{{IS_NOTE	Purpose:			Description:			History:		Sat Dec 31 12:30:18     2005, Created by tomyeh}}IS_NOTECopyright (C) 2004 Potix Corporation. All Rights Reserved.{{IS_RIGHT	This program is distributed under GPL Version 2.0 in the hope that	it will be useful, but WITHOUT ANY WARRANTY.}}IS_RIGHT*/package org.zkoss.zk.ui;import org.zkoss.lang.Objects;import org.zkoss.lang.Strings;import org.zkoss.util.logging.Log;import org.zkoss.xml.HTMLs;import org.zkoss.zk.ui.AbstractComponent;import org.zkoss.zk.ui.event.Event;import org.zkoss.zk.ui.event.Events;import org.zkoss.zk.ui.event.EventListener;import org.zkoss.zk.ui.ext.client.Movable;import org.zkoss.zk.ui.ext.client.Sizable;import org.zkoss.zk.ui.ext.client.ZIndexed;import org.zkoss.zk.ui.ext.render.Transparent;import org.zkoss.zk.ui.ext.render.ZidRequired;import org.zkoss.zk.ui.sys.ComponentCtrl;import org.zkoss.zk.ui.sys.ComponentsCtrl;import org.zkoss.zk.au.AuFocus;/** * A skeletal implementation for HTML based components. * It simplifies to implement methods common to HTML based components. * * <p>It supports * <ul> * <li>{@link #getSclass} and {@link #getStyle}.</li> * <li>{@link #getWidth}, {@link #getHeight}, {@link #getLeft}, * {@link #getTop}, {@link #getZIndex}</li> * <li>{@link #getOuterAttrs}</li> * <li>{@link #getInnerAttrs}</li> * <li>{@link #focus}</li> * </ul> * * @author tomyeh */abstract public class HtmlBasedComponent extends AbstractComponent {	private static final Log log = Log.lookup(HtmlBasedComponent.class);	private String _tooltiptext;	/** The width. */	private String _width;	/** The height. */	private String _height;	/** The CSS class. */	private String _sclass;	/** The CSS style. */	private String _style;	private String _left, _top;	/** The draggable. */	private String _draggable;	/** The droppable. */	private String _droppable;	private int _zIndex = -1;	protected HtmlBasedComponent() {	}	/** Returns the left position.	 */	public String getLeft() {		return _left;	}	/** Sets the left position.	 */	public void setLeft(String left) {		if (!Objects.equals(_left, left)) {			_left = left;			smartUpdate("style.left", getLeft());		}	}	/** Returns the top position.	 */	public String getTop() {		return _top;	}	/** Sets the top position.	 */	public void setTop(String top) {		if (_top != top) {			_top = top;			smartUpdate("style.top", getTop());		}	}	/** Returns the Z index.	 * <p>Default: -1 (means system default;	 */	public int getZIndex() {		return _zIndex;	}	/** Sets the Z index.	 */	public void setZIndex(int zIndex) {		if (_zIndex < -1)			_zIndex = -1;		if (_zIndex != zIndex) {			_zIndex = zIndex;			if (_zIndex < 0)				smartUpdate("style.zIndex", null);			else				smartUpdate("style.zIndex", _zIndex);		}	}	/** Returns the height. If null, the best fit is used.	 * <p>Default: null.	 */	public String getHeight() {		return _height;	}	/** Sets the height. If null, the best fit is used.	 */	public void setHeight(String height) {		if (height != null && height.length() == 0)			height = null;		if (!Objects.equals(_height, height)) {			_height = height;			smartUpdate("style.height", getHeight());		}	}	/** Returns the width. If null, the best fit is used.	 * <p>Default: null.	 */	public String getWidth() {		return _width;	}	/** Sets the width. If null, the best fit is used.	 */	public void setWidth(String width) {		if (width != null && width.length() == 0)			width = null;		if (!Objects.equals(_width, width)) {			_width = width;			smartUpdate("style.width", getWidth());		}	}	/** Returns the text as the tooltip.	 * <p>Default: null.	 */	public String getTooltiptext() {		return _tooltiptext;	}	/** Sets the text as the tooltip.	 */	public void setTooltiptext(String tooltiptext) {		if (tooltiptext != null && tooltiptext.length() == 0)			tooltiptext = null;		if (!Objects.equals(_tooltiptext, tooltiptext)) {			_tooltiptext = tooltiptext;			smartUpdate("title", _tooltiptext);		}	}	/** Returns the CSS class.	 * Due to Java's limitation, we cannot use the name called getClas.	 * <p>Default: null (the default value depends on element).	 */	public String getSclass() {		return _sclass;	}	/** Sets the CSS class.	 */	public void setSclass(String sclass) {		if (sclass != null && sclass.length() == 0) sclass = null;		if (!Objects.equals(_sclass, sclass)) {			_sclass = sclass;			smartUpdate("class", getSclass());		}	}	/** Sets the CSS class. This method is a bit confused with Java's class,	 * but we provide it for XUL compatibility.	 * The same as {@link #setSclass}.	 */	public final void setClass(String sclass) {		setSclass(sclass);	}	/** Returns the CSS style.	 * <p>Default: null.	 */	public String getStyle() {		return _style;	}	/** Sets the CSS style.	 */	public void setStyle(String style) {		if (style != null && style.length() == 0) style = null;		if (!Objects.equals(_style, style)) {			_style = style;			smartUpdate("style", getRealStyle());		}	}	/** Sets "true" or "false" to denote whether a component is draggable,	 * or an identifier of a draggable type of objects.	 *	 * <p>The simplest way to make a component draggable is to set	 * this attribute to true. To disable it, set this to false.	 *	 * <p>If there are several types of draggable objects, you could	 * assign an identifier for each type of draggable object.	 * The identifier could be anything but empty.	 *	 * @param draggable "false", null or "" to denote non-draggable; "true" for draggable	 * with anonymous identifier; others for an identifier of draggable.	 */	public void setDraggable(String draggable) {		if (draggable != null		&& (draggable.length() == 0 || "false".equals(draggable)))			draggable = null;		if (!Objects.equals(_draggable, draggable)) {			_draggable = draggable;			smartUpdate("z.drag", _draggable);		}	}	/** Returns the identifier of a draggable type of objects, or "false"	 * if not draggable (never null or empty).	 */	public final String getDraggable() {		return _draggable != null ? _draggable: "false";	}	/** Sets "true" or "false" to denote whether a component is droppable,	 * or a list of identifiers of draggable types of objects that could	 * be droped to this component.	 *	 * <p>The simplest way to make a component droppable is to set	 * this attribute to true. To disable it, set this to false.	 *	 * <p>If there are several types of draggable objects and this	 * component accepts only some of them, you could assign a list of	 * identifiers that this component accepts, separated by comma.	 * For example, if this component accpets dg1 and dg2, then	 * assign "dg1, dg2" to this attribute.	 *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -