2016-08-10 5 views
0

フォームレイアウトでは、複数のコンポーネント(フィールド)を表示する必要があります。vaadin FormLayoutカスタム左:右コンポーネントの設定

enter image description here

enter image description here

+0

あなたは何をしたいですか?何を試しましたか? – Harald

+0

FormLayoutにハイブリッドコンポーネントをカチオンで追加します。私はverticalLayoutを使用して、複数のformlayoutを回避する方法を追加しました。 –

+0

基本的には、私はハイブリッドコンポーネントを持つことができるように、フォームレイアウトの右側に何を追加したいのかをコントロールしたい。 –

答えて

1

あなたはcom.vaadin.ui.CustomComponent(以下の例)を拡張するカスタム・コンポーネントをビルドすることができます。 フィールドバインディングを使用する場合は、作業が複雑になり、おそらくcom.vaadin.ui.AbstractFieldを拡張し、さらにいくつかのメソッドをオーバーライドする必要があります。

SuperCustom dateSelection = new SuperCustom("Caption on left side in FormLayout"); 
formLayout.addComponent(dateSelection); 

class SuperCustom extends CustomComponent { 

    ComboBox ordinal = new ComboBox(); 
    ComboBox day = new ComboBox(); 
    ComboBox month = new ComboBox(); 

    public SuperCustom(String caption) { 
     setCompositionRoot(new HorizontalLayout(ordinal, day, new Label("of"), month)); 
     configureComponents(); 
     setCaption(caption); 
    } 

    private void configureComponents() { 
     //fill comboboxes 
    } 

    public Date getValue() { 
     //build date based on fields 
     return date; 
    } 
} 
関連する問題