
eu.cedarsoft.utils.springrcp.beanlist.command.NewCommand 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:33
*
* @author Johannes Schneider -
* Xore Systems
*/
public class NewCommand extends ActionCommand {
private BeanListView listView;
public NewCommand( @NotNull BeanListView listView ) {
super( "newAction" );
this.listView = listView;
}
@Override
protected void doExecuteCommand() {
T bean = listView.getBeanManager().createNewBean();
BeanDialog dialog = createBeanDialog();
dialog.setBean( bean );
dialog.setIsNew( true );
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