Java Code Examples for org.apache.wicket.Component#setVisibilityAllowed()

The following examples show how to use org.apache.wicket.Component#setVisibilityAllowed() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: onedev   File: SearchResultPanel.java    License: MIT License 5 votes vote down vote up
@SuppressWarnings("deprecation")
private void onActiveIndexChange(AjaxRequestTarget target) {
	Component hitsContainer = blobsView.get(activeBlobIndex).get(HITS_ID);
	if (!hitsContainer.isVisibilityAllowed()) {
		hitsContainer.setVisibilityAllowed(true);
		target.add(hitsContainer);
		target.add(blobsView.get(activeBlobIndex).get(EXPAND_LINK_ID));
	} 

	String activeLinkId = getMarkupId() + "-" + activeBlobIndex; 
	if (activeHitIndex != -1)
		activeLinkId += "-" + activeHitIndex;

	String script = String.format(""
			+ "$('#%s').find('.selectable').removeClass('active');"
			+ "$('#%s').addClass('active');"
			+ "$('#%s>.search-result>.body a.selectable.active').scrollIntoView(25);", 
			getMarkupId(), activeLinkId, getMarkupId());
	target.appendJavaScript(script);
	
	target.add(prevMatchLink);
	target.add(nextMatchLink);
	
	MatchedBlob activeBlob = blobs.get(activeBlobIndex);
	
	QueryHit hit;
	if (activeHitIndex != -1)
		hit = activeBlob.getHits().get(activeHitIndex);
	else 
		hit = new FileHit(activeBlob.getBlobPath(), null);
	
	BlobIdent selected = new BlobIdent(context.getBlobIdent().revision, hit.getBlobPath(), 
			FileMode.REGULAR_FILE.getBits());
	context.onSelect(target, selected, SourceRendererProvider.getPosition(hit.getTokenPos()));
}
 
Example 2
@Override
public void onConfigure(Component component)
{
    component.setVisibilityAllowed(!kbModel.getObject().isReadOnly());
    super.onConfigure(component);
}
 
Example 3
protected void trigger(Component component, boolean value)
{
	if(Component.ENABLE.equals(action)) component.setEnabled(value);
	else if(Component.RENDER.equals(action)) component.setVisibilityAllowed(value);
}
 
Example 4
@Override
public void bind(Component component) {
	super.bind(component);
	component.setVisibilityAllowed(isAuthenticated());
}