public ProjectPreviewFormControlsGenerator(AdvancedPreviewBeanForm<T> editForm) {
   this.previewForm = editForm;
   layout = new MHorizontalLayout().withStyleName("control-buttons");
   layout.setSizeUndefined();
   popupButtonsControl = new OptionPopupContent();
   editButtons = new MHorizontalLayout();
   editButtons.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT);
   editButtons.addStyleName("edit-btn");
 }
  private void constructHeader() {
    CssLayout headerWrapper = new CssLayout();
    headerWrapper.setWidth("100%");
    headerWrapper.addStyleName("taskgroup-header");

    MHorizontalLayout header = new MHorizontalLayout().withWidth("100%");
    Label headerLbl = new Label("All Tasks");
    headerLbl.setStyleName("h2");
    header.with(headerLbl).withAlign(headerLbl, Alignment.MIDDLE_LEFT).expand(headerLbl);

    Button backToListBtn =
        new Button(
            "Back to dashboard",
            new Button.ClickListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(Button.ClickEvent event) {
                EventBusFactory.getInstance()
                    .post(new TaskListEvent.GotoTaskListScreen(this, null));
              }
            });
    backToListBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    header.addComponent(backToListBtn);
    header.setComponentAlignment(backToListBtn, Alignment.MIDDLE_RIGHT);

    Button saveOrderBtn =
        new Button(
            AppContext.getMessage(GenericI18Enum.BUTTON_SAVE),
            new Button.ClickListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(Button.ClickEvent event) {
                EventBusFactory.getInstance()
                    .post(new TaskListEvent.SaveReoderTaskList(event, changeSet));
              }
            });
    saveOrderBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    saveOrderBtn.setIcon(FontAwesome.SAVE);
    header.with(saveOrderBtn).withAlign(saveOrderBtn, Alignment.MIDDLE_RIGHT);

    headerWrapper.addComponent(header);

    this.addComponent(headerWrapper);

    final DDVerticalLayout ddLayout = new DDVerticalLayout();
    ddLayout.addStyleName("taskgroup-reorder");
    ddLayout.setComponentVerticalDropRatio(0.3f);
    ddLayout.setDragMode(LayoutDragMode.CLONE);
    ddLayout.setDropHandler(
        new DropHandler() {
          private static final long serialVersionUID = 1L;

          @Override
          public AcceptCriterion getAcceptCriterion() {
            return new Not(VerticalLocationIs.MIDDLE);
          }

          @Override
          public void drop(DragAndDropEvent event) {
            LayoutBoundTransferable transferable =
                (LayoutBoundTransferable) event.getTransferable();

            DDVerticalLayout.VerticalLayoutTargetDetails details =
                (DDVerticalLayout.VerticalLayoutTargetDetails) event.getTargetDetails();

            TaskListComponent comp = (TaskListComponent) transferable.getComponent();

            int currentIndex = ddLayout.getComponentIndex(comp);
            int newIndex = details.getOverIndex();

            ddLayout.removeComponent(comp);

            if (currentIndex > newIndex
                && details.getDropLocation() == VerticalDropLocation.BOTTOM) {
              newIndex++;
            }

            SimpleTaskList dropTaskList = comp.getTaskList();
            dropTaskList.setGroupindex(newIndex);
            changeSet.add(dropTaskList);
            ddLayout.addComponent(comp, newIndex);

            // change affected task list items
            for (int i = 0; i < ddLayout.getComponentCount(); i++) {
              TaskListComponent affectedComp = (TaskListComponent) ddLayout.getComponent(i);
              SimpleTaskList affectedTaskList = affectedComp.getTaskList();
              affectedTaskList.setGroupindex(i);
              changeSet.add(affectedTaskList);
            }
          }
        });

    taskLists =
        new BeanList<>(
            null,
            ApplicationContextUtil.getSpringBean(ProjectTaskListService.class),
            TaskListRowDisplayHandler.class,
            ddLayout);
    this.addComponent(taskLists);
  }
  // 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) {}
        });
  }
예제 #4
0
      @Override
      public ComponentContainer getLayout() {
        final VerticalLayout layout = new VerticalLayout();
        this.informationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(2, 6);

        layout.addComponent(this.informationLayout.getLayout());

        final MHorizontalLayout controlsBtn =
            new MHorizontalLayout().withMargin(new MarginInfo(true, true, true, false));
        layout.addComponent(controlsBtn);

        final Button approveBtn =
            new Button(
                "Approve & Close",
                new Button.ClickListener() {
                  private static final long serialVersionUID = 1L;

                  @Override
                  public void buttonClick(Button.ClickEvent event) {

                    if (EditForm.this.validateForm()) {
                      // Save bug status and assignee
                      bug.setStatus(BugStatus.Verified.name());

                      BugService bugService =
                          ApplicationContextUtil.getSpringBean(BugService.class);
                      bugService.updateSelectiveWithSession(bug, AppContext.getUsername());

                      // Save comment
                      String commentValue = commentArea.getValue();
                      if (StringUtils.isNotBlank(commentValue)) {
                        CommentWithBLOBs comment = new CommentWithBLOBs();
                        comment.setComment(
                            Jsoup.clean(commentArea.getValue(), Whitelist.relaxed()));
                        comment.setCreatedtime(new GregorianCalendar().getTime());
                        comment.setCreateduser(AppContext.getUsername());
                        comment.setSaccountid(AppContext.getAccountId());
                        comment.setType(ProjectTypeConstants.BUG);
                        comment.setTypeid("" + bug.getId());
                        comment.setExtratypeid(CurrentProjectVariables.getProjectId());

                        CommentService commentService =
                            ApplicationContextUtil.getSpringBean(CommentService.class);
                        commentService.saveWithSession(comment, AppContext.getUsername());
                      }

                      ApproveInputWindow.this.close();
                      callbackForm.refreshBugItem();
                    }
                  }
                });
        approveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        approveBtn.setClickShortcut(ShortcutAction.KeyCode.ENTER);
        controlsBtn.with(approveBtn).withAlign(approveBtn, Alignment.MIDDLE_LEFT);

        Button cancelBtn =
            new Button(
                AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
                new Button.ClickListener() {
                  private static final long serialVersionUID = 1L;

                  @Override
                  public void buttonClick(Button.ClickEvent event) {
                    ApproveInputWindow.this.close();
                  }
                });
        cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
        controlsBtn.with(cancelBtn).withAlign(cancelBtn, Alignment.MIDDLE_LEFT);

        layout.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
        return layout;
      }
  public HorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) {
    Button optionParentBtn =
        new Button(
            AppContext.getMessage(GenericI18Enum.BUTTON_OPTION),
            new Button.ClickListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(ClickEvent event) {
                optionBtn.setPopupVisible(true);
              }
            });

    optionBtn = new SplitButton(optionParentBtn);
    optionBtn.setWidthUndefined();
    optionBtn.addStyleName(UIConstants.THEME_GRAY_LINK);

    if (permissionItem != null) {
      boolean canWrite = CurrentProjectVariables.canWrite(permissionItem);
      boolean canAccess = CurrentProjectVariables.canAccess(permissionItem);
      boolean canRead = CurrentProjectVariables.canRead(permissionItem);

      if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
        addBtn =
            new Button(
                AppContext.getMessage(GenericI18Enum.BUTTON_ADD),
                new Button.ClickListener() {
                  private static final long serialVersionUID = 1L;

                  @Override
                  public void buttonClick(final ClickEvent event) {
                    optionBtn.setPopupVisible(false);
                    T item = previewForm.getBean();
                    previewForm.fireAddForm(item);
                  }
                });
        addBtn.setIcon(FontAwesome.PLUS);
        addBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        addBtn.setEnabled(canWrite);
        editButtons.addComponent(addBtn);
      }

      if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
        editBtn =
            new Button(
                AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                new Button.ClickListener() {
                  private static final long serialVersionUID = 1L;

                  @Override
                  public void buttonClick(final ClickEvent event) {
                    optionBtn.setPopupVisible(false);
                    T item = previewForm.getBean();
                    previewForm.fireEditForm(item);
                  }
                });
        editBtn.setIcon(FontAwesome.EDIT);
        editBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        editBtn.setEnabled(canWrite);
        editButtons.addComponent(editBtn);
      }

      if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) {
        deleteBtn =
            new Button(
                AppContext.getMessage(GenericI18Enum.BUTTON_DELETE),
                new Button.ClickListener() {
                  private static final long serialVersionUID = 1L;

                  @Override
                  public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.fireDeleteForm(item);
                  }
                });
        deleteBtn.setIcon(FontAwesome.TRASH_O);
        deleteBtn.setStyleName(UIConstants.THEME_RED_LINK);
        deleteBtn.setEnabled(canAccess);
        editButtons.addComponent(deleteBtn);
      }

      if ((buttonEnableFlags & ASSIGN_BTN_PRESENTED) == ASSIGN_BTN_PRESENTED) {
        assignBtn =
            new Button(
                AppContext.getMessage(GenericI18Enum.BUTTON_ASSIGN),
                new Button.ClickListener() {
                  private static final long serialVersionUID = 1L;

                  @Override
                  public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.fireAssignForm(item);
                  }
                });
        assignBtn.setIcon(FontAwesome.SHARE);
        assignBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        editButtons.addComponent(assignBtn, 0);
        assignBtn.setEnabled(canWrite);
      }

      if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
        cloneBtn =
            new Button(
                AppContext.getMessage(GenericI18Enum.BUTTON_CLONE),
                new Button.ClickListener() {
                  private static final long serialVersionUID = 1L;

                  @Override
                  public void buttonClick(final ClickEvent event) {
                    optionBtn.setPopupVisible(false);
                    T item = previewForm.getBean();
                    previewForm.fireCloneForm(item);
                  }
                });
        cloneBtn.setIcon(FontAwesome.ROAD);
        cloneBtn.setStyleName("link");
        cloneBtn.setEnabled(canWrite);
        popupButtonsControl.addOption(cloneBtn);
      }

      if (popupButtonsControl.getComponentCount() > 0) {
        optionBtn.setContent(popupButtonsControl);
        editButtons.addComponent(optionBtn);
      }

      layout.with(editButtons).withAlign(editButtons, Alignment.MIDDLE_RIGHT);

      if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) {
        ButtonGroup navigationBtns = new ButtonGroup();
        navigationBtns.setStyleName("navigation-btns");
        Button previousItem =
            new Button(
                "<",
                new Button.ClickListener() {
                  private static final long serialVersionUID = 1L;

                  @Override
                  public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.fireGotoPrevious(item);
                  }
                });

        previousItem.setStyleName(UIConstants.THEME_GREEN_LINK);
        previousItem.setDescription(
            AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM));
        previousItem.setEnabled(canRead);
        navigationBtns.addButton(previousItem);

        Button nextItemBtn =
            new Button(
                ">",
                new Button.ClickListener() {
                  private static final long serialVersionUID = 1L;

                  @Override
                  public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.fireGotoNextItem(item);
                  }
                });

        nextItemBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        nextItemBtn.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM));
        nextItemBtn.setEnabled(canRead);

        navigationBtns.addButton(nextItemBtn);
        layout.addComponent(navigationBtns);
        layout.setComponentAlignment(navigationBtns, Alignment.MIDDLE_RIGHT);
      }
    }

    return layout;
  }
 /** @param comp */
 public void insertToControlBlock(Component comp) {
   editButtons.addComponent(comp, 0);
 }
  // 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) {}
        });
  }