private void initLayout() {

    layout.setMargin(true);
    setContent(layout);

    form.setCaption("Employee Details ");
    PropertysetItem item = new PropertysetItem();
    item.addItemProperty("Name", new ObjectProperty<String>(""));
    item.addItemProperty("Address", new ObjectProperty<String>(""));

    ComboBox combobox = new ComboBox("Sex");
    combobox.setInvalidAllowed(true);
    combobox.setNullSelectionAllowed(false);
    combobox.addItem("Male");
    combobox.addItem("Female");
    item.addItemProperty("Age", new ObjectProperty<String>(""));
    item.addItemProperty("Email", new ObjectProperty<String>(""));
    item.addItemProperty("Mobile No", new ObjectProperty<String>(""));

    Form form = new Form();
    final Form reader = new Form();
    form.setCaption("Fill Your Details");
    form.setItemDataSource(item);
    reader.setItemDataSource(item);
    reader.setCaption("Your registation details");
    reader.setReadOnly(true);

    button.addClickListener(
        new Button.ClickListener() {
          public void buttonClick(ClickEvent event) {

            Label message = new Label("You are Registered");
            layout.addComponent(message);
            layout.addComponent(reader);
          }
        });
    layout.addComponent(form);

    final RichTextArea area = new RichTextArea();
    area.setValue("Add more details here");
    layout.addComponent(area);

    layout.addComponent(button);
  }
  // GoodsOrderListSvc data=new GoodsOrderListSvc();
  // @Inject   TenterpriseFacade cf;
  // @Inject  TenterpriseForm form;
  @PostConstruct
  public void initComponent() {
    /** * */
    StringBuffer sb = new StringBuffer();
    StringBuffer sb1 = new StringBuffer();
    // String fsql = data.makeSql();
    // gSqlContainer sumber=new gSqlContainer();
    MHorizontalLayout sidebar = new MHorizontalLayout();
    MHorizontalLayout isicontents = new MHorizontalLayout();
    MHorizontalLayout toolbar = new MHorizontalLayout();
    toolbar.addComponent(new CheckBox("Indv.Query"));
    // TabSheet tabsheet = new TabSheet();
    // -------------------- Header  ------------------------------
    toolbar.addComponent(new PopupDateField("Entry Date"));
    toolbar.addComponent(new PopupDateField("~"));
    toolbar.addComponent(new TextField("Item"));
    toolbar.addComponent(new ComboBox("Order Media"));
    toolbar.addComponent(new ComboBox("Order Type"));
    toolbar.addComponent(new TextField("MD"));
    toolbar.addComponent(new TextField("Vendor"));
    toolbar.addComponent(new ComboBox("Ad. Type"));

    // -------------------- Header  ------------------------------
    MHorizontalLayout toolmenu;
    toolmenu = new MHorizontalLayout();
    toolmenu.addComponent(new Button("Ret"));
    toolmenu.addComponent(new Button("Ins"));
    toolmenu.addComponent(new Button("Del"));
    toolmenu.addComponent(new Button("Save"));
    toolmenu.addComponent(new Button("Print"));
    toolmenu.addComponent(new Button("XLS"));
    addComponents(new Header("Order Item Report (GoodsOrderList)"));
    addComponents(toolmenu);
    addComponents(toolbar);
    //        addComponents(isicontents);
    // MTable table=new MTable();
    // -------------------- Header Table ---judul untuk table----------
    // List<Tenterprise> findAll = cf.findAll();
    // MTable<Tenterprise> table=new
    // MTable<Tenterprise>(Tenterprise.class).withProperties("entpName");
    // table.setBeans(findAll);
    // table.addMValueChangeListener(new MValueChangeListener<Tdescribecode>() {
    //    @Override
    //    public void valueChange(MValueChangeEvent<Tdescribecode> event) {
    //    Notification.show("ss");
    //    form.setEntity(event.getValue());
    //    }
    //    });
    // table.addContainerProperty("No", String.class,  null);
    // -------------------- Header Table ------------------------------
    //   isicontents.addComponents(table);
    try {
      SimpleJDBCConnectionPool connectionPool =
          new SimpleJDBCConnectionPool(
              "oracle.jdbc.OracleDriver", BaseEntity.jdbc, BaseEntity.user, BaseEntity.pass, 2, 5);
      SQLContainer container;
      container = new SQLContainer(new FreeformQuery(sb.toString(), connectionPool, "AD_MENU_ID"));
      // MTable table= new MTable("MENU",container);
      MTable table = new MTable();
      table.setContainerDataSource(container);
      table.addMValueChangeListener(
          new MValueChangeListener() {
            @Override
            public void valueChange(MValueChangeEvent event) {
              Notification.show("ss");
              //    form.setEntity(event.getValue());
            }
          });
      addComponents(table);
    } catch (SQLException e) {
      e.printStackTrace();
      RichTextArea rtarea = new RichTextArea();
      rtarea.setValue(sb.toString());
      addComponents(rtarea);
    }
    addLayoutClickListener(
        new LayoutEvents.LayoutClickListener() {
          @Override
          public void layoutClick(LayoutEvents.LayoutClickEvent event) {}
        });
  }
  // ScmOutDeliveryOkSvc data=new ScmOutDeliveryOkSvc();
  // @Inject   TenterpriseFacade cf;
  // @Inject  TenterpriseForm form;
  @PostConstruct
  public void initComponent() {
    /**
     * Vendor
     *
     * <p:inputText>Term
     *
     * <p:calendar>~
     *
     * <p:calendar>Item
     *
     * <p:inputText>Type
     *
     * <p:selectOneRadio><f:selectItem itemValue="Order" /><f:selectItem itemValue="Item" /> Step
     *
     * <p:selectOneListbox>*
     */
    StringBuffer sb = new StringBuffer();
    StringBuffer sb1 = new StringBuffer();
    sb.append(
        "SELECT /* entpdelivery.xml : logistics.entpdelivery.selectOrderDeliveryOk by ScmOutDeliveryOk */");
    sb.append(
        "                   DISTINCT '0' AS CHECK_YN,                                                                             ");
    sb.append(
        "                 DECODE(OD.DO_FLAG, '20', '', NVL(SM.SLIP_NO, ''))       AS SLIP_NO,                          ");
    sb.append(
        "                 DECODE(OD.DO_FLAG, '20', '', NVL(SM.DELY_GB, ''))       AS DELY_GB,                          ");
    sb.append(
        "                 DECODE(OD.DO_FLAG, '20', '', NVL(SM.REAL_RECEIVER, '')) AS REAL_RECEIVER,                    ");
    sb.append(
        "                 OD.ORDER_NO,                                                                                 ");
    sb.append("                 OD.DO_FLAG,");
    sb.append(
        "                 OD.WH_CODE,                                                                                  ");
    sb.append(
        "                 DECODE(OD.DO_FLAG, '20', '', SM.SLIP_I_NO)     AS SLIP_I_NO,                                 ");
    sb.append(
        "                 DECODE(OD.DO_FLAG, '20', '', SM.SLIP_GB)       AS SLIP_GB,                                   ");
    sb.append(
        "                 TC.CUST_NO,                                                                                  ");
    sb.append(
        "                 TC.CUST_NAME,                                                                                ");
    sb.append(
        "                 TR.RECEIVER,                                                                                 ");
    sb.append(
        "                 TR.RECEIVER_POST,                                                                            ");
    sb.append(
        "                 FUN_ADD_POSTADDR(TR.RECEIVER_POST, TR.RECEIVER_POST_SEQ, TR.RECEIVER_ADDR) AS RECEIVER_ADDR, ");
    sb.append(
        "                 TR.RECEIVER_DDD||TR.RECEIVER_TEL1||TR.RECEIVER_TEL2 AS TEL1,                                 ");
    sb.append(
        "                 TR.RECEIVER_HP1||TR.RECEIVER_HP2||TR.RECEIVER_HP3 AS TEL2 , OD.DO_FLAG                                   ");
    sb.append(
        "            FROM TORDERDT       OD,                                                                           ");
    sb.append(
        "                 TSLIPDT        SD,                                                                           ");
    sb.append(
        "                 TSLIPM         SM,                                                                           ");
    sb.append(
        "                 TCUSTOMER      TC,                                                                           ");
    sb.append(
        "                 TRECEIVER      TR,                                                                           ");
    sb.append(
        "                 TGOODS         GM                                                                            ");
    sb.append(
        "           WHERE OD.CUST_NO          = TC.CUST_NO                                                             ");
    sb.append(
        "             AND OD.CUST_NO          = TR.CUST_NO                                                             ");
    sb.append(
        "             AND OD.ORDER_NO         = SD.ORDER_NO(+)                                                         ");
    sb.append(
        "             AND OD.ORDER_G_SEQ      = SD.ORDER_G_SEQ(+)                                                      ");
    sb.append(
        "             AND OD.ORDER_D_SEQ      = SD.ORDER_D_SEQ(+)                                                      ");
    sb.append(
        "             AND OD.ORDER_W_SEQ      = SD.ORDER_W_SEQ(+)                                                      ");
    sb.append(
        "             AND SD.SLIP_I_NO        = SM.SLIP_I_NO(+)                                                        ");
    sb.append(
        "             AND OD.RECEIVER_SEQ     = TR.RECEIVER_SEQ                                                        ");
    sb.append("             AND OD.GOODS_CODE       = GM.GOODS_CODE");
    sb.append("                  AND GM.ENTP_CODE = '100002'");
    sb.append(
        "             AND OD.LAST_PROC_DATE  >= TO_DATE('2013/11/01', 'YYYY/MM/DD')                                               ");
    sb.append(
        "             AND OD.LAST_PROC_DATE   <  TO_DATE('2014/07/01', 'YYYY/MM/DD') + 1                                          ");
    sb.append(
        "             AND OD.DO_FLAG          = '30'                                                                     ");
    sb.append(
        "             AND OD.DELY_TYPE        = '20'                                                                   ");
    sb.append("             AND OD.SYSLAST          > 0 ");
    sb.append("            ");

    sb1.append(
        "SELECT /* entpdelivery.xml : logistics.entpdelivery.selectOrderDeliveryDetailOk by ScmOutDeliveryOk */    ");
    sb1.append("               OD.ORDER_NO,");
    sb1.append("               OD.ORDER_G_SEQ,");
    sb1.append("               OD.ORDER_D_SEQ,");
    sb1.append("               OD.ORDER_W_SEQ,");
    sb1.append("               OD.GOODS_CODE,");
    sb1.append("               GM.GOODS_NAME,");
    sb1.append("               OD.GOODSDT_CODE,");
    sb1.append("               OD.GOODSDT_INFO,");
    sb1.append("               OD.GOODS_GB,");
    sb1.append("               OD.SYSLAST,");
    sb1.append("               OD.SYSLAST_AMT,");
    sb1.append("               OD.SYSLAST_NET,");
    sb1.append("               OD.SYSLAST_VAT,");
    sb1.append("               SD.DELY_QTY,");
    sb1.append("               '' AS REMARK");
    sb1.append("          FROM TORDERDT  OD,");
    sb1.append("               TSLIPDT   SD,");
    sb1.append("               TSLIPM    SM,");
    sb1.append("               TGOODS    GM");
    sb1.append("         WHERE OD.ORDER_NO     = SD.ORDER_NO(+)");
    sb1.append("           AND OD.ORDER_G_SEQ  = SD.ORDER_G_SEQ(+)");
    sb1.append("           AND OD.ORDER_D_SEQ  = SD.ORDER_D_SEQ(+)");
    sb1.append("           AND OD.ORDER_W_SEQ  = SD.ORDER_W_SEQ(+)");
    sb1.append("           AND SD.SLIP_I_NO    = SM.SLIP_I_NO(+)");
    sb1.append("           AND OD.GOODS_CODE   = GM.GOODS_CODE");
    sb1.append("           AND OD.ORDER_NO     = 20140403032491");
    sb1.append("           AND NVL(SM.SLIP_I_NO, 'X') = NVL('10000000112407', 'X')");
    sb1.append("           AND OD.DO_FLAG        = '30'");
    sb1.append("           AND OD.DELY_TYPE      = '20'");
    sb1.append("           AND OD.SYSLAST        > 0");
    sb1.append("           AND GM.OUT_STOCK_YN   = '0'            ");
    // String fsql = data.makeSql();
    // gSqlContainer sumber=new gSqlContainer();
    MHorizontalLayout sidebar = new MHorizontalLayout();
    MHorizontalLayout isicontents = new MHorizontalLayout();
    MHorizontalLayout toolbar = new MHorizontalLayout();
    toolbar.addComponent(new CheckBox("Indv.Query"));
    // TabSheet tabsheet = new TabSheet();
    // -------------------- Header  ------------------------------
    toolbar.addComponent(new TextField("Promo Name"));
    toolbar.addComponent(new PopupDateField("~"));
    toolbar.addComponent(new PopupDateField("~"));
    toolbar.addComponent(new TextField("Promo Name"));
    toolbar.addComponent(new CheckBox("Type"));
    toolbar.addComponent(new CheckBox("Order"));
    toolbar.addComponent(new CheckBox("Exchange"));
    toolbar.addComponent(new ComboBox("Step"));
    toolbar.addComponent(new Button("Select"));
    toolbar.addComponent(new Button("Deselect"));
    toolbar.addComponent(new Button("Waybil No Copy"));
    toolbar.addComponent(new TextField(""));
    toolbar.addComponent(new Button("Delivery Company"));
    toolbar.addComponent(new ComboBox("Other"));

    // -------------------- Header  ------------------------------
    MHorizontalLayout toolmenu;
    toolmenu = new MHorizontalLayout();
    toolmenu.addComponent(new Button("Ret"));
    toolmenu.addComponent(new Button("Ins"));
    toolmenu.addComponent(new Button("Del"));
    toolmenu.addComponent(new Button("Save"));
    toolmenu.addComponent(new Button("Print"));
    toolmenu.addComponent(new Button("XLS"));
    addComponents(new Header("Entp Delivery Confirm (ScmOutDeliveryOk)"));
    addComponents(toolmenu);
    addComponents(toolbar);
    //        addComponents(isicontents);
    // MTable table=new MTable();
    // -------------------- Header Table ---judul untuk table----------
    // List<Tenterprise> findAll = cf.findAll();
    // MTable<Tenterprise> table=new
    // MTable<Tenterprise>(Tenterprise.class).withProperties("entpName");
    // table.setBeans(findAll);
    // table.addMValueChangeListener(new MValueChangeListener<Tdescribecode>() {
    //    @Override
    //    public void valueChange(MValueChangeEvent<Tdescribecode> event) {
    //    Notification.show("ss");
    //    form.setEntity(event.getValue());
    //    }
    //    });
    // table.addContainerProperty("No", String.class,  null);
    // -------------------- Header Table ------------------------------
    //   isicontents.addComponents(table);
    try {
      SimpleJDBCConnectionPool connectionPool =
          new SimpleJDBCConnectionPool(
              "oracle.jdbc.OracleDriver",
              "jdbc:oracle:thin:@localhost:1521/XE",
              "dartmedia",
              "dartmedia",
              2,
              5);
      SQLContainer container;
      container = new SQLContainer(new FreeformQuery(sb.toString(), connectionPool, "AD_MENU_ID"));
      // MTable table= new MTable("MENU",container);
      TreeTable table = new TreeTable("Menu", container);
      addComponents(table);
    } catch (SQLException e) {
      e.printStackTrace();
      RichTextArea rtarea = new RichTextArea();
      rtarea.setValue(sb.toString());
      addComponents(rtarea);
    }
    addLayoutClickListener(
        new LayoutEvents.LayoutClickListener() {
          @Override
          public void layoutClick(LayoutEvents.LayoutClickEvent event) {}
        });
  }