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

📄 component.java

📁 Wicket一个开发Java Web应用程序框架。它使得开发web应用程序变得容易而轻松。 Wicket利用一个POJO data beans组件使得它可以与任何持久层技术相结合。
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
	}	/**	 * Gets the variation string of this component that will be used to look up markup for this	 * component. Subclasses can override this method to define by an instance what markup variation	 * should be picked up. By default it will return null or the value of a parent.	 * 	 * @return The variation of this component.	 */	public String getVariation()	{		String variation = null;		if (parent != null)		{			variation = parent.getVariation();		}		return variation;	}	/**	 * Gets whether this component was rendered at least once.	 * 	 * @return true if the component has been rendered before, false if it is merely constructed	 */	public final boolean hasBeenRendered()	{		return getFlag(FLAG_HAS_BEEN_RENDERED);	}	/**	 * @return True if this component has an error message	 */	public final boolean hasErrorMessage()	{		return Session.get().getFeedbackMessages().hasErrorMessageFor(this);	}	/**	 * @return True if this component has some kind of feedback message	 */	public final boolean hasFeedbackMessage()	{		return Session.get().getFeedbackMessages().hasMessageFor(this);	}	/**	 * Registers an informational feedback message for this component	 * 	 * @param message	 *            The feedback message	 */	public final void info(final String message)	{		Session.get().getFeedbackMessages().info(this, message);		Session.get().dirty();	}	/**	 * @deprecated	 */	// TODO remove after deprecation release	public final void internalAttach()	{		throw new UnsupportedOperationException();	}	/**	 * @deprecated	 */	// TODO remove after deprecation release	public final void internalDetach()	{		throw new UnsupportedOperationException();	}	/**	 * Authorizes an action for a component.	 * 	 * @param action	 *            The action to authorize	 * @return True if the action is allowed	 * @throws AuthorizationException	 *             Can be thrown by implementation if action is unauthorized	 */	public final boolean isActionAuthorized(Action action)	{		IAuthorizationStrategy authorizationStrategy = getSession().getAuthorizationStrategy();		if (authorizationStrategy != null)		{			return authorizationStrategy.isActionAuthorized(this, action);		}		return true;	}	/**	 * Returns true if this component is an ancestor of the given component	 * 	 * @param component	 *            The component to check	 * @return True if the given component has this component as an ancestor	 * @deprecated use getParent().contains(component, false)	 */	public final boolean isAncestorOf(final Component component)	{		return getParent().contains(component, false);		// // Walk up containment hierarchy		// for (MarkupContainer current = component.parent; current != null;		// current = current		// .getParent())		// {		// // Is this an ancestor?		// if (current == this)		// {		// return true;		// }		// }		//		// // This component is not an ancestor of the given component		// return false;	}	/**	 * @return true if this component is authorized to be enabled, false otherwise	 */	public final boolean isEnableAllowed()	{		return isActionAuthorized(ENABLE);	}	/**	 * Gets whether this component is enabled. Specific components may decide to implement special	 * behavior that uses this property, like web form components that add a disabled='disabled'	 * attribute when enabled is false.	 * 	 * @return Whether this component is enabled.	 */	public boolean isEnabled()	{		return getFlag(FLAG_ENABLED);	}	/**	 * Checks the security strategy if the {@link Component#RENDER} action is allowed on this	 * component	 * 	 * @return ture if {@link Component#RENDER} action is allowed, false otherwise	 */	public final boolean isRenderAllowed()	{		return getFlag(FLAG_IS_RENDER_ALLOWED);	}	/**	 * Returns if the component is stateless or not. It checks the stateless hint if that is false	 * it returns directly false. If that is still true it checks all its behaviors if they can be	 * stateless.	 * 	 * @return whether the component is stateless.	 */	public final boolean isStateless()	{		if (!getStatelessHint())		{			return false;		}		final Iterator behaviors = getBehaviors().iterator();		while (behaviors.hasNext())		{			IBehavior behavior = (IBehavior)behaviors.next();			if (!behavior.getStatelessHint(this))			{				return false;			}		}		return true;	}	/**	 * @return True if this component is versioned	 */	public boolean isVersioned()	{		// Is the component itself versioned?		if (!getFlag(FLAG_VERSIONED))		{			return false;		}		else		{			// If there's a parent and this component is versioned			if (parent != null)			{				// Check if the parent is unversioned. If any parent				// (recursively) is unversioned, then this component is too				if (!parent.isVersioned())				{					return false;				}			}			return true;		}	}	/**	 * Gets whether this component and any children are visible.	 * <p>	 * WARNING: this method can be called multiple times during a request. If you override this	 * method, it is a good idea to keep it cheap in terms of processing. Alternatively, you can	 * call {@link #setVisible(boolean)}.	 * <p>	 * 	 * @return True if component and any children are visible	 */	public boolean isVisible()	{		return getFlag(FLAG_VISIBLE);	}	/**	 * Checks if the component itself and all its parents are visible.	 * 	 * @return true if the component and all its parents are visible.	 */	public final boolean isVisibleInHierarchy()	{		Component component = this;		while (component != null)		{			if (component.isRenderAllowed() && component.isVisible())			{				component = component.getParent();			}			else			{				return false;			}		}		return true;	}	/**	 * Sets the RENDERING flag on component and it's children.	 */	public final void markRendering()	{		internalMarkRendering();	}	/**	 * Called to indicate that the model content for this component has been changed	 */	public final void modelChanged()	{		// Call user code		internalOnModelChanged();		onModelChanged();	}	/**	 * Called to indicate that the model content for this component is about to change	 */	public final void modelChanging()	{		checkHierarchyChange(this);		// Call user code		onModelChanging();		// Tell the page that our model changed		final Page page = findPage();		if (page != null)		{			page.componentModelChanging(this);		}	}	/**	 * Creates a new page using the component's page factory	 * 	 * @param c	 *            The class of page to create	 * @return The new page	 */	public final Page newPage(final Class c)	{		return getPageFactory().newPage(c);	}	/**	 * Creates a new page using the component's page factory	 * 	 * @param c	 *            The class of page to create	 * @param parameters	 *            Any parameters to pass to the constructor	 * @return The new page	 */	public final Page newPage(final Class c, final PageParameters parameters)	{		return getPageFactory().newPage(c, parameters);	}	/**	 * Prepares the component and it's children for rendering. On whole page render this method must	 * be called on the page. On AJAX request, this method must be called on updated component.	 */	public void prepareForRender()	{		beforeRender();		List feedbacks = (List)getRequestCycle().getMetaData(FEEDBACK_LIST);		if (feedbacks != null)		{			for (Iterator i = feedbacks.iterator(); i.hasNext();)			{				Component feedback = (Component)i.next();				feedback.internalBeforeRender();			}		}		getRequestCycle().setMetaData(FEEDBACK_LIST, null);		markRendering();		// check authorization		// first the component itself		// (after attach as otherwise list views etc wont work)		setRenderAllowed();	}	/**	 * Redirects browser to an intermediate page such as a sign-in page. The current request's url	 * is saved for future use by method continueToOriginalDestination(); Only use this method when	 * you plan to continue to the current url at some later time; otherwise just use	 * setResponsePage or - when you are in a constructor or checkAccessMethod, call redirectTo.	 * 	 * @param page	 *            The sign in page	 * 	 * @see Component#continueToOriginalDestination()	 */	public final void redirectToInterceptPage(final Page page)	{		getPage().getPageMap().redirectToInterceptPage(page);	}	/**	 * Removes this component from its parent. It's important to remember that a component that is	 * removed cannot be referenced from the markup still.	 */	public final void remove()	{		if (parent == null)		{			throw new IllegalStateException("Cannot remove " + this + " from null parent!");		}		parent.remove(this);	}	/**	 * Removes behavior from component	 * 	 * @param behavior	 *            behavior to remove	 * 	 * @return this (to allow method call chaining)	 */	public Component remove(final IBehavior behavior)	{		if (behavior == null)		{			throw new IllegalArgumentException("Argument `behavior` cannot be null");		}		if (removeBehavior(behavior))		{			if (!behavior.isTemporary())			{				addStateChange(new RemovedBehaviorChange(behavior));			}		}		else		{			throw new IllegalStateException(				"Tried to remove a behavior that was not added to the component. Behavior: " +					behavior.toString());		}		return this;	}	private boolean removeBehavior(final IBehavior behavior)	{		final int start = getFlag(FLAG_MODEL_SET) ? 1 : 0;		for (int i = start; i < data_length(); ++i)		{			Object o = data_get(i);			if (o.equals(behavior))			{				data_remove(i);				return true;			}		}		return false;	}	/**	 * Performs a render of this component as part of a Page level render process.	 * <p>	 * For component level re-render (e.g. AJAX) please call {@link #renderComponent()}. Though	 * render() does seem to work, it will fail for panel children.	 */	public final void render()	{		// Allow currently invisible components to be re-rendered as well		MarkupStream markupStream = null;		if (getParent() != null)		{			markupStream = findMarkupStream();		}		render(markupStream);	}	/**	 * Performs a render of this component as part of a Page level render process.	 * <p>	 * For component level re-render (e.g. AJAX) please call {@link #renderComponent(MarkupStream)}.	 * Though render() does seem to work, it will fail for panel children.	 * 	 * @param markupStream	 */	public final void render(final MarkupStream markupStream)	{		// We need to know the index before we do the visibility check.		// Otherwise		// we wouldn't know the markup index for invisible components		if (markupStream != null)		{			markupIndex = markupStream.getCurrentIndex();		}		markRendering();		setMarkupStream(markupStream);		// Determine if component is visible using it's authorization status		// and the isVisible property.		if (isRenderAllowed() && isVisible())		{			setFlag(FLAG_HAS_BEEN_RENDERED, true);			// Rendering is beginning			if (log.isDebugEnabled())			{				log.debug("Begin 

⌨️ 快捷键说明

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