net.sourceforge.javydreamercsw.client.ui.nodes.ProjectNode Maven / Gradle / Ivy
package net.sourceforge.javydreamercsw.client.ui.nodes;
import com.validation.manager.core.db.Project;
import com.validation.manager.core.server.core.ProjectServer;
import java.beans.IntrospectionException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.swing.Action;
import net.sourceforge.javydreamercsw.client.ui.nodes.actions.CreateProjectAction;
import net.sourceforge.javydreamercsw.client.ui.nodes.actions.CreateRequirementSpecAction;
import net.sourceforge.javydreamercsw.client.ui.nodes.actions.CreateTestProjectAction;
import net.sourceforge.javydreamercsw.client.ui.nodes.actions.ImportRequirementMapping;
import org.openide.util.lookup.InstanceContent;
/**
*
* @author Javier A. Ortiz Bultron
*/
public class ProjectNode extends AbstractVMBeanNode {
private final SubProjectChildFactory factory;
public ProjectNode(Project project, SubProjectChildFactory factory)
throws IntrospectionException {
super(project, factory, new InstanceContent());
this.factory = factory;
setIconBaseWithExtension("com/validation/manager/resources/icons/Papermart/Folder.png");
}
@Override
public String getName() {
return getLookup().lookup(Project.class).getName();
}
@Override
public Action[] getActions(boolean b) {
List actions = new ArrayList<>();
actions.addAll(Arrays.asList(super.getActions(b)));
actions.add(new CreateProjectAction());
actions.add(new CreateRequirementSpecAction());
actions.add(new CreateTestProjectAction());
actions.add(new ImportRequirementMapping());
return actions.toArray(new Action[actions.size()]);
}
@Override
public void refreshMyself() {
ProjectServer rs = new ProjectServer(getLookup().lookup(Project.class));
rs.update((Project) getBean(), rs.getEntity());
if (factory != null) {
factory.refresh();
}
}
}