コード例 #1
0
ファイル: LabelFactory.java プロジェクト: Hack23/cia
  /**
   * Creates a new Label object.
   *
   * @param panel the panel
   * @param content the content
   */
  public static void createHeader2Label(final AbstractOrderedLayout panel, final String content) {
    final Label label = new Label(content);
    label.setStyleName("Level2Header");

    panel.addComponent(label);
    panel.setExpandRatio(label, ContentRatio.SMALL);
  }
コード例 #2
0
  @Test
  public void testExpandRatio() {
    AbstractOrderedLayout layout = new AbstractOrderedLayout() {};

    AbstractComponent first = new AbstractComponent() {};
    AbstractComponent second = new AbstractComponent() {};

    layout.addComponent(first);
    layout.addComponent(second);

    int ratio = 2;
    layout.setExpandRatio(first, ratio);
    layout.setExpandRatio(second, 1);

    AbstractComponent replace = new AbstractComponent() {};
    layout.replaceComponent(first, replace);

    Assert.assertEquals(
        "Expand ratio for replaced component is not " + "the same as for previous one",
        ratio,
        layout.getExpandRatio(replace),
        0.0001);
  }