All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.javydreamercsw.client.ui.nodes.UIRequirementSpecNodeNode Maven / Gradle / Ivy

package net.sourceforge.javydreamercsw.client.ui.nodes;

import com.validation.manager.core.db.RequirementSpecNode;
import com.validation.manager.core.server.core.RequirementSpecNodeServer;
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.CreateRequirementAction;
import net.sourceforge.javydreamercsw.client.ui.nodes.actions.ImportRequirementAction;
import org.openide.util.lookup.InstanceContent;

/**
 *
 * @author Javier A. Ortiz Bultron 
 */
public class UIRequirementSpecNodeNode extends AbstractVMBeanNode {

    public UIRequirementSpecNodeNode(RequirementSpecNode node) throws IntrospectionException {
        super(node,
                new RequirementChildFactory(node), new InstanceContent());
        setIconBaseWithExtension("com/validation/manager/resources/icons/Papermart/Contacts-alt.png");
    }

    @Override
    public String getName() {
        return getLookup().lookup(RequirementSpecNode.class).getName();
    }

    @Override
    public Action[] getActions(boolean context) {
        List actions = new ArrayList<>();
        actions.addAll(Arrays.asList(super.getActions(context)));
        actions.add(new CreateRequirementAction());
        actions.add(new ImportRequirementAction());
        return actions.toArray(new Action[actions.size()]);
    }

    @Override
    public void refreshMyself() {
        RequirementSpecNodeServer rs = 
                new RequirementSpecNodeServer(getLookup().lookup(RequirementSpecNode.class));
        rs.update((RequirementSpecNode) getBean(), rs.getEntity());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy