Examples of TableLayoutBuilder


Examples of org.kiji.schema.layout.TableLayoutBuilder

    basicDesc.setVersion("layout-1.3.0");
    final KijiColumnName validatedColumn = KijiColumnName.create("info:fullname");
    final Schema intSchema = Schema.create(Type.INT);
    final Schema stringSchema = Schema.create(Type.STRING);

    final TableLayoutDesc strictIntDesc = new TableLayoutBuilder(basicDesc, getKiji())
        .withAvroValidationPolicy(validatedColumn, AvroValidationPolicy.STRICT)
        .withReader(validatedColumn, intSchema)
        .build();
    final TableLayoutDesc strictStringDesc = new TableLayoutBuilder(basicDesc, getKiji())
        .withAvroValidationPolicy(validatedColumn, AvroValidationPolicy.STRICT)
        .withWriter(validatedColumn, stringSchema)
        .build();
    final TableLayoutDesc developerIntDesc = new TableLayoutBuilder(basicDesc, getKiji())
        .withAvroValidationPolicy(validatedColumn, AvroValidationPolicy.DEVELOPER)
        .withReader(validatedColumn, intSchema)
        .build();
    final TableLayoutDesc developerStringDesc = new TableLayoutBuilder(basicDesc, getKiji())
        .withAvroValidationPolicy(validatedColumn, AvroValidationPolicy.DEVELOPER)
        .withWriter(validatedColumn, stringSchema)
        .build();
    final TableLayoutDesc noneIntDesc = new TableLayoutBuilder(basicDesc, getKiji())
        .withAvroValidationPolicy(validatedColumn, AvroValidationPolicy.NONE)
        .withReader(validatedColumn, intSchema)
        .build();
    final TableLayoutDesc noneStringDesc = new TableLayoutBuilder(basicDesc, getKiji())
        .withAvroValidationPolicy(validatedColumn, AvroValidationPolicy.NONE)
        .withWriter(validatedColumn, stringSchema)
        .build();
    final TableLayoutDesc schema10IntDesc = new TableLayoutBuilder(basicDesc, getKiji())
        .withAvroValidationPolicy(validatedColumn, AvroValidationPolicy.SCHEMA_1_0)
        .withReader(validatedColumn, intSchema)
        .build();
    final TableLayoutDesc schema10StringDesc = new TableLayoutBuilder(basicDesc, getKiji())
        .withAvroValidationPolicy(validatedColumn, AvroValidationPolicy.SCHEMA_1_0)
        .withWriter(validatedColumn, stringSchema)
        .build();

    final List<TableLayoutDesc> intDescs =
View Full Code Here

Examples of org.kiji.schema.layout.TableLayoutBuilder

  @Test
  public void testAddRemoveModifyColumns() throws IOException {
    final TableLayoutUpdateValidator validator = new TableLayoutUpdateValidator(getKiji());
    final KijiColumnName validatedColumn = KijiColumnName.create("info:qual0");
    final TableLayoutDesc desc = new TableLayoutBuilder(
        KijiTableLayouts.getLayout(AVRO_VALIDATION_TEST), getKiji())
        .withReader(validatedColumn, TestRecord5.SCHEMA$)
        .withAvroValidationPolicy(validatedColumn, AvroValidationPolicy.STRICT)
        .withLayoutId("original")
        .build();

    // The initial layout is valid.
    validator.validate(null, KijiTableLayout.newLayout(desc));

    // Create an update which removes a column, adds a column, and modifies the set of readers for a
    // column in a compatible way.
    final TableLayoutDesc updateDesc =
        KijiTableLayouts.getLayout(AVRO_VALIDATION_UPDATE_TEST);
    updateDesc.setReferenceLayout("original");
    updateDesc.setLayoutId("updated");
    final TableLayoutDesc newDesc = new TableLayoutBuilder(updateDesc, getKiji())
        .withReader(validatedColumn, TestRecord4.SCHEMA$)
        .build();

    validator.validate(KijiTableLayout.newLayout(desc), KijiTableLayout.newLayout(newDesc));
  }
View Full Code Here

Examples of org.kiji.schema.layout.TableLayoutBuilder

    final Schema optIntRecordSchema = Schema.createRecord("Record", null, "org.ns", false);
    optIntRecordSchema.setFields(Lists.newArrayList(
        new Field("a", INT_SCHEMA, null, IntNode.valueOf(0))));

    final TableLayoutDesc originalDesc = new TableLayoutBuilder(desc, kiji)
        .withAvroValidationPolicy(
            KijiColumnName.create("info:fullname"), AvroValidationPolicy.STRICT)
        .withReader(KijiColumnName.create("info:fullname"), emptyRecordSchema)
        .build();

    kiji.createTable(originalDesc);

    final TableLayoutDesc newDesc = new TableLayoutBuilder(originalDesc, kiji)
        .withWriter(KijiColumnName.create("info:fullname"), optIntRecordSchema)
        .build();

    kiji.modifyTableLayout(newDesc);
  }
View Full Code Here

Examples of org.kiji.schema.layout.TableLayoutBuilder

  @Override
  public KijiTableLayout updateTableLayout(String tableName, TableLayoutDesc layoutUpdate)
      throws IOException {

    // Normalize the new layout to use schema UIDs:
    TableLayoutBuilder layoutBuilder = new TableLayoutBuilder(mSchemaTable);
    final TableLayoutDesc update = layoutBuilder.normalizeTableLayoutDesc(
        layoutUpdate,
        new LayoutOptions()
            .setSchemaFormat(SchemaFormat.UID));

    // Fetch all the layout history:
View Full Code Here

Examples of org.springframework.richclient.layout.TableLayoutBuilder

        control.setPreferredSize(getLargestPageSize());
        pagePanel.add(control, page.getId());
    }

    protected JPanel createContentControl() {
        TableLayoutBuilder panelBuilder = new TableLayoutBuilder();
        String colSpec = "colSpec=" + getTreeControlWidth() + " rowSpec=fill:default:grow";
        panelBuilder.cell(new JScrollPane(pageTree), colSpec);
        panelBuilder.gapCol();
        panelBuilder.cell(pagePanel, "valign=top");
        return panelBuilder.getPanel();
    }
View Full Code Here

Examples of org.springframework.richclient.layout.TableLayoutBuilder

        iconLabel.setIcon(getIcon());

        JPanel panel = new JPanel();
        panel.setName("panel");
        panel.setBackground(getBackgroundColor());
        TableLayoutBuilder table = new TableLayoutBuilder(panel);
        table.row(FormFactory.LINE_GAP_ROWSPEC);
        table.gapCol();
        table.cell(titleLabel);
        table.gapCol();
        table.cell(iconLabel, "rowspan=2 colspec=pref");
        table.row(FormFactory.NARROW_LINE_GAP_ROWSPEC);
        table.cell(messagePane.getControl());
        table.row(FormFactory.NARROW_LINE_GAP_ROWSPEC);
        return table.getPanel();
    }
View Full Code Here

Examples of org.springframework.richclient.layout.TableLayoutBuilder

  public AbstractSelectionDialog(String title, Window parent) {
    super(title, parent);
  }

  protected JComponent createDialogContentPane() {
    TableLayoutBuilder builder = new TableLayoutBuilder();

    JComponent selectionComponent = createSelectionComponent();
    Assert.state(selectionComponent != null, "createSelectionComponent cannot return null");

    if (StringUtils.hasText(description)) {
      builder.cell(getComponentFactory().createLabelFor(description, selectionComponent));
      builder.relatedGapRow();
      builder.row();
    }

    builder.cell(selectionComponent);

    return builder.getPanel();
  }
View Full Code Here

Examples of org.springframework.richclient.layout.TableLayoutBuilder

        super(title, parent, filterList);
        this.filterList = filterList;
    }

    protected JComponent createSelectionComponent() {
        TableLayoutBuilder builder = new TableLayoutBuilder();

        JComponent filterComponent = createFilterComponent();
        builder.cell(filterComponent);
        builder.row();
        builder.relatedGapRow();
        builder.cell(super.createSelectionComponent());

        return builder.getPanel();
    }
View Full Code Here

Examples of org.springframework.richclient.layout.TableLayoutBuilder

    private JComboBox comboBox;
    private JCheckBox checkBox;
    private JTextField nestedField;

    public SimplePanel() {
        TableLayoutBuilder builder = new TableLayoutBuilder(this);

        stringField = new JTextField(10);
        stringField.setName("stringProperty");

        comboBox = new JComboBox(new String[] { "item 0", "item 1", "item 2" });
        comboBox.setName("comboProperty");

        checkBox = new JCheckBox("checkbox");
        checkBox.setName("booleanProperty");

        builder.cell(new JLabel("string"));
        builder.gapCol();
        builder.cell(stringField);
        builder.relatedGapRow();
        builder.cell(new JLabel("combo"));
        builder.gapCol();
        builder.cell(comboBox);
        builder.relatedGapRow();
        builder.cell(checkBox);
        builder.relatedGapRow();
       
        JPanel nestedPanel =new JPanel();
        nestedField = new JTextField("test");
        nestedField.setName("nestedField");
        nestedPanel.add(nestedField);
       
        builder.cell(nestedPanel);

        builder.getPanel();
    }
View Full Code Here

Examples of org.springframework.richclient.layout.TableLayoutBuilder

     * IMPORTANT: This code isn't a good example of how to write a view.
     * It's just here to prove how the exception handlers work.
     * Take a look at the application context to see how the exception handler(s) are configured.
     */
    protected JComponent createControl() {
        TableLayoutBuilder layoutBuilder = new TableLayoutBuilder();

        layoutBuilder.cell(new JLabel("This page demonstrates the exception handling."));
        layoutBuilder.row();
        layoutBuilder.cell(new JLabel("Push the buttons and see which exception handler gets choosen."));
        layoutBuilder.row();
        layoutBuilder.cell(new JLabel("That defines the log level and the dialog shown."));
        layoutBuilder.row();
        layoutBuilder.unrelatedGapRow();

        JButton badCredentials = new JButton(new AbstractAction("Login with bad credentials"){
            public void actionPerformed(ActionEvent e) {
                loginWithBadCredentials();
            }
        });
        layoutBuilder.cell(badCredentials);
        layoutBuilder.row();
        layoutBuilder.relatedGapRow();

        JButton accessDenied = new JButton(new AbstractAction("Do something you don't have access to"){
            public void actionPerformed(ActionEvent e) {
                denyAccess();
            }
        });
        layoutBuilder.cell(accessDenied);
        layoutBuilder.row();
        layoutBuilder.relatedGapRow();

        JButton invalidPerson = new JButton(new AbstractAction("Validate a person with a null name and age 1981"){
            public void actionPerformed(ActionEvent e) {
                validateInvalidPerson();
            }
        });
        layoutBuilder.cell(invalidPerson);
        layoutBuilder.row();
        layoutBuilder.relatedGapRow();

        JButton nullPointer = new JButton(new AbstractAction("Cause a NumberFormatException"){
            public void actionPerformed(ActionEvent e) {
                causeNumberFormatException();
            }
        });
        layoutBuilder.cell(nullPointer);
        layoutBuilder.row();
        layoutBuilder.relatedGapRow();

        JButton stackOverflow = new JButton(new AbstractAction("Cause a stack overflow error"){
            public void actionPerformed(ActionEvent e) {
                causeStackOverflow();
            }
        });
        layoutBuilder.cell(stackOverflow);
        layoutBuilder.row();

        JPanel panel = layoutBuilder.getPanel();
        panel.setBorder(GuiStandardUtils.createEvenlySpacedBorder(UIConstants.ONE_SPACE));
        return panel;
    }
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.