Package gov.nasa.arc.mct.components

Examples of gov.nasa.arc.mct.components.AbstractComponent


    @Override
    public void actionPerformed(ActionEvent e) {
        PersistenceProvider persistenceProvider = PlatformAccess.getPlatform().getPersistenceProvider();
        View embeddedView = housingManifestation.getContentArea().getHousedViewManifestation();
        AbstractComponent updatedComponent = persistenceProvider.getComponent(housingManifestation.getContentArea().getOwnerComponent().getComponentId());       
        housingManifestation.getContentArea().setOwnerComponentCanvasManifestation(embeddedView.getInfo().createView(updatedComponent));
        housingManifestation.setManifestedComponent(updatedComponent);
    }
View Full Code Here


*/
public class CheckComponentOwnerIsUserPolicy implements Policy {

    @Override
    public ExecutionResult execute(PolicyContext context) {
        AbstractComponent component = context.getProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), AbstractComponent.class);
        if (component == null)
            return new ExecutionResult(context, false, "Invalid component.");

        // "*" is the wildcard owner, so always allow this
        // Otherwise, check for a match on owner
        // Finally, check if there is Group ownership of this component
        User user = PlatformAccess.getPlatform().getCurrentUser();
        String owner = component.getOwner();
        if (!owner.equals("*") && !owner.equals(user.getUserId()) && !RoleAccess.hasRole(user, owner)) {
            Group group = component.getCapability(Group.class); // Check for group ownership
            String groupId = group != null ? group.getDiscipline() : null;
            if (groupId == null || !groupId.equals(PlatformAccess.getPlatform().getCurrentUser().getDisciplineId())) {
                return new ExecutionResult(context, false, "User does not own this component.");
            }
        }
View Full Code Here

public class DefaultViewForTaxonomyNode implements Policy {

  @Override
  public ExecutionResult execute(PolicyContext context) {
    boolean result = true;
    AbstractComponent targetComponent = context.getProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), AbstractComponent.class);
    if (TelemetryDataTaxonomyComponent.class.isAssignableFrom(targetComponent.getClass())) {
        ViewInfo viewInfo = context.getProperty(PolicyContext.PropertyName.TARGET_VIEW_INFO.getName(), ViewInfo.class);
        if (viewInfo.getViewType() == ViewType.OBJECT) {
            result = FeedView.class.isAssignableFrom(viewInfo.getViewClass());
        }
    }
View Full Code Here

        super(TEXT);
    }
   
    @Override
    public void actionPerformed(ActionEvent e) {
        AbstractComponent windowComponent = actionContext.getWindowManifestation().getManifestedComponent();
        windowComponent.open();
    }   
View Full Code Here

    }
   
    @Override
    public AbstractComponent createComp(ComponentRegistry comp, AbstractComponent targetComponent) {   
        String displayName = name.getText().trim();
        AbstractComponent component = comp.newInstance(componentClass, targetComponent);
        component.setDisplayName(displayName);
       
        return component;
    }
View Full Code Here

        super(TEXT);
    }
   
    @Override
    public void actionPerformed(ActionEvent e) {
        AbstractComponent windowComponent = actionContext.getWindowManifestation().getManifestedComponent();
        windowComponent.open();   
    }
View Full Code Here

     *
     * @param dialogMessage the message to display to the user
     * @return false if change was aborted
     */
    public boolean commitOrAbortPendingChanges(String dialogMessage) {
        AbstractComponent committedComponent =
                PlatformAccess.getPlatform().getPersistenceProvider().getComponent(
                        view.getManifestedComponent().getComponentId());
        if (committedComponent == null)
            return true;
       
View Full Code Here

    }

    @Override
    public boolean canHandle(ActionContext context) {
        actionContext = (ActionContextImpl) context;
        AbstractComponent targetComponent = actionContext.getTargetComponent();
        ExternalComponentRegistryImpl extCompRegistry = ExternalComponentRegistryImpl.getInstance();
        Collection<ExtendedComponentTypeInfo> componentInfos = extCompRegistry.getComponentInfos();

        List<Action> subActions = new ArrayList<Action>(componentInfos.size());
        for (ExtendedComponentTypeInfo info : componentInfos) {
            if (info.isCreatable()) {
                PolicyContext policyContext = new PolicyContext();
                policyContext.setProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), targetComponent);
                policyContext.setProperty(PolicyContext.PropertyName.ACTION.getName(), 'w');
                String compositionKey = PolicyInfo.CategoryType.COMPOSITION_POLICY_CATEGORY.getKey();
                AbstractComponent tempComponent =  extCompRegistry.newInstance(info);
                policyContext.setProperty(PolicyContext.PropertyName.SOURCE_COMPONENTS.getName(), Collections.singleton(tempComponent));
                if (PolicyManagerImpl.getInstance().execute(compositionKey, policyContext).getStatus()) {
                    subActions.add(new NewTypeAction(info, targetComponent));
                }
            }
View Full Code Here

            if (!dialog.getConfirm()){
                return;
            }
                
            String newComponentId = null;
            AbstractComponent c = this.wizardUI.createComp(ExternalComponentRegistryImpl.getInstance(), targetComponent);    
            completeWorkUnit();
            if (c != null){
                newComponentId = c.getComponentId();
            }
           
            View directoryAreaView = actionContext.getTargetHousing().getDirectoryArea();
            // Select new component (only if it is not null), selection is currently tied to the directory area
            // this implementation should be changed to make the selection support generic (added to the SelectionManager API)
View Full Code Here

    public void actionPerformed(ActionEvent e) {
        Map<String, AbstractComponent> toDelete = new HashMap<String, AbstractComponent>();
        Map<String, AbstractComponent> toRemove = new HashMap<String, AbstractComponent>();
        for (TreePath path : selectedTreePaths) {
            MCTMutableTreeNode selectedNode = (MCTMutableTreeNode) path.getLastPathComponent();           
            AbstractComponent selectedComponent = ((View) selectedNode.getUserObject()).getManifestedComponent();
            categorizeDescendants(selectedComponent, toDelete, toRemove);
        }
        Set<AbstractComponent> cannotRemove = findNonRemovableComponents(toDelete, toRemove);
        handleWarnings(toDelete.values(), toRemove.values(), cannotRemove);
    }
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.components.AbstractComponent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.