Пример #1
0
  private boolean areAllVisible() {
    boolean retVal = true;
    final SessionEditor editor = getEditor();
    final Session session = editor.getSession();

    final List<TierViewItem> view = session.getTierView();
    for (TierViewItem tvi : view) {
      retVal &= tvi.isVisible();
    }

    return retVal;
  }
Пример #2
0
  @Override
  public int getColumnCount() {
    int retVal = 0;

    final Session session = getSession();
    if (session != null) {
      retVal = Columns.values().length - 1;
      retVal += session.getUserTierCount();
    }

    return retVal;
  }
Пример #3
0
 @Override
 public String getColumnName(int column) {
   String retVal = super.getColumnName(column);
   if (column < Columns.OTHER.ordinal()) {
     retVal = Columns.values()[column].getName();
   } else {
     final Session session = getSession();
     int tierIdx = column - Columns.OTHER.ordinal();
     if (tierIdx < session.getUserTierCount()) {
       retVal = session.getUserTier(tierIdx).getName();
     }
   }
   return retVal;
 }
Пример #4
0
  @Override
  public Object getValueAt(int rowIndex, int columnIndex) {
    Object retVal = null;

    final Session session = getSession();
    if (session != null && rowIndex < session.getRecordCount()) {
      final Record record = session.getRecord(rowIndex);

      if (columnIndex == Columns.RECORD_INDEX.ordinal()) {
        retVal = rowIndex + 1;
      } else if (columnIndex == Columns.SPEAKER.ordinal()) {
        retVal = record.getSpeaker();
      } else {
        final String tierName = getColumnName(columnIndex);
        retVal = record.getTier(tierName);
      }
    }

    return retVal;
  }
Пример #5
0
  @Override
  public void hookableActionPerformed(ActionEvent e) {
    final SessionEditor editor = getEditor();
    final Session session = editor.getSession();

    final List<TierViewItem> view = session.getTierView();
    final List<TierViewItem> newView = new ArrayList<TierViewItem>();
    final SessionFactory factory = SessionFactory.newFactory();

    final boolean allVisible = areAllVisible();
    for (TierViewItem oldItem : view) {
      final TierViewItem newItem =
          factory.createTierViewItem(
              oldItem.getTierName(), !allVisible, oldItem.getTierFont(), oldItem.isTierLocked());
      newView.add(newItem);
    }

    final TierViewEdit edit = new TierViewEdit(getEditor(), view, newView);
    editor.getUndoSupport().postEdit(edit);

    putValue(NAME, (!allVisible ? "Hide " : "Show ") + "all tiers");
  }
Пример #6
0
 @Override
 public int getRowCount() {
   final Session session = getSession();
   return (session != null ? session.getRecordCount() : 0);
 }