public PositionPanel( String id, final RequestFilterChain chain ) {
super( id );
this.theChain = chain;
this.setOutputMarkupId(true);
upLink = new ImageAjaxLink( "up", new ResourceReference( getClass(), "../img/icons/silk/arrow_up.png") ) {
@Override
protected void onClick(AjaxRequestTarget target) {
int index = getChains().indexOf( PositionPanel.this.theChain );
getChains().remove( index );
getChains().add(Math.max(0, index - 1), PositionPanel.this.theChain);
target.addComponent( tablePanel );
target.addComponent(this);
target.addComponent(downLink);
target.addComponent(upLink);
}
@Override
protected void onComponentTag(ComponentTag tag) {
if ( getChains().indexOf( theChain ) == 0 ) {
tag.put("style", "visibility:hidden");
} else {
tag.put("style", "visibility:visible");
}
}
};
upLink.getImage().add(new AttributeModifier("alt", true, new ParamResourceModel("SecurityFilterChainsPanel.th.up", upLink)));
upLink.setOutputMarkupId(true);
add( upLink);
downLink = new ImageAjaxLink( "down", new ResourceReference( getClass(), "../img/icons/silk/arrow_down.png") ) {
@Override
protected void onClick(AjaxRequestTarget target) {
int index = getChains().indexOf( PositionPanel.this.theChain );
getChains().remove( index );
getChains().add(Math.min(getChains().size(), index + 1), PositionPanel.this.theChain);