
eu.cedarsoft.utils.springrcp.beanlist.command.PropertiesCommand Maven / Gradle / Ivy
The newest version!
package com.cedarsoft.utils.springrcp.beanlist.command;
import com.cedarsoft.utils.springrcp.beanlist.BeanDialog;
import com.cedarsoft.utils.springrcp.beanlist.BeanListView;
import com.cedarsoft.utils.springrcp.beanlist.ManagedBeanDialog;
import org.jetbrains.annotations.NotNull;
import org.springframework.richclient.command.ActionCommand;
/**
*
* Date: 29.08.2006
* Time: 14:49:56
*
* @author Johannes Schneider -
* Xore Systems
*/
public class PropertiesCommand extends ActionCommand {
private final BeanListView listView;
public PropertiesCommand( @NotNull BeanListView listView ) {
super( "propertiesAction" );
this.listView = listView;
}
@Override
protected void doExecuteCommand() {
T bean = listView.getSelectedBean();
if ( bean == null ) {
throw new IllegalStateException( "Bean is null" );
}
BeanDialog dialog = createBeanDialog();
dialog.setBean( bean );
dialog.showDialog();
}
private BeanDialog createBeanDialog() {
ManagedBeanDialog dialog = new ManagedBeanDialog( listView.getBeanManager(), listView.getBeanType() ) {
@Override
protected void activateBean() {
listView.updateSelectionManager( this.getBean() );
}
};
dialog.setParentComponent( listView.getContext().getWindow().getControl() );
return dialog;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy