Package gov.nasa.arc.mct.components

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


    return true;
  }

  @Override
  public boolean isEnabled() {
    AbstractComponent targetComponent = actionContext.getTargetComponent();
    return (targetComponent == null) ? false : "My Model A".equals(targetComponent.getDisplayName())
  }
View Full Code Here


  }

  @Override
  public boolean canHandle(ActionContext context) {
      ActionContextImpl actionContext = (ActionContextImpl) context;
        AbstractComponent component = actionContext.getTargetComponent();
       
        if (component == null)
          return false;

        if ("My Model B".equals(component.getDisplayName())) {
          List<MySpecificAction> actions = new ArrayList<MySpecificAction>();
          actions.add(new MySpecificAction(actionContext, CHOOSE_THIS));
          actions.add(new MySpecificAction(actionContext, CHOOSE_THAT));
          setActions(actions.toArray(new RadioAction[actions.size()]));
 
View Full Code Here

    updateFromFeed(data);
  }

  @Override
  public void updateFromFeed(Map<String, List<Map<String, String>>> data) {   
    AbstractComponent component = getManifestedComponent();
    FeedProvider provider = getFeedProvider(component);
     
    if (provider != null) {
      List<Map<String, String>> feedData = data.get(provider.getSubscriptionId());
      if (feedData != null && !feedData.isEmpty()) {
        Map<String, String> feedDataItem = feedData.get(feedData.size() - 1);

        List<RenderingInfo> riList = new ArrayList<RenderingInfo>();
        riList.add(provider.getRenderingInfo(feedDataItem));
       
        /* Get updates from the appropriate evaluator */
        if (settings.getSetting(GraphicalSettings.GRAPHICAL_EVALUATOR) instanceof AbstractComponent) {
          AbstractComponent comp = (AbstractComponent) settings.getSetting(GraphicalSettings.GRAPHICAL_EVALUATOR);
          riList.add(comp.getCapability(Evaluator.class).evaluate(data, Collections.singletonList(provider)));
        }
       
        /* Send both numeric state and evaluator state to brushes */
        if (riList.get(0).isPlottable()) { // ...only if we have new feed data
          for (RenderingInfo ri : riList) {
View Full Code Here

      }
     
      // Remove the old component, if there is one
      if (!isInsertRow) {
        TableCell cell = rowList.get(rowIndex).get(columnIndex);
        AbstractComponent toBeRemoved = cell.getValue();
        rootComponent.removeDelegateComponent(toBeRemoved);
      }
      rootComponent.addDelegateComponents(componentIndex, Collections.<AbstractComponent> singletonList(value));
     
    } else {
     
      if (isInsertRow) {
        // Should insert new child. Create a collection of the same type as
        // the root object.
        int componentIndex;
        if (rowIndex < rowList.size()) {
          componentIndex = rowList.get(rowIndex).getIndex();
        } else {
          componentIndex = rootComponent.getComponents().size();
        }
        AbstractComponent newChild = ServiceAccess.getService(ComponentRegistry.class).newCollection(Collections.singleton(value));
        rootComponent.addDelegateComponents(componentIndex, Collections.singleton(newChild));
      } else { //Insert column, or overwrite cell
        TableRow row = rowList.get(rowIndex);
       
        int componentIndex;
        AbstractComponent targetComponent;
        if (!isInsertColumn && columnIndex < row.size()) {
        }
        if (columnIndex < row.size()) {
          targetComponent = row.get(columnIndex).getParent();
          componentIndex  = row.get(columnIndex).getIndex();
          if (!isInsertColumn) {
            targetComponent.removeDelegateComponent(row.get(columnIndex).getValue());
          }
        } else {
          targetComponent = row.get(row.size()-1).getParent();
          componentIndex  = targetComponent.getComponents().size();
        }
        targetComponent.addDelegateComponents(componentIndex, Collections.singleton(value));
       
      }
     
      updateColumnCount(); // in case we added a new column
    }
View Full Code Here

    c1 = new MockFeedComponent();
    c2 = new MockFeedComponent();
    c3 = new MockFeedComponent();
   
    AbstractComponent parent1 = new MockCollection(c1, c2, c3);
   
    d1 = new MockFeedComponent();
    d2 = new MockLeafComponent();
   
    AbstractComponent parent2 = new MockCollection(d1, d2);

    e1 = new MockFeedComponent();
   
    // Evaluators need > 1 child
    AbstractComponent evaluatorChild1 = new MockLeafComponent();
    AbstractComponent evaluatorChild2 = new MockLeafComponent();
    e2 = new MockEvaluator(evaluatorChild1, evaluatorChild2);

    AbstractComponent parent3 = new MockCollection(e1, e2);

    twoDimensional = new TableStructure(TableType.TWO_DIMENSIONAL, new MockCollection(parent1, parent2, parent3));
  }
View Full Code Here

    for (int i=0; i < structure.getRowCount(); ++i) {
      for (int j=0; j < structure.getColumnCount(); ++j) {
        oldValues[i][j] = structure.getValue(i, j);
      }
    }
    AbstractComponent newValue = new MockFeedComponent();
    structure.setValue(rowIndex, columnIndex, isInsertRow, isInsertColumn, newValue);
   
    if (isInsertRow || isInsertColumn) {
      assertSame(structure.getValue(rowIndex, columnIndex), newValue);
    } else {
View Full Code Here

  }

  @Test(dataProvider="badSetValueTests", expectedExceptions={ArrayIndexOutOfBoundsException.class, AssertionError.class})
  private void testBadSetValue(TableType type, Integer rowIndex, Integer columnIndex, boolean isInsertRow, boolean isInsertColumn) {
    TableStructure structure = getTableStructure(type);
    AbstractComponent newValue = new MockFeedComponent();
    structure.setValue(rowIndex, columnIndex, isInsertRow, isInsertColumn, newValue);
  }
View Full Code Here

    @Override
    public boolean canHandle(ActionContext context) {
        actionContext = (ActionContextImpl) context;
       
        AbstractComponent component = actionContext.getTargetComponent();       
        if (component == null)
            return false;

        MCTHousing targetHousing = actionContext.getTargetHousing();
        if (targetHousing == null || targetHousing.getContentArea() == null)
View Full Code Here

    }

    @Override
    public AbstractComponent createDropbox(String userId) {
        Platform platform = PlatformAccess.getPlatform();
        AbstractComponent dropbox = platform.getComponentRegistry().newInstance(TelemetryUserDropBoxComponent.class.getName());
        ComponentInitializer dropboxCapability = dropbox.getCapability(ComponentInitializer.class);
        dropboxCapability.setCreator(userId);
        dropboxCapability.setOwner("*");
        dropbox.setDisplayName(userId + resource.getString("user_drop_box"));
       
        return dropbox;
    }
View Full Code Here

   
    @Override
    public AbstractComponent createSandbox(String userId) {
        Platform platform = PlatformAccess.getPlatform();
        CoreComponentRegistry componentRegistry = platform.getComponentRegistry();
        AbstractComponent mySandbox = componentRegistry.newInstance(MineTaxonomyComponent.class.getName());
        ComponentInitializer mysandboxCapability = mySandbox.getCapability(ComponentInitializer.class);
        mysandboxCapability.setCreator(userId);
        mysandboxCapability.setOwner(userId);
        mySandbox.setDisplayName("My Sandbox");
       
        return mySandbox;
    }
View Full Code Here

TOP

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

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.