code
stringlengths 25
201k
| docstring
stringlengths 19
96.2k
| func_name
stringlengths 0
235
| language
stringclasses 1
value | repo
stringlengths 8
51
| path
stringlengths 11
314
| url
stringlengths 62
377
| license
stringclasses 7
values |
|---|---|---|---|---|---|---|---|
public Boolean getHasMore() {
return hasMore;
}
|
@return the {@code mode} flag used to tell Select2 whether or not there
are more results available.
|
getHasMore
|
java
|
theonedev/onedev
|
server-core/src/main/java/io/onedev/server/web/component/select2/Response.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/io/onedev/server/web/component/select2/Response.java
|
MIT
|
public Response<T> setHasMore(Boolean more) {
this.hasMore = more;
return this;
}
|
Sets the {@code more} flag used to tell Select2 whether or not there are
more results available.
@param more
more flag
@return {@code this} for chaining
|
setHasMore
|
java
|
theonedev/onedev
|
server-core/src/main/java/io/onedev/server/web/component/select2/Response.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/io/onedev/server/web/component/select2/Response.java
|
MIT
|
public Response<T> addAll(Collection<? extends T> choice) {
results.addAll(choice);
return this;
}
|
Adds choices to the collection
@param choice
@return {@code this} for chaining
|
addAll
|
java
|
theonedev/onedev
|
server-core/src/main/java/io/onedev/server/web/component/select2/Response.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/io/onedev/server/web/component/select2/Response.java
|
MIT
|
@Override
public final void toJson(T choice, JSONWriter writer) throws JSONException {
writer.key("id").value(getId(choice)).key("text").value(getDisplayText(choice));
}
|
Takes care of Json serialization for the most common usecase where each
choice is rendered as a text string.
@author igor
@param <T>
type of choice object
|
toJson
|
java
|
theonedev/onedev
|
server-core/src/main/java/io/onedev/server/web/component/select2/TextChoiceProvider.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/io/onedev/server/web/component/select2/TextChoiceProvider.java
|
MIT
|
public static void writeObject(JSONWriter writer, String key, Object value) throws JSONException {
if (value != null) {
writer.key(key);
writer.value(value);
}
}
|
Writes a key/value pair into the {@code writer} if the value is not {@code null}
@param writer
json writer
@param key
key
@param value
value
@throws JSONException
|
writeObject
|
java
|
theonedev/onedev
|
server-core/src/main/java/io/onedev/server/web/component/select2/json/Json.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/io/onedev/server/web/component/select2/json/Json.java
|
MIT
|
public static void writeFunction(JSONWriter writer, String key, String value) throws JSONException {
if (value != null) {
writer.key(key).value(new JsonFunction(value));
}
}
|
Writes a key/value pair into the {@code writer} where {@code value} represents a javascript function and should
be written out unencoded if the value is not {@code null}
@param writer
json writer
@param key
key
@param value
value
@throws JSONException
|
writeFunction
|
java
|
theonedev/onedev
|
server-core/src/main/java/io/onedev/server/web/component/select2/json/Json.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/io/onedev/server/web/component/select2/json/Json.java
|
MIT
|
public CharSequence toJson() {
return ((StringBuilderWriter) writer).getBuilder();
}
|
@return underlying {@link StringBuilder} as a {@link CharSequence}.
|
toJson
|
java
|
theonedev/onedev
|
server-core/src/main/java/io/onedev/server/web/component/select2/json/JsonBuilder.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/io/onedev/server/web/component/select2/json/JsonBuilder.java
|
MIT
|
@Override
public String toJSONString() {
return value;
}
|
Represents a Json function. When written out these values are not escaped so its possible to write out raw
JavaScript.
|
toJSONString
|
java
|
theonedev/onedev
|
server-core/src/main/java/io/onedev/server/web/component/select2/json/JsonFunction.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/io/onedev/server/web/component/select2/json/JsonFunction.java
|
MIT
|
@Nullable
public static String getGroup(AnnotatedElement element) {
Editable editable = element.getAnnotation(Editable.class);
if (editable != null && editable.group().trim().length() != 0)
return editable.group();
else
return null;
}
|
Get group of specified element from group parameter of {@link Editable} annotation.
@param element
annotated element to get group from
@return
group name of specified element, or <tt>null</tt> if not defined
|
getGroup
|
java
|
theonedev/onedev
|
server-core/src/main/java/io/onedev/server/web/editable/EditableUtils.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/io/onedev/server/web/editable/EditableUtils.java
|
MIT
|
@Nullable
public static String getIcon(AnnotatedElement element) {
Editable editable = element.getAnnotation(Editable.class);
if (editable != null && editable.icon().trim().length() != 0)
return editable.icon();
else
return null;
}
|
Get icon of specified element from icon parameter of {@link Editable} annotation.
@param element
annotated element to get icon from
@return
icon name of specified element, or <tt>null</tt> if not defined
|
getIcon
|
java
|
theonedev/onedev
|
server-core/src/main/java/io/onedev/server/web/editable/EditableUtils.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/io/onedev/server/web/editable/EditableUtils.java
|
MIT
|
public static int getOrder(AnnotatedElement element) {
Editable editable = element.getAnnotation(Editable.class);
if (editable != null)
return editable.order();
else
return Integer.MAX_VALUE;
}
|
Get display order parameter defined in {@link Editable} annotation of specified element.
@param element
annotated element to get order from
@return
defined order, or {@link Integer#MAX_VALUE} if Editable annotation is not found
|
getOrder
|
java
|
theonedev/onedev
|
server-core/src/main/java/io/onedev/server/web/editable/EditableUtils.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/io/onedev/server/web/editable/EditableUtils.java
|
MIT
|
@Override
public boolean compare(Component component, Object b)
{
final Object a = component.getDefaultModelObject();
if (a == null && b == null)
{
return true;
}
if (a == null || b == null)
{
return false;
}
return a.equals(b);
}
|
Basic model IModelComparator implementation for normal object models
|
compare
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public IMarkupFragment getMarkup()
{
// Markup already determined or preset?
if (markup != null)
{
return markup;
}
// No parent, than check associated markup files
if (parent == null)
{
// Must be a MarkupContainer to have associated markup file
if (this instanceof MarkupContainer)
{
MarkupContainer container = (MarkupContainer)this;
Markup associatedMarkup = container.getAssociatedMarkup();
if (associatedMarkup != null)
{
markup = associatedMarkup;
return markup;
}
}
// Don't know how to find the markup
throw new MarkupNotFoundException(
"Can not determine Markup. Component is not yet connected to a parent. " +
toString());
}
// Ask the parent for find the markup for me
markup = parent.getMarkup(this);
return markup;
}
|
Get the Markup associated with the Component. If not subclassed, the parent container is
asked to return the markup of this child component.
<p/>
Components like Panel and Border should return the "calling" markup fragment, e.g.
<code><span wicket:id="myPanel">body</span></code>. You may use
Panel/Border/Enclosure.getMarkup(null) to return the associated markup file. And
Panel/Border/Enclosure.getMarkup(child) will search the child in the appropriate markup
fragment.
@see MarkupContainer#getMarkup(Component)
@return The markup fragment
|
getMarkup
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final String getMarkupIdFromMarkup()
{
ComponentTag tag = getMarkupTag();
if (tag != null)
{
String id = tag.getAttribute("id");
if (Strings.isEmpty(id) == false)
{
return id.trim();
}
}
return null;
}
|
@return The 'id' attribute from the associated markup tag
|
getMarkupIdFromMarkup
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final Component setMarkup(final IMarkupFragment markup)
{
this.markup = markup;
return this;
}
|
Set the markup for the component. Note that the component's markup variable is transient and
thus must only be used for one render cycle. E.g. auto-component are using it. You may also
it if you subclassed getMarkup().
@param markup
|
setMarkup
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
protected void onInitialize()
{
setRequestFlag(RFLAG_INITIALIZE_SUPER_CALL_VERIFIED, true);
}
|
This method is meant to be used as an alternative to initialize components. Usually the
component's constructor is used for this task, but sometimes a component cannot be
initialized in isolation, it may need to access its parent component or its markup in order
to fully initialize. This method is invoked once per component's lifecycle when a path exists
from this component to the {@link Page} thus providing the component with an atomic callback
when the component's environment is built out.
<p>
Overrides must call super#{@link #onInitialize()}. Usually this should be the first thing an
override does, much like a constructor.
</p>
<p>
Parent containers are guaranteed to be initialized before their children
</p>
<p>
It is safe to use {@link #getPage()} in this method
</p>
<p>
NOTE:The timing of this call is not precise, the contract is that it is called sometime
before {@link Component#onBeforeRender()}.
</p>
|
onInitialize
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
final boolean isInitialized()
{
return getFlag(FLAG_INITIALIZED);
}
|
Checks if the component has been initialized - {@link #onInitialize()} has been called
@return {@code true} if component has been initialized
|
isInitialized
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public void internalInitialize()
{
fireInitialize();
}
|
THIS METHOD IS NOT PART OF THE PUBLIC API, DO NOT CALL IT
Used to call {@link #onInitialize()}
|
internalInitialize
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final void afterRender()
{
try
{
setFlag(FLAG_AFTER_RENDERING, true);
// always detach children because components can be attached
// independently of their parents
onAfterRenderChildren();
onAfterRender();
getApplication().getComponentOnAfterRenderListeners().onAfterRender(this);
if (getFlag(FLAG_AFTER_RENDERING))
{
throw new IllegalStateException(Component.class.getName() +
" has not been properly detached. Something in the hierarchy of " +
getClass().getName() +
" has not called super.onAfterRender() in the override of onAfterRender() method");
}
}
finally
{
// this flag must always be set to false.
markRendering(false);
}
}
|
Called on every component after the page is rendered. It will call onAfterRender for it self
and its children.
|
afterRender
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final void configure()
{
if (!getRequestFlag(RFLAG_CONFIGURED))
{
clearEnabledInHierarchyCache();
clearVisibleInHierarchyCache();
onConfigure();
for (Behavior behavior : getBehaviors())
{
if (isBehaviorAccepted(behavior))
{
behavior.onConfigure(this);
}
}
// check authorization
setRenderAllowed();
internalOnAfterConfigure();
getApplication().getComponentOnConfigureListeners().onConfigure(this);
setRequestFlag(RFLAG_CONFIGURED, true);
}
}
|
Triggers {@link #onConfigure()} to be invoked on this component if it has not already during
this request.
<p>
This method should be invoked before any calls to {@link #isVisible()} or
{@link #isEnabled()}. Usually this method will be called by the framework before the
component is rendered and so users should not need to call it; however, in cases where
visibility or enabled or other state of one component depends on the state of another this
method should be manually invoked on the other component by the user. EG to link visiliby of
two markup containers the following should be done:
<pre>
final WebMarkupContainer source=new WebMarkupContainer("a") {
protected void onConfigure() {
setVisible(Math.rand()>0.5f);
}
};
WebMarkupContainer linked=new WebMarkupContainer("b") {
protected void onConfigure() {
source.configure(); // make sure source is configured
setVisible(source.isVisible());
}
}
</pre>
</p>
|
configure
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final void continueToOriginalDestination()
{
RestartResponseAtInterceptPageException.continueToOriginalDestination();
}
|
Redirects to any intercept page previously specified by a call to {@link #redirectToInterceptPage(Page)}.
The redirect is done by throwing an exception. If there is no intercept page no exception
will be thrown and the program flow will continue uninterrupted.
Example:
<pre>
add(new Link("login")
{
protected void onClick()
{
if (authenticate())
{
continueToOriginalDestination();
// if we reach this line there was no intercept page, so go to home page
setResponsePage(WelcomePage.class);
}
}
});
@see Component#redirectToInterceptPage(Page)
|
continueToOriginalDestination
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final void clearOriginalDestination()
{
RestartResponseAtInterceptPageException.clearOriginalDestination();
}
|
Clears any data about previously intercepted page.
|
clearOriginalDestination
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final void debug(final Serializable message)
{
getFeedbackMessages().debug(this, message);
addStateChange();
}
|
Registers a debug feedback message for this component
@param message
The feedback message
|
debug
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
final void internalOnRemove()
{
setFlag(FLAG_REMOVING_FROM_HIERARCHY, true);
onRemove();
setFlag(FLAG_REMOVED, true);
if (getFlag(FLAG_REMOVING_FROM_HIERARCHY))
{
throw new IllegalStateException(Component.class.getName() +
" has not been properly removed from hierachy. Something in the hierarchy of " +
getClass().getName() +
" has not called super.onRemove() in the override of onRemove() method");
}
new Behaviors(this).onRemove(this);
removeChildren();
}
|
Signals this Component that it is removed from the Component hierarchy.
|
internalOnRemove
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
private void internalDetach()
{
markup = null;
}
|
Removes the cached markup at the end of the request. For the next request it will be get
either from the parent's markup or from {@link MarkupCache}.
|
internalDetach
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final void error(final Serializable message)
{
getFeedbackMessages().error(this, message);
addStateChange();
}
|
Registers an error feedback message for this component
@param message
The feedback message
|
error
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final void fatal(final Serializable message)
{
getFeedbackMessages().fatal(this, message);
addStateChange();
}
|
Registers a fatal feedback message for this component
@param message
The feedback message
|
fatal
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final <Z> Z findParent(final Class<Z> c)
{
// Start with immediate parent
MarkupContainer current = parent;
// Walk up containment hierarchy
while (current != null)
{
// Is current an instance of this class?
if (c.isInstance(current))
{
return c.cast(current);
}
// Check parent
current = current.getParent();
}
// Failed to find component
return null;
}
|
Finds the first container parent of this component of the given class.
@param <Z>
type of parent
@param c
MarkupContainer class to search for
@return First container parent that is an instance of the given class, or null if none can be
found
|
findParent
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final MarkupContainer findParentWithAssociatedMarkup()
{
MarkupContainer container = parent;
while (container != null)
{
if (container.getAssociatedMarkup() != null)
{
return container;
}
container = container.getParent();
}
// This should never happen since Page always has associated markup
throw new WicketRuntimeException("Unable to find parent with associated markup");
}
|
@return The nearest markup container with associated markup
|
findParentWithAssociatedMarkup
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final Application getApplication()
{
return Application.get();
}
|
Gets interface to application that this component is a part of.
@return The application associated with the session that this component is in.
@see Application
|
getApplication
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final String getClassRelativePath()
{
return getClass().getName() + PATH_SEPARATOR + getPageRelativePath();
}
|
@return A path of the form [page-class-name]:[page-relative-path]
@see Component#getPageRelativePath()
|
getClassRelativePath
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
@SuppressWarnings("unchecked")
@Override
public <C> IConverter<C> getConverter(Class<C> type) {
IConverter<?> converter = createConverter(type);
if (converter != null) {
return (IConverter<C>) converter;
}
return getApplication().getConverterLocator().getConverter(type);
}
|
Get the converter that should be used by this component, delegates to
{@link #createConverter(Class)} and then to the application's
{@link IConverterLocator}.
@param type
The type to convert to
@return The converter that should be used by this component
|
getConverter
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
protected IConverter<?> createConverter(Class<?> type) {
return null;
}
|
Factory method for converters to be used by this component,
returns {@code null} by default.
@param type
The type to convert to
@return a converter to be used by this component
|
createConverter
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final boolean getEscapeModelStrings()
{
return getFlag(FLAG_ESCAPE_MODEL_STRINGS);
}
|
Gets whether model strings should be escaped.
@return Returns whether model strings should be escaped
|
getEscapeModelStrings
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
@Override
public String getId()
{
return id;
}
|
Gets the id of this component.
@return The id of this component
|
getId
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final IModel<?> getInnermostModel()
{
return getInnermostModel(getDefaultModel());
}
|
@return Innermost model for this component
|
getInnermostModel
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public Locale getLocale()
{
if (parent != null)
{
return parent.getLocale();
}
return getSession().getLocale();
}
|
Gets the locale for this component. By default, it searches its parents for a locale. If no
parents (it's a recursive search) returns a locale, it gets one from the session.
@return The locale to be used for this component
@see Session#getLocale()
|
getLocale
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final Localizer getLocalizer()
{
return getApplication().getResourceSettings().getLocalizer();
}
|
Convenience method to provide easy access to the localizer object within any component.
@return The localizer object
|
getLocalizer
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
private ComponentTag getMarkupTag()
{
IMarkupFragment markup = getMarkup();
if (markup != null)
{
for (int i = 0; i < markup.size(); i++)
{
MarkupElement elem = markup.get(i);
if (elem instanceof ComponentTag)
{
return (ComponentTag)elem;
}
}
}
return null;
}
|
Get the first component tag in the associated markup
@return first component tag
|
getMarkupTag
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final ValueMap getMarkupAttributes()
{
ComponentTag tag = getMarkupTag();
if (tag != null)
{
ValueMap attrs = new ValueMap(tag.getAttributes());
attrs.makeImmutable();
return attrs;
}
return ValueMap.EMPTY_MAP;
}
|
THIS IS WICKET INTERNAL ONLY. DO NOT USE IT.
Get a copy of the markup's attributes which are associated with the component.
<p>
Modifications to the map returned don't change the tags attributes. It is just a copy.
<p>
Note: The component must have been added (directly or indirectly) to a container with an
associated markup file (Page, Panel or Border).
@return markup attributes
|
getMarkupAttributes
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public String getMarkupId(boolean createIfDoesNotExist)
{
IMarkupIdGenerator markupIdGenerator = getApplication().getMarkupSettings().getMarkupIdGenerator();
String markupId = markupIdGenerator.generateMarkupId(this, createIfDoesNotExist);
return markupId;
}
|
Retrieves id by which this component is represented within the markup. This is either the id
attribute set explicitly via a call to {@link #setMarkupId(String)}, id attribute defined in
the markup, or an automatically generated id - in that order.
<p>
If no id is set and <code>createIfDoesNotExist</code> is false, this method will return null.
Otherwise it will generate an id value which by default will be unique in the page. This is
the preferred way as there is no chance of id collision. This will also enable
{@link #setOutputMarkupId(boolean)}.
<p>
<p>
Note: This method should only be called after the component or its parent have been added to
the page.
@param createIfDoesNotExist
When there is no existing markup id, determines whether it should be generated or
whether <code>null</code> should be returned.
@return markup id of the component
|
getMarkupId
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public String getMarkupId()
{
return getMarkupId(true);
}
|
Retrieves id by which this component is represented within the markup. This is either the id
attribute set explicitly via a call to {@link #setMarkupId(String)}, id attribute defined in
the markup, or an automatically generated id - in that order.
<p>
If no explicit id is set this function will generate an id value that will be unique in the
page. This is the preferred way as there is no chance of id collision. This will also enable
{@link #setOutputMarkupId(boolean)}.
<p>
Note: This method should only be called after the component or its parent have been added to
the page.
@return markup id of the component
|
getMarkupId
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final <M extends Serializable> M getMetaData(final MetaDataKey<M> key)
{
return key.get(getMetaData());
}
|
Gets metadata for this component using the given key.
@param <M>
The type of the metadata.
@param key
The key for the data
@return The metadata or null of no metadata was found for the given key
@see MetaDataKey
|
getMetaData
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
private MetaDataEntry<?>[] getMetaData()
{
MetaDataEntry<?>[] metaData = null;
// index where we should expect the entry
int index = getFlag(FLAG_MODEL_SET) ? 1 : 0;
int length = data_length();
if (index < length)
{
Object object = data_get(index);
if (object instanceof MetaDataEntry<?>[])
{
metaData = (MetaDataEntry<?>[])object;
}
else if (object instanceof MetaDataEntry)
{
metaData = new MetaDataEntry[] { (MetaDataEntry<?>)object };
}
}
return metaData;
}
|
Gets the meta data entries for this component as an array of {@link MetaDataEntry} objects.
@return the meta data entries for this component
|
getMetaData
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final IModel<?> getDefaultModel()
{
IModel<?> model = getModelImpl();
// If model is null
if (model == null)
{
// give subclass a chance to lazy-init model
model = initModel();
setModelImpl(model);
}
return model;
}
|
Gets the model. It returns the object that wraps the backing model.
@return The model
|
getDefaultModel
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final Object getDefaultModelObject()
{
final IModel<?> model = getDefaultModel();
if (model != null)
{
try
{
// Get model value for this component.
return model.getObject();
}
catch (Exception ex)
{
// wrap the exception so that it brings info about the component
WicketRuntimeException rex = new WicketRuntimeException(
"An error occurred while getting the model object for Component: " +
this.toString(true), ex);
throw rex;
}
}
return null;
}
|
Gets the backing model object. Unlike getDefaultModel().getObject(), this method returns null
for a null model.
@return The backing model object
|
getDefaultModelObject
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final String getDefaultModelObjectAsString()
{
return getDefaultModelObjectAsString(getDefaultModelObject());
}
|
Gets a model object as a string. Depending on the "escape model strings" flag of the
component, the string is either HTML escaped or not. "HTML escaped" meaning that only HTML
sensitive chars are escaped but not all none-ascii chars. Proper HTML encoding should be used
instead. In case you really need a fully escaped model string you may call
{@link Strings#escapeMarkup(CharSequence, boolean, boolean)} on the model string returned.
@see Strings#escapeMarkup(CharSequence, boolean, boolean)
@see #getEscapeModelStrings()
@return Model object for this component as a string
|
getDefaultModelObjectAsString
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
@SuppressWarnings({ "rawtypes", "unchecked" })
public final String getDefaultModelObjectAsString(final Object modelObject)
{
if (modelObject != null)
{
// Get converter
final Class<?> objectClass = modelObject.getClass();
final IConverter converter = getConverter(objectClass);
// Model string from property
final String modelString = converter.convertToString(modelObject, getLocale());
if (modelString != null)
{
// If we should escape the markup
if (getFlag(FLAG_ESCAPE_MODEL_STRINGS))
{
// Escape HTML sensitive characters only. Not all none-ascii chars
return Strings.escapeMarkup(modelString, false, false).toString();
}
return modelString;
}
}
return "";
}
|
Gets a model object as a string. Depending on the "escape model strings" flag of the
component, the string is either HTML escaped or not. "HTML escaped" meaning that only HTML
sensitive chars are escaped but not all none-ascii chars. Proper HTML encoding should be used
instead. In case you really need a fully escaped model string you may call
{@link Strings#escapeMarkup(CharSequence, boolean, boolean)} on the model string returned.
@see Strings#escapeMarkup(CharSequence, boolean, boolean)
@see #getEscapeModelStrings()
@param modelObject
Model object to convert to string
@return The string
|
getDefaultModelObjectAsString
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final boolean getOutputMarkupId()
{
return getFlag(FLAG_OUTPUT_MARKUP_ID);
}
|
Gets whether or not component will output id attribute into the markup. id attribute will be
set to the value returned from {@link Component#getMarkupId()}.
@return whether or not component will output id attribute into the markup
|
getOutputMarkupId
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final boolean getOutputMarkupPlaceholderTag()
{
return getFlag(FLAG_PLACEHOLDER);
}
|
Gets whether or not an invisible component will render a placeholder tag.
@return true if a placeholder tag should be rendered
|
getOutputMarkupPlaceholderTag
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
@Override
public final Page getPage()
{
// Search for nearest Page
final Page page = findPage();
// If no Page was found
if (page == null)
{
// Give up with a nice exception
throw new WicketRuntimeException("No Page found for component " + this);
}
return page;
}
|
Gets the page holding this component.
@return The page holding this component
@throws WicketRuntimeException
Thrown if component is not yet attached to a Page.
@see #findPage()
|
getPage
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
@Override
public final String getPageRelativePath()
{
return Strings.afterFirstPathComponent(getPath(), PATH_SEPARATOR);
}
|
Gets the path to this component relative to its containing page, i.e. without leading page
id.
@return The path to this component relative to the page it is in
|
getPageRelativePath
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
@Override
public final MarkupContainer getParent()
{
return parent;
}
|
Gets any parent container, or null if there is none.
@return Any parent container, or null if there is none
|
getParent
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final String getPath()
{
final PrependingStringBuffer buffer = new PrependingStringBuffer(32);
for (Component c = this; c != null; c = c.getParent())
{
if (buffer.length() > 0)
{
buffer.prepend(PATH_SEPARATOR);
}
buffer.prepend(c.getId());
}
return buffer.toString();
}
|
Gets this component's path.
@return Colon separated path to this component in the component hierarchy
|
getPath
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final boolean getRenderBodyOnly()
{
return getFlag(FLAG_RENDER_BODY_ONLY);
}
|
If false the component's tag will be printed as well as its body (which is default). If true
only the body will be printed, but not the component's tag.
@return If true, the component tag will not be printed
|
getRenderBodyOnly
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final Request getRequest()
{
RequestCycle requestCycle = getRequestCycle();
if (requestCycle == null)
{
// Happens often with WicketTester when one forgets to call
// createRequestCycle()
throw new WicketRuntimeException("No RequestCycle is currently set!");
}
return requestCycle.getRequest();
}
|
@return The request for this component's active request cycle
|
getRequest
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final RequestCycle getRequestCycle()
{
return RequestCycle.get();
}
|
Gets the active request cycle for this component
@return The request cycle
|
getRequestCycle
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final Response getResponse()
{
return getRequestCycle().getResponse();
}
|
@return The response for this component's active request cycle
|
getResponse
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public Session getSession()
{
return Session.get();
}
|
Gets the current Session object.
@return The Session that this component is in
|
getSession
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public long getSizeInBytes()
{
final MarkupContainer originalParent = parent;
parent = null;
long size = 0;
try
{
size = WicketObjects.sizeof(this);
}
catch (Exception e)
{
log.error("Exception getting size for component " + this, e);
}
parent = originalParent;
return size;
}
|
@return Size of this Component in bytes. Returns {@code 0} - if the size cannot be calculated for some reason
|
getSizeInBytes
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final String getString(final String key)
{
return getString(key, null);
}
|
@param key
Key of string resource in property file
@return The String
@see Localizer
|
getString
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final String getString(final String key, final IModel<?> model)
{
return getLocalizer().getString(key, this, model);
}
|
@param key
The resource key
@param model
The model
@return The formatted string
@see Localizer
|
getString
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final String getString(final String key, final IModel<?> model, final String defaultValue)
{
return getLocalizer().getString(key, this, model, defaultValue);
}
|
@param key
The resource key
@param model
The model
@param defaultValue
A default value if the string cannot be found
@return The formatted string
@see Localizer
|
getString
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public String getVariation()
{
if (parent != null)
{
return parent.getVariation();
}
return null;
}
|
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.
|
getVariation
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final boolean hasBeenRendered()
{
return getFlag(FLAG_HAS_BEEN_RENDERED);
}
|
Gets whether this component was rendered at least once.
@return true if the component has been rendered before, false if it is merely constructed
|
hasBeenRendered
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public FeedbackMessages getFeedbackMessages()
{
FeedbackMessages messages = getMetaData(FEEDBACK_KEY);
if (messages == null)
{
messages = new FeedbackMessages();
setMetaData(FEEDBACK_KEY, messages);
}
return messages;
}
|
Gets feedback messages for this component. This method will instantiate a
{@link FeedbackMessages} instance and add it to the component metadata, even when called on a
component that has no feedback messages, to avoid the overhead use
{@link #hasFeedbackMessage()}
@return feedback messages instance
|
getFeedbackMessages
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final boolean hasErrorMessage()
{
FeedbackMessages messages = getMetaData(FEEDBACK_KEY);
if (messages == null)
{
return false;
}
return messages.hasMessage(FeedbackMessage.ERROR);
}
|
@return True if this component has an error message
|
hasErrorMessage
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final boolean hasFeedbackMessage()
{
FeedbackMessages messages = getMetaData(FEEDBACK_KEY);
if (messages == null)
{
return false;
}
return messages.size() > 0;
}
|
@return True if this component has some kind of feedback message
|
hasFeedbackMessage
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final void info(final Serializable message)
{
getFeedbackMessages().info(this, message);
addStateChange();
}
|
Registers an informational feedback message for this component
@param message
The feedback message
|
info
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final void success(final Serializable message)
{
getFeedbackMessages().success(this, message);
addStateChange();
}
|
Registers an success feedback message for this component
@param message
The feedback message
|
success
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final boolean isActionAuthorized(Action action)
{
IAuthorizationStrategy authorizationStrategy = getSession().getAuthorizationStrategy();
if (authorizationStrategy != null)
{
return authorizationStrategy.isActionAuthorized(this, action);
}
return true;
}
|
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
|
isActionAuthorized
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final boolean isEnableAllowed()
{
return isActionAuthorized(ENABLE);
}
|
@return true if this component is authorized to be enabled, false otherwise
|
isEnableAllowed
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public boolean isEnabled()
{
return getFlag(FLAG_ENABLED);
}
|
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.
|
isEnabled
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final boolean isRenderAllowed()
{
return getFlag(FLAG_IS_RENDER_ALLOWED);
}
|
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
|
isRenderAllowed
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final boolean isStateless()
{
if (
// the component is either invisible or disabled
(isVisibleInHierarchy() && isEnabledInHierarchy()) == false &&
// and it can't call listener interfaces
canCallListenerInterface(null) == false)
{
// then pretend the component is stateless
return true;
}
if (!getStatelessHint())
{
return false;
}
for (Behavior behavior : getBehaviors())
{
if (!behavior.getStatelessHint(this))
{
return false;
}
}
return true;
}
|
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.
|
isStateless
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
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;
}
}
|
@return {@code true} if this component should notify its holding page about changes in its
state. If a {@link Page} is not versioned then it wont track changes in its
components and will use the same {@link Page#getPageId()} during its lifetime
|
isVersioned
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public boolean isVisible()
{
return getFlag(FLAG_VISIBLE);
}
|
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
|
isVisible
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final boolean isVisibleInHierarchy()
{
Component parent = getParent();
if (parent != null && !parent.isVisibleInHierarchy())
{
return false;
}
else
{
return determineVisibility();
}
}
|
Checks if the component itself and all its parents are visible.
@return true if the component and all its parents are visible.
|
isVisibleInHierarchy
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final void markRendering(boolean setRenderingFlag)
{
internalMarkRendering(setRenderingFlag);
}
|
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT!
Sets the RENDERING flag and removes the PREPARED_FOR_RENDER flag on component and it's
children.
@param setRenderingFlag
if this is false only the PREPARED_FOR_RENDER flag is removed from component, the
RENDERING flag is not set.
@see #internalPrepareForRender(boolean)
|
markRendering
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final void modelChanged()
{
// Call user code
internalOnModelChanged();
onModelChanged();
}
|
Called to indicate that the model content for this component has been changed
|
modelChanged
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
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);
}
}
|
Called to indicate that the model content for this component is about to change
|
modelChanging
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public void internalPrepareForRender(boolean setRenderingFlag)
{
beforeRender();
if (setRenderingFlag)
{
// only process feedback panel when we are about to be rendered.
// setRenderingFlag is false in case prepareForRender is called only to build component
// hierarchy (i.e. in BookmarkableListenerInterfaceRequestHandler).
// prepareForRender(true) is always called before the actual rendering is done so
// that's where feedback panels gather the messages
List<Component> feedbacks = getRequestCycle().getMetaData(FEEDBACK_LIST);
if (feedbacks != null)
{
// iterate over a copy because a IFeedback may add more IFeedback children
// (WICKET-4687)
Component[] feedbacksCopy = feedbacks.toArray(new Component[feedbacks.size()]);
for (Component feedback : feedbacksCopy)
{
// render it only if it is still in the page hierarchy (WICKET-4895)
if (feedback.findPage() != null)
{
feedback.internalBeforeRender();
}
}
}
getRequestCycle().setMetaData(FEEDBACK_LIST, null);
}
markRendering(setRenderingFlag);
}
|
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT!
<p>
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 the updated component.
@param setRenderingFlag
Whether to set the rendering flag. This must be true if the page is about to be
rendered. However, there are usecases to call this method without an immediate
render (e.g. on stateless listener request target to build the component
hierarchy), in that case setRenderingFlag should be false.
|
internalPrepareForRender
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final void prepareForRender()
{
internalPrepareForRender(true);
}
|
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT!
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.
|
prepareForRender
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final void redirectToInterceptPage(final Page page)
{
throw new RestartResponseAtInterceptPageException(page);
}
|
Redirects browser to an intermediate page such as a sign-in page. The current request's URL
is saved for future use by method {@link #continueToOriginalDestination()}; only use this method when
you plan to continue to the current URL at some later time; otherwise just set a new response page.
@param page
The sign in page
@see #setResponsePage(Class)
@see #setResponsePage(IRequestablePage)
@see #setResponsePage(Class, PageParameters)
@see Component#continueToOriginalDestination()
|
redirectToInterceptPage
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
private void internalRender()
{
// Make sure there is a markup available for the Component
IMarkupFragment markup = getMarkup();
if (markup == null)
{
throw new MarkupNotFoundException("Markup not found for Component: " + toString());
}
// MarkupStream is an Iterator for the markup
MarkupStream markupStream = new MarkupStream(markup);
// Flag: we started the render process
markRendering(true);
MarkupElement elem = markup.get(0);
if (elem instanceof ComponentTag)
{
// Guarantee that the markupStream is set and determineVisibility not yet tested
// See WICKET-2049
((ComponentTag)elem).onBeforeRender(this, markupStream);
}
// Determine if component is visible using it's authorization status
// and the isVisible property.
if (determineVisibility())
{
setFlag(FLAG_HAS_BEEN_RENDERED, true);
// Rendering is beginning
if (log.isDebugEnabled())
{
log.debug("Begin render {}", this);
}
try
{
notifyBehaviorsComponentBeforeRender();
onRender();
notifyBehaviorsComponentRendered();
// Component has been rendered
rendered();
}
catch (RuntimeException ex)
{
onException(ex);
}
if (log.isDebugEnabled())
{
log.debug("End render {}", this);
}
}
// elem is null when rendering a page
else if ((elem != null) && (elem instanceof ComponentTag))
{
if (getFlag(FLAG_PLACEHOLDER))
{
renderPlaceholderTag((ComponentTag)elem, getResponse());
}
}
}
|
Performs a render of this component as part of a Page level render process.
|
internalRender
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
private void onException(final RuntimeException ex)
{
// Call each behaviors onException() to allow the
// behavior to clean up
for (Behavior behavior : getBehaviors())
{
if (isBehaviorAccepted(behavior))
{
try
{
behavior.onException(this, ex);
}
catch (Exception ex2)
{
log.error("Error while cleaning up after exception", ex2);
}
}
}
// Re-throw the exception
throw ex;
}
|
Called when a runtime exception is caught during the render process
@param ex
The exception caught.
|
onException
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
protected void renderPlaceholderTag(final ComponentTag tag, final Response response)
{
String ns = Strings.isEmpty(tag.getNamespace()) ? null : tag.getNamespace() + ':';
response.write("<");
if (ns != null)
{
response.write(ns);
}
response.write(tag.getName());
response.write(" id=\"");
response.write(getAjaxRegionMarkupId());
response.write("\" style=\"display:none\"></");
if (ns != null)
{
response.write(ns);
}
response.write(tag.getName());
response.write(">");
}
|
Renders a placeholder tag for the component when it is invisible and
{@link #setOutputMarkupPlaceholderTag(boolean)} has been called with <code>true</code>.
@param tag
component tag
@param response
response
|
renderPlaceholderTag
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final String getAjaxRegionMarkupId()
{
String markupId = null;
for (Behavior behavior : getBehaviors())
{
if (behavior instanceof IAjaxRegionMarkupIdProvider && behavior.isEnabled(this))
{
markupId = ((IAjaxRegionMarkupIdProvider)behavior).getAjaxRegionMarkupId(this);
break;
}
}
if (markupId == null)
{
if (this instanceof IAjaxRegionMarkupIdProvider)
{
markupId = ((IAjaxRegionMarkupIdProvider)this).getAjaxRegionMarkupId(this);
}
}
if (markupId == null)
{
markupId = getMarkupId();
}
return markupId;
}
|
Returns the id of the markup region that will be updated via ajax. This can be different to
the markup id of the component if a {@link IAjaxRegionMarkupIdProvider} behavior has been
added.
@return the markup id of the region to be updated via ajax.
|
getAjaxRegionMarkupId
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
private boolean needToRenderTag(final ComponentTag openTag)
{
// If a open-close tag has been modified to be open-body-close then a
// synthetic close tag must be rendered.
boolean renderTag = (openTag != null && !(openTag instanceof WicketTag));
if (renderTag == false)
{
renderTag = !getApplication().getMarkupSettings().getStripWicketTags();
}
return renderTag;
}
|
@param openTag
@return true, if the tag shall be rendered
|
needToRenderTag
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final void rendered()
{
Page page = findPage();
if (page != null)
{
// Tell the page that the component rendered
page.componentRendered(this);
}
else
{
log.error("Component is not connected to a Page. Cannot register the component as being rendered. Component: " +
toString());
}
}
|
Called to indicate that a component has been rendered. This method should only very rarely be
called at all. Some components may render its children without calling render() on them.
These components need to call rendered() to indicate that its child components were actually
rendered, the framework would think they had never been rendered, and in development mode
this would result in a runtime exception.
|
rendered
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
protected final IMarkupSourcingStrategy getMarkupSourcingStrategy()
{
if (markupSourcingStrategy == null)
{
markupSourcingStrategy = newMarkupSourcingStrategy();
// If not strategy by provided, than we use a default one.
if (markupSourcingStrategy == null)
{
markupSourcingStrategy = DefaultMarkupSourcingStrategy.get();
}
}
return markupSourcingStrategy;
}
|
Get the markup sourcing strategy for the component. If null,
{@link #newMarkupSourcingStrategy()} will be called.
@return Markup sourcing strategy
|
getMarkupSourcingStrategy
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
protected IMarkupSourcingStrategy newMarkupSourcingStrategy()
{
return null;
}
|
If {@link #getMarkupSourcingStrategy()} returns null, this method will be called. By default
it returns null, which means that a default markup strategy will be attached to the
component.
<p>
Please note that markup source strategies are not persisted. Instead they get re-created by
calling this method again. That's ok since markup sourcing strategies usually do not maintain
a state.
@return Markup sourcing strategy
|
newMarkupSourcingStrategy
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public Component replaceWith(Component replacement)
{
Args.notNull(replacement, "replacement");
if (!getId().equals(replacement.getId()))
{
throw new IllegalArgumentException(
"Replacement component must have the same id as the component it will replace. Replacement id [[" +
replacement.getId() + "]], replaced id [[" + getId() + "]].");
}
if (parent == null)
{
throw new IllegalStateException(
"This method can only be called on a component that has already been added to its parent.");
}
parent.replace(replacement);
return replacement;
}
|
Replaces this component with another. The replacing component must have the same component id
as this component. This method serves as a shortcut to
<code>this.getParent().replace(replacement)</code>
and provides a better context for errors.
<p>
Usage: <code>component = component.replaceWith(replacement);</code>
</p>
@since 1.2.1
@param replacement
component to replace this one
@return the component which replaced this one
|
replaceWith
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final boolean sameInnermostModel(final Component component)
{
return sameInnermostModel(component.getDefaultModel());
}
|
@param component
The component to compare with
@return True if the given component's model is the same as this component's model.
|
sameInnermostModel
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final boolean sameInnermostModel(final IModel<?> model)
{
// Get the two models
IModel<?> thisModel = getDefaultModel();
// If both models are non-null they could be the same
if (thisModel != null && model != null)
{
return getInnermostModel(thisModel) == getInnermostModel(model);
}
return false;
}
|
@param model
The model to compare with
@return True if the given component's model is the same as this component's model.
|
sameInnermostModel
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final Component setEscapeModelStrings(final boolean escapeMarkup)
{
setFlag(FLAG_ESCAPE_MODEL_STRINGS, escapeMarkup);
return this;
}
|
Sets whether model strings should be escaped.
@param escapeMarkup
True is model strings should be escaped
@return This
|
setEscapeModelStrings
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final void setMarkupIdImpl(Object markupId)
{
if (markupId != null && !(markupId instanceof String) && !(markupId instanceof Integer))
{
throw new IllegalArgumentException("markupId must be String or Integer");
}
setOutputMarkupId(true);
if (markupId instanceof Integer)
{
generatedMarkupId = (Integer)markupId;
setMetaData(MARKUP_ID_KEY, null);
return;
}
generatedMarkupId = -1;
setMetaData(MARKUP_ID_KEY, (String)markupId);
}
|
Set markup ID, which must be String or Integer
@param markupId
|
setMarkupIdImpl
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public Component setMarkupId(String markupId)
{
Args.notEmpty(markupId, "markupId");
// TODO check if an automatic id has already been generated or getmarkupid() called
// previously and throw an illegalstateexception because something else might be depending
// on previous id
setMarkupIdImpl(markupId);
return this;
}
|
Sets this component's markup id to a user defined value. It is up to the user to ensure this
value is unique.
<p>
The recommended way is to let wicket generate the value automatically, this method is here to
serve as an override for that value in cases where a specific id must be used.
<p>
If null is passed in the user defined value is cleared and markup id value will fall back on
automatically generated value
@see #getMarkupId()
@param markupId
markup id value or null to clear any previous user defined value
@return this for chaining
|
setMarkupId
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public final <M extends Serializable> Component setMetaData(final MetaDataKey<M> key, final M object)
{
MetaDataEntry<?>[] old = getMetaData();
Object metaData = null;
MetaDataEntry<?>[] metaDataArray = key.set(getMetaData(), object);
if (metaDataArray != null && metaDataArray.length > 0)
{
metaData = (metaDataArray.length > 1) ? metaDataArray : metaDataArray[0];
}
int index = getFlag(FLAG_MODEL_SET) ? 1 : 0;
if (old == null && metaData != null)
{
data_insert(index, metaData);
}
else if (old != null && metaData != null)
{
data_set(index, metaData);
}
else if (old != null && metaData == null)
{
data_remove(index);
}
return this;
}
|
Sets the metadata for this component using the given key. If the metadata object is not of
the correct type for the metadata key, an IllegalArgumentException will be thrown. For
information on creating MetaDataKeys, see {@link MetaDataKey}.
@param <M>
The type of the metadata
@param key
The singleton key for the metadata
@param object
The metadata object
@throws IllegalArgumentException
@see MetaDataKey
|
setMetaData
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
public Component setDefaultModel(final IModel<?> model)
{
IModel<?> prevModel = getModelImpl();
IModel<?> wrappedModel = prevModel;
if (prevModel instanceof IWrapModel)
{
wrappedModel = ((IWrapModel<?>)prevModel).getWrappedModel();
}
// Change model
if (wrappedModel != model)
{
// Detach the old/current model
if (prevModel != null)
{
prevModel.detach();
}
modelChanging();
setModelImpl(wrap(model));
modelChanged();
// WICKET-3413 reset 'inherited model' when model is explicitely set
setFlag(FLAG_INHERITABLE_MODEL, false);
}
return this;
}
|
Sets the given model.
<p>
WARNING: DO NOT OVERRIDE THIS METHOD UNLESS YOU HAVE A VERY GOOD REASON FOR IT. OVERRIDING
THIS MIGHT OPEN UP SECURITY LEAKS AND BREAK BACK-BUTTON SUPPORT.
</p>
@param model
The model
@return This
|
setDefaultModel
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/apache/wicket/Component.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/Component.java
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.