Package gov.nasa.arc.mct.table.model

Examples of gov.nasa.arc.mct.table.model.ComponentTableModel


          return null;
        }
       
        // Add a node view role for each selected component.
        List<View> views = new ArrayList<View>();
        ComponentTableModel model = ComponentTableModel.class.cast(table.getTable().getModel());
        for (int rowIndex : table.getSelectedRows()) {
          for (int columnIndex : table.getSelectedColumns()) {
            AbstractComponent component = (AbstractComponent) model.getStoredValueAt(rowIndex, columnIndex);
            if (component != null) {
              View view = component.getViewInfos(ViewType.NODE).iterator().next().createView(component);
              if (view != null) {
                views.add(view);
              }
View Full Code Here


    labelingAlgorithm = new AbbreviatingTableLabelingAlgorithm();
    setLabelingContext(labelingAlgorithm, getNamingContext());
    TableStructure structure = TableViewPolicy
        .getTableStructure(getManifestedComponent());
    model = new ComponentTableModel(structure, labelingAlgorithm, this);
    model.updateLabels();

    TableViewCellRenderer renderer = new TableViewCellRenderer();
   
    table = new LabeledTable(model);
View Full Code Here

      return enumerationModel;
    }
    if (isSingleCellSelection()) {
      EnumerationItem selectedItem = null;
      AbstractComponent component = (AbstractComponent) model.getStoredValueAt(table.getSelectedRows()[0], table.getSelectedColumns()[0]);
      ComponentTableModel tableModel = ComponentTableModel.class.cast(model);
      TableCellSettings cellSettings = tableModel.getCellSettings(tableModel.getKey(component));
      AbstractComponent evaluator = cellSettings.getEvaluator();
      //Enumeration control is now always visible, so show None as option
      enumerationModel.addElement(new EnumerationItem(null));
     
      // Add the component itself, if it can be a self-evaluator.
View Full Code Here

      AbstractComponent commonSelectedEvaluator = null;
      boolean commonEvaluator = true;
      boolean mixedEvaluatorSet = false;
      boolean firstCell = true;
     
      ComponentTableModel tableModel = ComponentTableModel.class.cast(model);
      // Enumeration control is always showing, so add None as option
      EnumerationItem none = new EnumerationItem(null);
      enumerationModel.addElement(none);
      enumerationModel.setSelectedItem(none);
         
      AbstractComponent component = (AbstractComponent) model.getStoredValueAt(table.getSelectedRows()[0], table.getSelectedColumns()[0]);       
      AbstractComponent referencedComponent = component;
      // Add the component itself, if it can be a self-evaluator.
      if (referencedComponent.getCapability(Evaluator.class) != null &&
          !referencedComponent.getCapability(Evaluator.class).requiresMultipleInputs()) {
        EnumerationItem item = new EnumerationItem(referencedComponent);
        enumerationModel.addElement(item);
      }
 
      for (AbstractComponent parent : referencedComponent.getReferencingComponents()) {
        // For now, we only find evaluators that have exactly one child (the current component).
        Evaluator e = parent.getCapability(Evaluator.class);
        if (e != null && !e.requiresMultipleInputs()) {
          // Found an enumeration for the component.
            commonEnums.add(new EnumerationItem(parent));
        }
      }
 
      for (int row : table.getSelectedRows()) {
        for (int column : table.getSelectedColumns()) {
          component = (AbstractComponent) model.getStoredValueAt(row, column);
          if (component == null) {
            mixedEvaluatorSet = true;
            continue;
          }
          referencedComponent = component;
          TableCellSettings cellSettings = tableModel.getCellSettings(tableModel.getKey(referencedComponent));
          AbstractComponent evaluator = cellSettings.getEvaluator();
          if (commonSelectedEvaluator != null)
            if (evaluator != null) {
              if (!evaluator.getId().equals(commonSelectedEvaluator.getId())) {
                mixedEvaluatorSet = true;
View Full Code Here

   * @return true if all the selected cells do not have the same evaluator
   */
  @Override
  public boolean selectedCellsHaveMixedEnumerations() {
    AbstractComponent commonSelectedEvaluator = null;
    ComponentTableModel tableModel = ComponentTableModel.class.cast(model);
    boolean firstCell = true;
    for (int row : table.getSelectedRows()) {
      for (int column : table.getSelectedColumns()) { 
        AbstractComponent component = (AbstractComponent) model.getStoredValueAt(row, column);
        if (component == null) {
          return true;
        }
        AbstractComponent referencedComponent = component;
        TableCellSettings cellSettings = tableModel.getCellSettings(tableModel.getKey(referencedComponent));
        AbstractComponent evaluator = cellSettings.getEvaluator();
        if (commonSelectedEvaluator != null)
          if (evaluator != null) {
            if (!evaluator.getId().equals(commonSelectedEvaluator.getId())) {
              return true;
View Full Code Here

  public Integer getDecimalPlaces() {
    if (isSelectionContainsEmptyCells()) {
      return null;
    }
    Integer decimalPlaces = null;
    ComponentTableModel tableModel = ComponentTableModel.class.cast(model);
    for (Integer row : table.getSelectedRows()) {
      for (Integer col : table.getSelectedColumns()) {
        AbstractComponent component = (AbstractComponent) model.getStoredValueAt(row, col);
        String id = tableModel.getKey(component);
        TableCellSettings settings = tableModel.getCellSettings(id);
        int decimals = settings.getNumberOfDecimals();
        // determine default decimal places
        if (decimals == -1) {
          FeedProvider fp = component.getCapability(FeedProvider.class);
          if (fp != null) {
View Full Code Here

  @Override
  public JVMFontFamily getCellFontName() {
    if (isSelectionContainsEmptyCells()) {
      return null;
    }
    ComponentTableModel tableModel = ComponentTableModel.class.cast(model);
    if (isSingleCellSelection()) {
      AbstractComponent component = (AbstractComponent) model.getStoredValueAt(table.getSelectedRows()[0], table.getSelectedColumns()[0]);
      String id = tableModel.getKey(component);
      TableCellSettings settings = tableModel.getCellSettings(id);
      return settings.getCellFont();
    }
    JVMFontFamily defaultFont = TableFormattingConstants.defaultJVMFontFamily;
    JVMFontFamily commonCellFont = null;
    for (Integer row : table.getSelectedRows()) {
      for (Integer col : table.getSelectedColumns()) {
        AbstractComponent component = (AbstractComponent) model.getStoredValueAt(row, col);
        String id = tableModel.getKey(component);
        TableCellSettings settings = tableModel.getCellSettings(id);
        JVMFontFamily aCellFont = settings.getCellFont();
        if (aCellFont == null) {
            aCellFont = defaultFont;
        }
        if (commonCellFont != null && !aCellFont.equals(commonCellFont)) {
View Full Code Here

  @Override
  public Integer getCellFontSize() {
    if (isSelectionContainsEmptyCells()) {
      return null;
    }
    ComponentTableModel tableModel = ComponentTableModel.class.cast(model);
    if (isSingleCellSelection()) {
      AbstractComponent component = (AbstractComponent) model.getStoredValueAt(table.getSelectedRows()[0], table.getSelectedColumns()[0]);
      String id = tableModel.getKey(component);
      TableCellSettings settings = tableModel.getCellSettings(id);
      return Integer.valueOf(settings.getFontSize());
    }
    Integer defaultFontSize = Integer.valueOf(TableFormattingConstants.defaultFontSize);
    Integer commonCellFontSize = null;
    for (Integer row : table.getSelectedRows()) {
      for (Integer col : table.getSelectedColumns()) {
        AbstractComponent component = (AbstractComponent) model.getStoredValueAt(row, col);
        String id = tableModel.getKey(component);
        TableCellSettings settings = tableModel.getCellSettings(id);
        Integer aCellFontSize = settings.getFontSize();
        // determine default decimal places
        if (aCellFontSize == null) {
            aCellFontSize = defaultFontSize;
        }
View Full Code Here

  @Override
  public Color getCellFontColor() {
    if (isSelectionContainsEmptyCells()) {
      return null;
    }
    ComponentTableModel tableModel = ComponentTableModel.class.cast(model);
    if (isSingleCellSelection()) {
      AbstractComponent component = (AbstractComponent) model.getStoredValueAt(table.getSelectedRows()[0], table.getSelectedColumns()[0]);
      String id = tableModel.getKey(component);
      TableCellSettings settings = tableModel.getCellSettings(id);
      return settings.getFontColor();
    }
    Color commonCellColor = null;
   
    for (Integer row : table.getSelectedRows()) {
      for (Integer col : table.getSelectedColumns()) {
        AbstractComponent component = (AbstractComponent) model.getStoredValueAt(row, col);
        String id = tableModel.getKey(component);
        TableCellSettings settings = tableModel.getCellSettings(id);
        Color aCellFontColor = settings.getFontColor();
        if ((commonCellColor != null && !commonCellColor.equals(aCellFontColor))) {
          return null;
        }
        commonCellColor = aCellFontColor;
View Full Code Here

  @Override
  public Color getCellBackgroundColor() {
    if (isSelectionContainsEmptyCells()) {
      return null;
    }
    ComponentTableModel tableModel = ComponentTableModel.class.cast(model);
    if (isSingleCellSelection()) {
      AbstractComponent component = (AbstractComponent) model.getStoredValueAt(table.getSelectedRows()[0], table.getSelectedColumns()[0]);
      String id = tableModel.getKey(component);
      TableCellSettings settings = tableModel.getCellSettings(id);
      return settings.getBackgroundColor();
    }
    Color commonCellColor = null;
    for (Integer row : table.getSelectedRows()) {
      for (Integer col : table.getSelectedColumns()) {
        AbstractComponent component = (AbstractComponent) model.getStoredValueAt(row, col);
        String id = tableModel.getKey(component);
        TableCellSettings settings = tableModel.getCellSettings(id);
        Color aCellBackgroundColor = settings.getBackgroundColor();
        if (commonCellColor != null && !commonCellColor.equals(aCellBackgroundColor)) {
          return null;
        }
        commonCellColor = aCellBackgroundColor;
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.table.model.ComponentTableModel

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.