Package gov.nasa.arc.mct.components

Examples of gov.nasa.arc.mct.components.FeedProvider$RenderingInfo


    ArrayList<FeedProvider> feedProviders = new ArrayList<FeedProvider>();
    timeConversionMap.clear();
    for (int rowIndex = 0; rowIndex < model.getRowCount(); ++rowIndex) {
      AbstractComponent component = model.getComponentOfRow(rowIndex);
      if(component!=null) {
        FeedProvider fp = getFeedProvider(component);
        if (fp != null) {
          feedProviders.add(fp);
          TimeConversion tc = component.getCapability(TimeConversion.class);
          if (tc != null) {
            timeConversionMap.put(fp.getSubscriptionId(), tc);
          }             
        }
      }
    }
    feedProviders.trimToSize();
View Full Code Here


  public Component getTableCellRendererComponent(JTable table, Object value,
      boolean isSelected, boolean hasFocus, int row, int column) {
    JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

    assert value instanceof FeedProvider;
    FeedProvider feedProvider = (FeedProvider) value;
    label.setText(TIMEFormatter.format(feedProvider.getTimeService().getCurrentTime()));
    return label;

  }
View Full Code Here

  @Test
  public void testGetDecimalPlaces() {
    ComponentTableModel componentTableModel = Mockito.mock(ComponentTableModel.class);
    TableCellSettings settings = Mockito.mock(TableCellSettings.class);
    AbstractComponent compWithFeed = Mockito.mock(AbstractComponent.class);
    FeedProvider mockFp = Mockito.mock(FeedProvider.class);
    Mockito.when(compWithFeed.getCapability(FeedProvider.class)).thenReturn(mockFp);
    AbstractComponent compWithoutFeed = Mockito.mock(AbstractComponent.class);
    Mockito.when(componentTableModel.getStoredValueAt(Mockito.eq(0), Mockito.anyInt())).thenReturn(compWithFeed);
    Mockito.when(componentTableModel.getCellSettings(Mockito.anyString())).thenReturn(settings);
    Mockito.when(settings.getNumberOfDecimals()).thenReturn(-1);
    Mockito.when(mockFp.getFeedType()).thenReturn(FeedType.FLOATING_POINT);
    controller = new TableControlPanelController(manifestation, labeledTable, componentTableModel);
   
    Mockito.when(labeledTable.getSelectedRows()).thenReturn(new int[] {0});
    Mockito.when(labeledTable.getSelectedColumns()).thenReturn(new int[] {0});
    Assert.assertEquals(controller.getDecimalPlaces().intValue(),2);
    Mockito.when(mockFp.getFeedType()).thenReturn(FeedType.INTEGER);
    Assert.assertEquals(controller.getDecimalPlaces().intValue(),0);

    Mockito.when(componentTableModel.getStoredValueAt(Mockito.anyInt(), Mockito.anyInt())).thenReturn(compWithoutFeed);
    Mockito.when(labeledTable.getSelectedRows()).thenReturn(new int[] {1});
    Assert.assertEquals(controller.getDecimalPlaces().intValue(), -1);
View Full Code Here

  @Test
  public void testGetCellFormats() {
    ComponentTableModel componentTableModel = Mockito.mock(ComponentTableModel.class);
    TableCellSettings settings = Mockito.mock(TableCellSettings.class);
    AbstractComponent compWithFeed = Mockito.mock(AbstractComponent.class);
    FeedProvider mockFp = Mockito.mock(FeedProvider.class);
    Mockito.when(compWithFeed.getCapability(FeedProvider.class)).thenReturn(mockFp);
    AbstractComponent compWithoutFeed = Mockito.mock(AbstractComponent.class);
    Mockito.when(componentTableModel.getStoredValueAt(Mockito.eq(0), Mockito.anyInt())).thenReturn(compWithFeed);
    Mockito.when(componentTableModel.getCellSettings(Mockito.anyString())).thenReturn(settings);
    Mockito.when(settings.getCellFont()).thenReturn(TableFormattingConstants.JVMFontFamily.Monospaced);
    Mockito.when(mockFp.getFeedType()).thenReturn(FeedType.FLOATING_POINT);
    controller = new TableControlPanelController(manifestation, labeledTable, componentTableModel);
    Mockito.when(labeledTable.getSelectedRows()).thenReturn(new int[] {0});
    Mockito.when(labeledTable.getSelectedColumns()).thenReturn(new int[] {0});

    Assert.assertEquals(controller.getCellFontName(),TableFormattingConstants.JVMFontFamily.Monospaced);
View Full Code Here

   
    Mockito.when(settings1.getEvaluator()).thenReturn(evaluator1);
    Mockito.when(settings2.getEvaluator()).thenReturn(null);
    Mockito.when(settings3.getEvaluator()).thenReturn(evaluator2);
    Mockito.when(settings4.getEvaluator()).thenReturn(evaluator1);
    FeedProvider mockFp1 = Mockito.mock(FeedProvider.class);
    FeedProvider mockFp2 = Mockito.mock(FeedProvider.class);
    FeedProvider mockFp3 = Mockito.mock(FeedProvider.class);
    FeedProvider mockFp4 = Mockito.mock(FeedProvider.class);
    Mockito.when(mockFp1.getSubscriptionId()).thenReturn("sub1");
    Mockito.when(mockFp2.getSubscriptionId()).thenReturn("sub2");
    Mockito.when(mockFp3.getSubscriptionId()).thenReturn("sub3");
    Mockito.when(mockFp4.getSubscriptionId()).thenReturn("sub4");
    Mockito.when(compWithFeed1.getCapability(FeedProvider.class)).thenReturn(mockFp1);
    Mockito.when(compWithFeed2.getCapability(FeedProvider.class)).thenReturn(mockFp2);
    Mockito.when(compWithFeed3.getCapability(FeedProvider.class)).thenReturn(mockFp3);
    Mockito.when(compWithFeed4.getCapability(FeedProvider.class)).thenReturn(mockFp4);
    Mockito.when(componentTableModel.getStoredValueAt(Mockito.anyInt(), Mockito.anyInt())).thenReturn(compWithFeed1);
View Full Code Here

    AbstractComponent delegate = component;
    Evaluator e = component.getCapability(Evaluator.class);
    if (e != null && component.getComponents().size() > 1) {
      return component.getComponentId();
    }
    FeedProvider fp = component.getCapability(FeedProvider.class);
    if (fp != null) {
      return fp.getSubscriptionId();
    }
   
    return delegate.getComponentId();
  }
View Full Code Here

   */
  private String getCanonicalName(AbstractComponent component) {
    String canonicalName = null;
   
    // Try to get the canonical name for the feed provider.
    FeedProvider feedProvider = component.getCapability(FeedProvider.class);
    if (feedProvider != null) {
      canonicalName = feedProvider.getCanonicalName();
    }
   
    // If the feed provider doesn't have a canonical name, use the component display name.
    if (canonicalName==null || canonicalName.isEmpty()) {
      canonicalName = component.getDisplayName();
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.components.FeedProvider$RenderingInfo

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.