Package gov.nasa.arc.mct.table.view

Examples of gov.nasa.arc.mct.table.view.LabelAbbreviations


    AbbreviationsImpl availableAbbreviations = new AbbreviationsImpl("value");
    availableAbbreviations.addPhrase("Amps", Collections.singletonList("A"));
    availableAbbreviations.addPhrase("BCA1", Collections.<String>emptyList());
    availableAbbreviations.addPhrase("Ch1", Collections.<String>emptyList());
    availableAbbreviations.addPhrase("Serial", Collections.<String>emptyList());
    AbbreviationSettings aSettings = new AbbreviationSettings("fullLabel", availableAbbreviations, new LabelAbbreviations());
    String abbreviatedLabel = aSettings.getAbbreviatedLabel();
    Assert.assertEquals(abbreviatedLabel, "Amps BCA1 Ch1 Serial");
    LabelAbbreviations available2 = aSettings.getAbbreviations();
    Assert.assertEquals(available2.getAbbreviation("BCA1"), "BCA1");
    Assert.assertEquals(available2.getAbbreviation("Amps"), "Amps");

    // Change the state of the control panel via currentAbbreviations
    LabelAbbreviations currentAbbreviations = new LabelAbbreviations();
    currentAbbreviations.addAbbreviation("Amps", "A | a | Amp");
    currentAbbreviations.addAbbreviation("BCA1", "B | bca1");
    currentAbbreviations.addAbbreviation("CAT", "C");
    currentAbbreviations.addAbbreviation("DOG", "D");
    currentAbbreviations.addAbbreviation("Ace", "ace");
    currentAbbreviations.addAbbreviation("Abb", "a");
    currentAbbreviations.addAbbreviation("Rabbit", "R");

    AbbreviationSettings a2Settings = new AbbreviationSettings("fullLabel", availableAbbreviations, currentAbbreviations);
    LabelAbbreviations available2afterSelect = a2Settings.getAbbreviations();
    Assert.assertEquals(available2afterSelect.getAbbreviation("BCA1"), "B | bca1");
    Assert.assertEquals(available2afterSelect.getAbbreviation("Amps"), "A | a | Amp");
    Map<String, String> map = getAbbreviations(currentAbbreviations);
    Assert.assertEquals(map.size(), 7);

  }
View Full Code Here


  
   * @param row the row to retrieve abbreviations for
   * @return the abbreviations
   */
  public LabelAbbreviations getRowLabelAbbreviations(int row) {
    LabelAbbreviations abbrevs = rowLabelAbbreviations.get(row);
    if (abbrevs != null) {
      return abbrevs;
    } else {
      return new LabelAbbreviations();
    }
  }
View Full Code Here

  
   * @param column the column index to retrieve abbreviations for
   * @return the abbreviations
   */
  public LabelAbbreviations getColumnLabelAbbreviations(int column) {
    LabelAbbreviations abbrevs = columnLabelAbbreviations.get(column);
    if (abbrevs != null) {
      return abbrevs;
    } else {
      return new LabelAbbreviations();
    }
  }
View Full Code Here

  
   * @param id the feed provider ID (a PUI, if using ISP)
   * @return the cell label abbreviations
   */
  public LabelAbbreviations getCellLabelAbbreviations(String id) {
    LabelAbbreviations abbrevs = cellLabelAbbreviations.get(id);
    if (abbrevs == null) {
      abbrevs = new LabelAbbreviations();
      cellLabelAbbreviations.put(id, abbrevs);
    }
    return abbrevs;
  }
View Full Code Here

    }
  }

  @Override
  public String getColumnName(int columnIndex) {
    LabelAbbreviations x = getColumnLabelAbbreviations(columnIndex);
    return abbreviateLabel(getFullColumnName(columnIndex), getColumnLabelAbbreviations(columnIndex));
  }
View Full Code Here

    String fullLabel = super.getCellName(rowIndex, columnIndex);
    AbstractComponent component = (AbstractComponent) getStoredValueAt(rowIndex, columnIndex);
    if (component == null) {
      return fullLabel;
    } else {
      LabelAbbreviations abbrevs = getCellLabelAbbreviations(getKey(component));
      return abbrevs.applyAbbreviations(fullLabel);
    }
  }
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.table.view.LabelAbbreviations

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.