/**
   * Initialize Lookups
   *
   * @return true if OK
   */
  private boolean initLookups() {
    try {
      int AD_Column_ID = COLUMN_S_RESOURCE_S_RESOURCETYPE_ID; // 	S_Resource.S_ResourceType_ID

      fieldResourceType =
          new WSearchEditor(
              MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir),
              Msg.translate(Env.getCtx(), "S_ResourceType_ID"),
              "",
              false,
              false,
              true);

      AD_Column_ID =
          COLUMN_S_RESOURCEASSIGNMENT_S_RESOURCE_ID; //	S_ResourceAssignment.S_Resource_ID

      fieldResource =
          new WSearchEditor(
              MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir),
              Msg.translate(Env.getCtx(), "S_Resource_ID"),
              "",
              false,
              false,
              true);
    } catch (Exception e) {
      log.log(Level.SEVERE, "InfoAssignment.initLookup");
      return false;
    }

    bNew.setImage(ThemeManager.getThemeResource("images/New16.png"));

    return true;
  } // initLookups
  /** Dynamic Init. - Create GridController & Panel - AD_Column_ID from C_Order */
  public void dynInit() throws Exception {
    // Order Distribution
    MLookup orderL =
        MLookupFactory.get(
            Env.getCtx(),
            m_WindowNo,
            0,
            MColumn.getColumn_ID(MDDOrder.Table_Name, MDDOrder.COLUMNNAME_DD_Order_ID),
            DisplayType.Search);
    fOrder = new VLookup(MDDOrder.COLUMNNAME_DD_Order_ID, true, false, true, orderL);
    lOrder.setText(Msg.translate(Env.getCtx(), MDDOrder.COLUMNNAME_DD_Order_ID));
    fOrder.addVetoableChangeListener(this);
    lOrder.setVisible(false);
    fOrder.setVisible(false);

    MLookup llocator = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, 53950, DisplayType.TableDir);
    fLocator = new VLookup(MLocator.COLUMNNAME_M_Locator_ID, true, false, true, llocator);
    lLocator.setText(Msg.translate(Env.getCtx(), "M_Locator_ID"));
    fLocator.addVetoableChangeListener(this);
    m_M_Locator_ID = fLocator.getValue();

    MLookup llocatorto =
        MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, 53949, DisplayType.TableDir);
    fLocatorTo = new VLookup("M_LocatorTo_ID", false, false, true, llocatorto);
    lLocatorTo.setText(Msg.translate(Env.getCtx(), "M_LocatorTo_ID"));
    fLocatorTo.addVetoableChangeListener(this);
    m_M_LocatorTo_ID = fLocatorTo.getValue();

    //	C_Order.C_BPartner_ID
    MLookup bpL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, 2762, DisplayType.Search);
    fBPartner = new VLookup("C_BPartner_ID", false, false, true, bpL);
    lBPartner.setText(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
    fBPartner.addVetoableChangeListener(this);
    panel.getStatusBar().setStatusLine(Msg.getMsg(Env.getCtx(), "InventoryMoveGenerateSel"));
  } //	dynInit
  private void dynInit() {
    fDateFrom = new WDateEditor();

    int AD_Column_ID = 2893; //  C_BPartner.C_BPartner_ID
    MLookup teacher =
        MLookupFactory.get(Env.getCtx(), form.getWindowNo(), 0, AD_Column_ID, DisplayType.Search);
    fBPartner = new WSearchEditor("C_BPartner_ID", true, false, true, teacher);
    fBPartner.addValueChangeListener(this);

    AD_Column_ID = 1000734; //  CA_CourseDef.CA_CourseDef_ID
    MLookup group =
        MLookupFactory.get(Env.getCtx(), form.getWindowNo(), 0, AD_Column_ID, DisplayType.TableDir);
    fGroup = new WTableDirEditor("CA_CourseDef_ID", true, false, true, group);
    fGroup.addValueChangeListener(this);

    AD_Column_ID = 1000934; //  CA_SubjectMatter.CA_SubjectMatter_ID
    MLookup subject =
        MLookupFactory.get(Env.getCtx(), form.getWindowNo(), 0, AD_Column_ID, DisplayType.TableDir);
    fSubject = new WTableDirEditor("CA_SubjectMatter_ID", true, false, true, subject);
    fSubject.addValueChangeListener(this);

    for (int x = 0; x <= 4; x++) {
      PlanBookDay planDay = new PlanBookDay();
      // Add missing parameters
      planDays.add(planDay);
    }
  }
  public void initComponents() {
    lblDocumentNo = new Label(Util.cleanAmp(Msg.translate(Env.getCtx(), "DocumentNo")));
    lblDescription = new Label(Msg.translate(Env.getCtx(), "Description"));
    lblDateOrdered = new Label(Msg.translate(Env.getCtx(), "DateOrdered"));
    lblOrderRef = new Label(Msg.translate(Env.getCtx(), "POReference"));
    lblGrandTotal = new Label(Msg.translate(Env.getCtx(), "GrandTotal"));

    txtDocumentNo = new Textbox();
    txtDescription = new Textbox();
    txtOrderRef = new Textbox();

    dateFrom = new Datebox();
    dateTo = new Datebox();

    amountFrom = new NumberBox(false);
    amountTo = new NumberBox(false);

    isSoTrx = new Checkbox();
    isSoTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx"));
    isSoTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
    MLookup lookupBP = MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search);
    editorBPartner =
        new WSearchEditor(
            lookupBP, Msg.translate(Env.getCtx(), "C_BPartner_ID"), "", true, false, true);
    editorBPartner.addValueChangeListener(this);
  }
  private void init() {
    label.setValue(" ");
    getComponent().setLabel(gridField.getHeader());
    getComponent().setTooltiptext(gridField.getDescription());

    String columnName = super.getColumnName();
    if (columnName.equals("PaymentRule")) {
      readReference(REFERENCE_PAYMENTRULE);
      getComponent().setImage(ThemeManager.getThemeResource("images/Payment16.png")); //  29*14
    } else if (columnName.equals("DocAction")) {
      readReference(REFERENCE_DOCUMENTACTION);
      getComponent().setImage(ThemeManager.getThemeResource("images/Process16.png")); //  16*16
    } else if (columnName.equals("CreateFrom")) {
      getComponent().setImage(ThemeManager.getThemeResource("images/Copy16.png")); //  16*16
    } else if (columnName.equals("Record_ID")) {
      getComponent().setImage(ThemeManager.getThemeResource("images/Zoom16.png")); //  16*16
      getComponent().setLabel(Msg.getMsg(Env.getCtx(), "ZoomDocument"));
    } else if (columnName.equals("Posted")) {
      readReference(REFERENCE_POSTED);
      getComponent().setImage(ThemeManager.getThemeResource("images/InfoAccount16.png")); //  16*16
    }

    if (gridField.getColumnName().endsWith("_ID")
        && !gridField.getColumnName().equals("Record_ID")) {
      m_lookup =
          MLookupFactory.get(
              Env.getCtx(),
              gridField.getWindowNo(),
              0,
              gridField.getAD_Column_ID(),
              DisplayType.Search);
    } else if (gridField.getAD_Reference_Value_ID() != 0) {
      //  Assuming List
      m_lookup =
          MLookupFactory.get(
              Env.getCtx(),
              gridField.getWindowNo(),
              0,
              gridField.getAD_Column_ID(),
              DisplayType.List);
    }
  }
  protected void initForm() {
    loadActivities();

    fAnswerList.setMold("select");

    bZoom.setImage("/images/Zoom16.png");
    bOK.setImage("/images/Ok24.png");

    MLookup lookup = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, 10443, DisplayType.Search);
    fForward =
        new WSearchEditor(lookup, Msg.translate(Env.getCtx(), "AD_User_ID"), "", true, false, true);

    init();
    display(-1);
  }