Examples of TableStructure


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

  @Test
  public void testZeroDimensional() {
    when(policyManager.execute(isA(String.class), isA(PolicyContext.class))).thenReturn(success);

    AbstractComponent c;
    TableStructure structure;
   
    c = new MockLeafComponent();
    structure = TableViewPolicy.getTableStructure(c);
    assertEquals(structure.getType(), TableType.ZERO_DIMENSIONAL);
    assertEquals(structure.getRowCount(), 1);
    assertEquals(structure.getColumnCount(), 1);
    assertSame(structure.getValue(0, 0), c);
   
    c = new MockFeedComponent();
    structure = TableViewPolicy.getTableStructure(c);
    assertEquals(structure.getType(), TableType.ZERO_DIMENSIONAL);
    assertEquals(structure.getRowCount(), 1);
    assertEquals(structure.getColumnCount(), 1);
    assertSame(structure.getValue(0, 0), c);
   
    c = new MockEvaluator(new MockFeedComponent());
    structure = TableViewPolicy.getTableStructure(c);
    assertEquals(structure.getType(), TableType.ZERO_DIMENSIONAL);
    assertEquals(structure.getRowCount(), 1);
    assertEquals(structure.getColumnCount(), 1);
    assertSame(structure.getValue(0, 0), c);
  }
View Full Code Here

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

    AbstractComponent c3 = new MockCollection();
    AbstractComponent c4 = new MockEvaluator(c1,c2);
   
    AbstractComponent parent = new MockCollection(c1, c2, c3,c4);
   
    TableStructure structure = TableViewPolicy.getTableStructure(parent);
    assertEquals(structure.getType(), TableType.ONE_DIMENSIONAL);
    assertEquals(structure.getRowCount(), 4);
    assertEquals(structure.getColumnCount(), 1);
    assertSame(structure.getValue(0, 0), c1);
    assertSame(structure.getValue(1, 0), c2);
    assertSame(structure.getValue(2, 0), c3);
    assertSame(structure.getValue(3, 0), c4);
  }
View Full Code Here

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

    AbstractComponent parent3 = new MockCollection(e1, e2);

    AbstractComponent grandParent = new MockCollection(parent1, parent2, parent3);
   
    TableStructure structure = TableViewPolicy.getTableStructure(grandParent);
    assertEquals(structure.getType(), TableType.TWO_DIMENSIONAL);
    assertEquals(structure.getRowCount(), 3);
    assertEquals(structure.getColumnCount(), 3);
    assertSame(structure.getValue(0, 0), c1);
    assertSame(structure.getValue(0, 1), c2);
    assertSame(structure.getValue(0, 2), c3);
    assertSame(structure.getValue(1, 0), d1);
    assertSame(structure.getValue(1, 1), d2);
    assertNull(structure.getValue(1, 2));
    assertSame(structure.getValue(2, 0), e1);
    assertSame(structure.getValue(2, 1), e2);
    assertNull(structure.getValue(2, 2));
  }
View Full Code Here

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

   */
  public static TableStructure getTableStructure(AbstractComponent targetComponent) {

    if (targetComponent.isLeaf() || hasFeed(targetComponent) || isEvaluatorComponent(targetComponent)) {
      // 0-dimensional table
      return new TableStructure(TableType.ZERO_DIMENSIONAL, targetComponent);
    }

    // Try to create a 2-dimensional structure.
    // Each child of the component is an object to display as a row
    // or column. The child must have children of its own in order
    // to have 2 dimensions to the table. Each of those grandchildren
    // must have a data feed.
    boolean isTwoDimensional = true;
    childLoop: for (AbstractComponent component : targetComponent.getComponents()) {
      if ((component.isLeaf() || hasEvaluator(component)) && canEmbedInTable(component)) {
        isTwoDimensional = false;
        break childLoop;
      } else {
        for (AbstractComponent gcComponent : component.getComponents()) {
          if (!gcComponent.isLeaf() && !hasFeed(gcComponent) && !isViewableEvaluator(gcComponent)) {
            // We found a nonleaf that doesn't have a value, so we aren't two-dimensional.
            isTwoDimensional = false;
            break childLoop;
          }
        }
      }
    }
    if (isTwoDimensional) {
      return new TableStructure(TableType.TWO_DIMENSIONAL, targetComponent);
    }

    // The default case: a 1-dimensional structure.
    return new TableStructure(TableType.ONE_DIMENSIONAL, targetComponent);
  }
View Full Code Here

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

  public TableViewManifestation(AbstractComponent component, ViewInfo vi) {
    super(component,vi);

    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);
    table.getTable().setShowGrid(false);
    table.getTable().getColumnModel().setColumnMargin(0);
    table.getTable().setRowMargin(0);
   
    table.getTable().setDefaultRenderer(Object.class,
        renderer);
    table.getTable().setTransferHandler(
        new TableTransferHandler(this, table));
    table.getTable().setDragEnabled(true);
    table.getTable().setFillsViewportHeight(true);
    if (structure.getType() == TableType.TWO_DIMENSIONAL) {
      table.getTable().setDropMode(DropMode.ON_OR_INSERT);
    } else {
      table.getTable().setDropMode(DropMode.ON_OR_INSERT_ROWS);
    }
   
View Full Code Here

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

    }
    return rv;
  }

  private void updateFeedProviders() {
    TableStructure structure = TableViewPolicy
        .getTableStructure(getManifestedComponent());
    updateFeedProviders(structure);
    updateEvalutors();
    loadHeaderSettings();
    loadCellSettings();
View Full Code Here

Examples of org.openfaces.renderkit.table.TableStructure

        final String clientId = fileAttachments.getClientId(context);
        ChildData childData = getChildData(fileAttachments);
        writer.startElement("table", fileAttachments);
        writer.writeAttribute("id", clientId + ATTACHMENTS_LIST_ID, null);

        TableStructure tableStructure = childData.getTableStructure();
        TableHeader tableHeader = tableStructure.getHeader();
        if (tableHeader.isContentSpecified()) {
            tableHeader.render(context, null);
        }
        writer.startElement("tbody", fileAttachments);
        renderRows(context, fileAttachments, childData, fileAttachments.getValue());
        writer.endElement("tbody");

        TableFooter tableFooter = tableStructure.getFooter();
        if (tableFooter.isContentSpecified()) {
            tableFooter.render(context, null);
        }
        writer.endElement("table");
    }
View Full Code Here

Examples of org.openfaces.renderkit.table.TableStructure

                childComponents.add(component.getParent());
            }
        }

        FileAttachmentsTableStyles tableStyles = new FileAttachmentsTableStyles(fileAttachmentsComponent, childComponents);
        TableStructure tableStructure = new TableStructure(fileAttachmentsComponent, tableStyles);

        childData = new ChildData(tableStructure, childComponents);
        return childData;
    }
View Full Code Here

Examples of org.openfaces.renderkit.table.TableStructure

        DropDownFieldBase dropDownField = (DropDownFieldBase) dropDown;

        DropDownPopup popup = dropDownField.getPopup();

        ScriptBuilder buf = new ScriptBuilder();
        TableStructure tableStructure = popup.getChildData().getTableStructure();
        buf.initScript(context, dropDownField, "O$.DropDownField._init",
                dropDownField.getTimeout(),
                dropDownField.getListAlignment(),

                Styles.getStyleClassesStr(context, dropDownField, dropDownField.getRolloverListItemStyle(),
                        dropDownField.getRolloverListItemClass(), DefaultStyles.getDefaultSelectionStyle(), StyleGroup.rolloverStyleGroup()),

                getItemValuesArray(getItemValues(dropDown)),
                dropDownField.getCustomValueAllowed(),
                dropDownField.isRequired(),
                dropDownField.getSuggestionMode(),
                dropDownField.getSuggestionDelay(),
                dropDownField.getSuggestionMinChars(),
                isManualListOpeningAllowed(dropDownField),
                dropDownField.getAutoComplete(),
                dropDownField.getAttributes().get(ATTR_TOTAL_ITEM_COUNT),
                dropDownField.getAttributes().get(ATTR_PAGE_SIZE),

                tableStructure.getInitParam(context, POPUP_TABLE_DEFAULT_STYLES),
                dropDownField.isCachingAllowed(),
                getItemPresentationColumn(dropDown),
                dropDownField.getChangeValueOnSelect()
        );
        popup.resetChildData();
View Full Code Here

Examples of org.openfaces.renderkit.table.TableStructure

                    !(component instanceof OUIClientAction) && !Rendering.isA4jSupportComponent(component))
                childComponents.add(component);
        }

        DropDownFieldTableStyles tableStyles = new DropDownFieldTableStyles(dropDownField, childComponents);
        TableStructure tableStructure = new TableStructure(dropDownField, tableStyles);

        childData = new ChildData(tableStructure, childComponents);
        return childData;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.