예제 #1
0
  class PlanBookDay extends Panel {
    private Grid fieldGrid = GridFactory.newGridLayout();
    Label lDate = new Label(new Timestamp(System.currentTimeMillis()).toLocaleString());
    Label lDayName = new Label("Monday");
    Label lDayNo = new Label("1");

    Textbox fUnit = new Textbox();
    Textbox fLesson = new Textbox();
    Textbox fStage = new Textbox();
    Textbox fActivity = new Textbox();
    Textbox fHomework = new Textbox();
    Textbox fValues = new Textbox();
    Textbox fComments = new Textbox();
    Textbox fLink = new Textbox();
    Textbox fImage = new Textbox();

    public PlanBookDay() {
      super();
      this.appendChild(fieldGrid);

      fieldGrid.setWidth("100%");
      Rows rows = fieldGrid.newRows();

      Row row = rows.newRow();
      row.appendChild(lDate);
      row = rows.newRow();
      row.appendChild(lDayName);
      row = rows.newRow();
      row.appendChild(lDayNo);
      row = rows.newRow();
      row.appendChild(new Space());
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fUnit);
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fLesson);
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fStage);
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fActivity);
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fHomework);
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fValues);
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fComments);
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fLink);
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fImage);
    }
  }
예제 #2
0
/**
 * Create Manual Payments From (AP) Invoices or (AR) Credit Memos. Allows user to select Invoices
 * for payment. When Processed, PaySelection is created and optionally posted/generated and printed
 *
 * @author Jorg Janke
 * @version $Id: VPaySelect.java,v 1.3 2006/07/30 00:51:28 jjanke Exp $
 */
public class WPaySelect extends PaySelect
    implements IFormController, EventListener, WTableModelListener, ASyncProcess {
  /** @todo withholding */

  /** */
  private static final long serialVersionUID = -6031404894392912610L;

  private CustomForm form = new CustomForm();

  //
  private Panel mainPanel = new Panel();
  private Borderlayout mainLayout = new Borderlayout();
  private Panel parameterPanel = new Panel();
  private Label labelBankAccount = new Label();
  private Listbox fieldBankAccount = ListboxFactory.newDropdownListbox();
  private Grid parameterLayout = GridFactory.newGridLayout();
  private Label labelBankBalance = new Label();
  private Label labelCurrency = new Label();
  private Label labelBalance = new Label();
  private Checkbox onlyDue = new Checkbox();
  private Label labelBPartner = new Label();
  private Listbox fieldBPartner = ListboxFactory.newDropdownListbox();
  private Label dataStatus = new Label();
  private WListbox miniTable = ListboxFactory.newDataTable();
  private ConfirmPanel commandPanel =
      new ConfirmPanel(true, false, false, false, false, false, false);
  private Button bCancel = commandPanel.getButton(ConfirmPanel.A_CANCEL);
  private Button bGenerate = commandPanel.createButton(ConfirmPanel.A_PROCESS);
  private Button bRefresh = commandPanel.createButton(ConfirmPanel.A_REFRESH);
  private Label labelPayDate = new Label();
  private WDateEditor fieldPayDate = new WDateEditor();
  private Label labelPaymentRule = new Label();
  private Listbox fieldPaymentRule = ListboxFactory.newDropdownListbox();
  private Label labelDtype = new Label();
  private Listbox fieldDtype = ListboxFactory.newDropdownListbox();
  private Panel southPanel;

  @SuppressWarnings("unused")
  private ProcessInfo m_pi;

  private boolean m_isLock;

  /** Initialize Panel */
  public WPaySelect() {
    try {
      zkInit();
      dynInit();

      loadBankInfo();
      southPanel.appendChild(new Separator());
      southPanel.appendChild(commandPanel);
    } catch (Exception e) {
      log.log(Level.SEVERE, "", e);
    }
  } //	init

  /**
   * Static Init
   *
   * @throws Exception
   */
  private void zkInit() throws Exception {
    //
    form.appendChild(mainPanel);
    mainPanel.appendChild(mainLayout);
    mainPanel.setStyle("width: 100%; height: 100%; padding: 0; margin: 0");
    mainLayout.setHeight("100%");
    mainLayout.setWidth("99%");
    parameterPanel.appendChild(parameterLayout);
    //
    labelBankAccount.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID"));
    fieldBankAccount.addActionListener(this);
    labelBPartner.setText(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
    fieldBPartner.addActionListener(this);
    bRefresh.addActionListener(this);
    labelPayDate.setText(Msg.translate(Env.getCtx(), "PayDate"));
    labelPaymentRule.setText(Msg.translate(Env.getCtx(), "PaymentRule"));
    fieldPaymentRule.addActionListener(this);
    labelDtype.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
    fieldDtype.addActionListener(this);
    //
    labelBankBalance.setText(Msg.translate(Env.getCtx(), "CurrentBalance"));
    labelBalance.setText("0");
    onlyDue.setText(Msg.getMsg(Env.getCtx(), "OnlyDue"));
    dataStatus.setText(" ");
    dataStatus.setPre(true);
    //
    bGenerate.addActionListener(this);
    bCancel.addActionListener(this);
    //
    North north = new North();
    north.setStyle("border: none");
    mainLayout.appendChild(north);
    north.appendChild(parameterPanel);

    Rows rows = parameterLayout.newRows();
    Row row = rows.newRow();
    row.appendChild(labelBankAccount.rightAlign());
    row.appendChild(fieldBankAccount);
    row.appendChild(labelBankBalance.rightAlign());
    Panel balancePanel = new Panel();
    balancePanel.appendChild(labelCurrency);
    balancePanel.appendChild(labelBalance);
    row.appendChild(balancePanel);
    row.appendChild(new Space());

    row = rows.newRow();
    row.appendChild(labelBPartner.rightAlign());
    row.appendChild(fieldBPartner);
    row.appendChild(new Space());
    row.appendChild(onlyDue);
    row.appendChild(new Space());

    row = rows.newRow();
    row.appendChild(labelDtype.rightAlign());
    row.appendChild(fieldDtype);
    row.appendChild(new Space());
    row.appendChild(new Space());
    row.appendChild(new Space());

    row = rows.newRow();
    row.appendChild(labelPayDate.rightAlign());
    row.appendChild(fieldPayDate.getComponent());
    row.appendChild(labelPaymentRule.rightAlign());
    row.appendChild(fieldPaymentRule);
    row.appendChild(bRefresh);

    South south = new South();
    south.setStyle("border: none");
    mainLayout.appendChild(south);
    southPanel = new Panel();
    southPanel.appendChild(dataStatus);
    south.appendChild(southPanel);
    Center center = new Center();
    mainLayout.appendChild(center);
    center.appendChild(miniTable);
    //
    commandPanel.addButton(bGenerate);
    commandPanel.getButton(ConfirmPanel.A_OK).setVisible(false);
  } //  jbInit

  /** Dynamic Init. - Load Bank Info - Load BPartner - Init Table */
  private void dynInit() {
    ArrayList<BankInfo> bankAccountData = getBankAccountData();
    for (BankInfo bi : bankAccountData) fieldBankAccount.appendItem(bi.toString(), bi);

    if (fieldBankAccount.getItemCount() == 0) FDialog.error(m_WindowNo, form, "VPaySelectNoBank");
    else fieldBankAccount.setSelectedIndex(0);

    ArrayList<KeyNamePair> bpartnerData = getBPartnerData();
    for (KeyNamePair pp : bpartnerData) fieldBPartner.appendItem(pp.getName(), pp);
    fieldBPartner.setSelectedIndex(0);

    ArrayList<KeyNamePair> docTypeData = getDocTypeData();
    for (KeyNamePair pp : docTypeData) fieldDtype.appendItem(pp.getName(), pp);

    prepareTable(miniTable);

    miniTable.getModel().addTableModelListener(this);
    //
    fieldPayDate.setMandatory(true);
    fieldPayDate.setValue(new Timestamp(System.currentTimeMillis()));
  } //  dynInit

  /** Load Bank Info - Load Info from Bank Account and valid Documents (PaymentRule) */
  private void loadBankInfo() {
    BankInfo bi = (BankInfo) fieldBankAccount.getSelectedItem().getValue();
    if (bi == null) return;
    labelCurrency.setText(bi.Currency);
    labelBalance.setText(m_format.format(bi.Balance));

    //  PaymentRule
    fieldPaymentRule.removeAllItems();

    ArrayList<ValueNamePair> paymentRuleData = getPaymentRuleData(bi);
    for (ValueNamePair vp : paymentRuleData) fieldPaymentRule.appendItem(vp.getName(), vp);
    fieldPaymentRule.setSelectedIndex(0);
  } //  loadBankInfo

  /** Query and create TableInfo */
  private void loadTableInfo() {
    Timestamp payDate = (Timestamp) fieldPayDate.getValue();
    miniTable.setColorCompare(payDate);
    log.config("PayDate=" + payDate);

    BankInfo bi = (BankInfo) fieldBankAccount.getSelectedItem().getValue();

    ValueNamePair paymentRule = (ValueNamePair) fieldPaymentRule.getSelectedItem().getValue();
    KeyNamePair bpartner = (KeyNamePair) fieldBPartner.getSelectedItem().getValue();
    KeyNamePair docType = (KeyNamePair) fieldDtype.getSelectedItem().getValue();

    loadTableInfo(bi, payDate, paymentRule, onlyDue.isSelected(), bpartner, docType, miniTable);

    calculateSelection();
  } //  loadTableInfo

  /** Dispose */
  public void dispose() {
    SessionManager.getAppDesktop().closeActiveWindow();
  } //	dispose

  /**
   * ************************************************************************ ActionListener
   *
   * @param e event
   */
  public void onEvent(Event e) {
    //  Update Bank Info
    if (e.getTarget() == fieldBankAccount) loadBankInfo();

    //  Generate PaySelection
    else if (e.getTarget() == bGenerate) {
      generatePaySelect();
    } else if (e.getTarget() == bCancel) dispose();

    //  Update Open Invoices
    else if (e.getTarget() == fieldBPartner
        || e.getTarget() == bRefresh
        || e.getTarget() == fieldDtype) loadTableInfo();
  } //  actionPerformed

  /**
   * Table Model Listener
   *
   * @param e event
   */
  public void tableChanged(WTableModelEvent e) {
    if (e.getColumn() == 0) calculateSelection();
  } //  valueChanged

  /** Calculate selected rows. - add up selected rows */
  public void calculateSelection() {
    dataStatus.setText(calculateSelection(miniTable));
    //
    bGenerate.setEnabled(m_noSelected != 0);
  } //  calculateSelection

  /** Generate PaySelection */
  private void generatePaySelect() {
    if (miniTable.getRowCount() == 0) return;
    miniTable.setSelectedIndices(new int[] {0});
    calculateSelection();
    if (m_noSelected == 0) return;

    String msg =
        generatePaySelect(
            miniTable,
            (ValueNamePair) fieldPaymentRule.getSelectedItem().getValue(),
            new Timestamp(fieldPayDate.getComponent().getValue().getTime()),
            (BankInfo) fieldBankAccount.getSelectedItem().getValue());

    if (msg != null && msg.length() > 0) {
      FDialog.error(m_WindowNo, form, "SaveError", msg);
      return;
    }

    //  Ask to Post it
    if (!FDialog.ask(m_WindowNo, form, "VPaySelectGenerate?", "(" + m_ps.getName() + ")")) return;

    //  Prepare Process
    int AD_Proces_ID = 155; // 	C_PaySelection_CreatePayment

    //	Execute Process
    ProcessModalDialog dialog =
        new ProcessModalDialog(
            this,
            m_WindowNo,
            AD_Proces_ID,
            X_C_PaySelection.Table_ID,
            m_ps.getC_PaySelection_ID(),
            false);
    if (dialog.isValid()) {
      try {
        dialog.setWidth("500px");
        dialog.setVisible(true);
        dialog.setPage(form.getPage());
        dialog.doModal();
      } catch (SuspendNotAllowedException e) {
        log.log(Level.SEVERE, e.getLocalizedMessage(), e);
      } catch (InterruptedException e) {
        log.log(Level.SEVERE, e.getLocalizedMessage(), e);
      }
    }
  } //  generatePaySelect

  /** Lock User Interface Called from the Worker before processing */
  public void lockUI(ProcessInfo pi) {
    if (m_isLock) return;
    m_isLock = true;
    Clients.showBusy(null, true);
  } //  lockUI

  /** Unlock User Interface. Called from the Worker when processing is done */
  public void unlockUI(ProcessInfo pi) {
    if (!m_isLock) return;
    m_isLock = false;
    m_pi = pi;
    Clients.showBusy(null, false);

    // TODO: The response returned is always Cancel
    //		if (!FDialog.ask(0, form, "VPaySelectPrint?", "(" + m_pi.getSummary() + ")"))
    //		{
    //			dispose();
    //			return;
    //		}

    this.dispose();

    //  Start PayPrint
    int AD_Form_ID = 106; // 	Payment Print/Export
    ADForm form = SessionManager.getAppDesktop().openForm(AD_Form_ID);
    if (m_ps != null) {
      WPayPrint pp = (WPayPrint) form.getICustomForm();
      pp.setPaySelection(m_ps.getC_PaySelection_ID());
    }
  }

  public void executeASync(ProcessInfo pi) {}

  public boolean isUILocked() {
    return m_isLock;
  }

  public ADForm getForm() {
    return form;
  }
} //  VPaySelect
  /**
   * Static Setup - add fields to parameterPanel.
   *
   * <pre>
   * 		ResourceType	Resource	DateTimeFrom	DateTimeTo	New
   *  </pre>
   */
  private void statInit() {
    fieldFrom.setWidth("180px");
    fieldTo.setWidth("180px");

    bNew.addEventListener(Events.ON_CLICK, this);

    Grid grid = GridFactory.newGridLayout();

    Rows rows = new Rows();
    grid.appendChild(rows);

    Row row = new Row();
    rows.appendChild(row);
    row.appendChild(fieldResourceType.getLabel().rightAlign());
    row.appendChild(fieldResource.getLabel().rightAlign());
    row.appendChild(labelFrom.rightAlign());
    row.appendChild(labelTo.rightAlign());
    row.appendChild(new Label());

    row = new Row();
    rows.appendChild(row);
    row.appendChild(fieldResourceType.getComponent());
    row.appendChild(fieldResource.getComponent());
    Div div = new Div();
    div.setStyle("text-align: right;");
    div.appendChild(fieldFrom);
    row.appendChild(div);
    div = new Div();
    div.setStyle("text-align: right;");
    div.appendChild(fieldTo);
    row.appendChild(div);
    row.appendChild(bNew);

    layout = new Borderlayout();
    layout.setWidth("100%");
    layout.setHeight("100%");
    if (!isLookup()) {
      layout.setStyle("position: absolute");
    }
    this.appendChild(layout);

    North north = new North();
    layout.appendChild(north);
    north.appendChild(grid);

    Center center = new Center();
    layout.appendChild(center);
    div = new Div();
    div.appendChild(contentPanel);
    if (isLookup()) contentPanel.setWidth("99%");
    else contentPanel.setStyle("width: 99%; margin: 0px auto;");
    contentPanel.setVflex(true);
    div.setStyle("width :100%; height: 100%");
    center.appendChild(div);
    div.setVflex("1");
    div.setHflex("1");

    South south = new South();
    layout.appendChild(south);
    southBody = new Vbox();
    southBody.setWidth("100%");
    south.appendChild(southBody);
    southBody.appendChild(confirmPanel);
    southBody.appendChild(new Separator());
    southBody.appendChild(statusBar);
  }
예제 #4
0
  /** execute export action */
  public void export() {
    exporterMap = new HashMap<String, IGridTabExporter>();
    extensionMap = new HashMap<String, String>();
    List<IGridTabExporter> exporterList =
        EquinoxExtensionLocator.instance().list(IGridTabExporter.class).getExtensions();
    for (IGridTabExporter exporter : exporterList) {
      String extension = exporter.getFileExtension();
      if (!extensionMap.containsKey(extension)) {
        extensionMap.put(extension, exporter.getFileExtensionLabel());
        exporterMap.put(extension, exporter);
      }
    }

    if (winExportFile == null) {
      winExportFile = new Window();
      winExportFile.setTitle(
          Msg.getMsg(Env.getCtx(), "Export") + ": " + panel.getActiveGridTab().getName());
      winExportFile.setWidth("450px");
      winExportFile.setClosable(true);
      winExportFile.setBorder("normal");
      winExportFile.setStyle("position:absolute");
      winExportFile.setSclass("popup-dialog");
      winExportFile.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "exportAction");

      cboType.setMold("select");

      cboType.getItems().clear();
      for (Map.Entry<String, String> entry : extensionMap.entrySet()) {
        cboType.appendItem(entry.getKey() + " - " + entry.getValue(), entry.getKey());
      }

      cboType.setSelectedIndex(0);
      cboType.addActionListener(this);

      Vbox vb = new Vbox();
      vb.setWidth("100%");
      winExportFile.appendChild(vb);

      Vlayout vlayout = new Vlayout();
      vlayout.setSclass("dialog-content");
      vb.appendChild(vlayout);

      Grid grid = GridFactory.newGridLayout();
      vlayout.appendChild(grid);

      Columns columns = new Columns();
      Column column = new Column();
      column.setHflex("min");
      columns.appendChild(column);
      column = new Column();
      column.setHflex("1");
      columns.appendChild(column);
      grid.appendChild(columns);

      Rows rows = new Rows();
      grid.appendChild(rows);

      Row row = new Row();
      rows.appendChild(row);
      row.appendChild(new Label(Msg.getMsg(Env.getCtx(), "FilesOfType")));
      row.appendChild(cboType);
      cboType.setHflex("1");

      row = new Row();
      rows.appendChild(row);
      row.appendChild(new Space());
      chkCurrentRow.setLabel(Msg.getMsg(Env.getCtx(), "ExportCurrentRowOnly"));
      chkCurrentRow.setSelected(true);
      row.appendChild(chkCurrentRow);

      selectionTabRow = new Row();
      rows.appendChild(selectionTabRow);

      LayoutUtils.addSclass("dialog-footer", confirmPanel);
      vb.appendChild(confirmPanel);
      confirmPanel.addActionListener(this);
    }
    displayExportTabSelection();
    panel.getComponent().getParent().appendChild(winExportFile);
    panel.showBusyMask(winExportFile);
    LayoutUtils.openOverlappedWindow(panel.getComponent(), winExportFile, "middle_center");
    winExportFile.addEventListener(DialogEvents.ON_WINDOW_CLOSE, this);
    winExportFile.addEventListener("onExporterException", this);
  }
예제 #5
0
public class WPlanBook extends PlanBook
    implements IFormController, EventListener, ValueChangeListener {

  private CustomForm form = new CustomForm();
  private Borderlayout mainLayout = new Borderlayout();
  private Panel parameterPanel = new Panel();
  private Grid parameterLayout = GridFactory.newGridLayout();
  private Panel mainPanel = new Panel();

  private Label lGroup = new Label();
  private Label lBPartner = new Label();
  private Label lDateFrm = new Label();
  private Label lSubject = new Label();

  private WTableDirEditor fGroup = null;
  private WSearchEditor fBPartner = null;
  private WDateEditor fDateFrom = null;
  private WTableDirEditor fSubject = null;

  private Grid labelGrid = GridFactory.newGridLayout();

  private Label lDay = new Label(Msg.getMsg(Env.getCtx(), "Day"));
  private Label lUnit = new Label(Msg.getMsg(Env.getCtx(), "Unit"));
  private Label lLesson = new Label(Msg.getMsg(Env.getCtx(), "Lesson"));
  private Label lStage = new Label(Msg.getMsg(Env.getCtx(), "Stage"));
  private Label lActivity = new Label(Msg.getMsg(Env.getCtx(), "Activity"));
  private Label lHomework = new Label(Msg.getMsg(Env.getCtx(), "Homework"));
  private Label lValues = new Label(Msg.getMsg(Env.getCtx(), "Values"));
  private Label lComments = new Label(Msg.getMsg(Env.getCtx(), "Comments"));
  private Label lLink = new Label(Msg.getMsg(Env.getCtx(), "Link"));
  private Label lImage = new Label(Msg.getMsg(Env.getCtx(), "Image"));

  List<PlanBookDay> planDays = new ArrayList<PlanBookDay>();

  private Button bBack = new Button("<<");
  private Button bNext = new Button(">>");
  private Label lPeriod = new Label("1");
  private Panel periodControl = new Panel();

  private Button bSave = new Button(Msg.getMsg(Env.getCtx(), "Save"));

  public WPlanBook() {
    try {
      dynInit();
      zkInit();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  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);
    }
  }

  private void zkInit() {
    form.appendChild(mainLayout);
    mainLayout.setWidth("99%");
    mainLayout.setHeight("100%");

    parameterPanel.appendChild(parameterLayout);

    lGroup = new Label(Msg.getMsg(Env.getCtx(), "Group"));
    lBPartner = new Label(Msg.getMsg(Env.getCtx(), "Teacher"));
    lDateFrm = new Label(Msg.getMsg(Env.getCtx(), "Date"));
    lSubject = new Label(Msg.getMsg(Env.getCtx(), "Subject"));

    North north = new North();
    north.setStyle("border: none");
    mainLayout.appendChild(north);
    north.appendChild(parameterPanel);
    Rows rows = null;
    Row row = null;
    parameterLayout.setWidth("800px");
    rows = parameterLayout.newRows();
    row = rows.newRow();

    row.appendChild(lGroup);
    row.appendChild(fGroup.getComponent());
    row.appendChild(lBPartner);
    row.appendChild(fBPartner.getComponent());
    row = rows.newRow();
    row.appendChild(lDateFrm);
    row.appendChild(fDateFrom.getComponent());
    row.appendChild(lSubject);
    row.appendChild(fSubject.getComponent());

    row = rows.newRow();
    row.appendChild(new Space());

    row = rows.newRow();
    row.appendChild(new Space());
    row.appendChild(periodControl);

    Span span = new Span();
    span.setParent(periodControl);
    span.setStyle("height: 99%; display: inline-block; width: 20%;");
    span.appendChild(bBack);

    span = new Span();
    span.setParent(periodControl);
    span.setStyle("height: 99%; display: inline-block; width: 10%;");
    span.appendChild(lPeriod);

    span = new Span();
    span.setParent(periodControl);
    span.setStyle("height: 99%; display: inline-block; width: 20%;");
    span.appendChild(bNext);

    row.appendChild(new Space());
    row.appendChild(bSave);

    Center center = new Center();
    center.setFlex(true);
    center.appendChild(mainPanel);

    span = new Span();
    span.setParent(mainPanel);
    span.setStyle("height: 99%; display: inline-block; width: 10%;");
    span.appendChild(labelGrid);

    labelGrid.setWidth("90%");
    rows = labelGrid.newRows();

    row = rows.newRow();
    row.appendChild(new Space());
    row = rows.newRow();
    row.appendChild(new Space());
    row = rows.newRow();
    row.appendChild(lDay.rightAlign());
    row = rows.newRow();
    row.appendChild(new Space());
    row = rows.newRow();
    row.setHeight("35px");
    row.appendChild(lUnit.rightAlign());
    row = rows.newRow();
    row.setHeight("35px");
    row.appendChild(lLesson.rightAlign());
    row = rows.newRow();
    row.setHeight("35px");
    row.appendChild(lStage.rightAlign());
    row = rows.newRow();
    row.setHeight("35px");
    row.appendChild(lActivity.rightAlign());
    row = rows.newRow();
    row.setHeight("35px");
    row.appendChild(lHomework.rightAlign());
    row = rows.newRow();
    row.setHeight("35px");
    row.appendChild(lValues.rightAlign());
    row = rows.newRow();
    row.setHeight("35px");
    row.appendChild(lComments.rightAlign());
    row = rows.newRow();
    row.setHeight("35px");
    row.appendChild(lLink.rightAlign());
    row = rows.newRow();
    row.setHeight("35px");
    row.appendChild(lImage.rightAlign());

    for (PlanBookDay planDay : planDays) {
      span = new Span();
      span.setParent(mainPanel);
      span.setStyle("height: 99%; display: inline-block; width: 16%;");
      span.appendChild(planDay);
    }

    mainLayout.appendChild(center);
  }

  @Override
  public void onEvent(Event event) throws Exception {}

  @Override
  public ADForm getForm() {
    return form;
  }

  @Override
  public void valueChange(ValueChangeEvent evt) {
    // TODO Auto-generated method stub

  }

  class PlanBookDay extends Panel {
    private Grid fieldGrid = GridFactory.newGridLayout();
    Label lDate = new Label(new Timestamp(System.currentTimeMillis()).toLocaleString());
    Label lDayName = new Label("Monday");
    Label lDayNo = new Label("1");

    Textbox fUnit = new Textbox();
    Textbox fLesson = new Textbox();
    Textbox fStage = new Textbox();
    Textbox fActivity = new Textbox();
    Textbox fHomework = new Textbox();
    Textbox fValues = new Textbox();
    Textbox fComments = new Textbox();
    Textbox fLink = new Textbox();
    Textbox fImage = new Textbox();

    public PlanBookDay() {
      super();
      this.appendChild(fieldGrid);

      fieldGrid.setWidth("100%");
      Rows rows = fieldGrid.newRows();

      Row row = rows.newRow();
      row.appendChild(lDate);
      row = rows.newRow();
      row.appendChild(lDayName);
      row = rows.newRow();
      row.appendChild(lDayNo);
      row = rows.newRow();
      row.appendChild(new Space());
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fUnit);
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fLesson);
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fStage);
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fActivity);
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fHomework);
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fValues);
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fComments);
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fLink);
      row = rows.newRow();
      row.setHeight("35px");
      row.appendChild(fImage);
    }
  }
}
  private void initLayout() {
    txtDocumentNo.setWidth("100%");
    txtDescription.setWidth("100%");
    txtOrderRef.setWidth("100%");
    dateFrom.setWidth("165px");
    dateTo.setWidth("165px");
    amountFrom.getDecimalbox().setWidth("155px");
    amountTo.getDecimalbox().setWidth("155px");

    Grid grid = GridFactory.newGridLayout();

    Rows rows = new Rows();
    grid.appendChild(rows);

    Row row = new Row();
    rows.appendChild(row);
    row.appendChild(lblDocumentNo.rightAlign());
    row.appendChild(txtDocumentNo);
    row.appendChild(editorBPartner.getLabel().rightAlign());
    row.appendChild(editorBPartner.getComponent());
    row.appendChild(isSoTrx);

    row = new Row();
    row.setSpans("1, 1, 1, 2");
    rows.appendChild(row);
    row.appendChild(lblDescription.rightAlign());
    row.appendChild(txtDescription);
    row.appendChild(lblDateOrdered.rightAlign());
    Hbox hbox = new Hbox();
    hbox.appendChild(dateFrom);
    hbox.appendChild(new Label("-"));
    hbox.appendChild(dateTo);
    row.appendChild(hbox);

    row = new Row();
    row.setSpans("1, 1, 1, 2");
    rows.appendChild(row);
    row.appendChild(lblOrderRef.rightAlign());
    row.appendChild(txtOrderRef);
    row.appendChild(lblGrandTotal.rightAlign());
    hbox = new Hbox();
    hbox.appendChild(amountFrom);
    hbox.appendChild(new Label("-"));
    hbox.appendChild(amountTo);
    row.appendChild(hbox);

    layout = new Borderlayout();
    layout.setWidth("100%");
    layout.setHeight("100%");
    if (!isLookup()) {
      layout.setStyle("position: absolute");
    }
    this.appendChild(layout);

    North north = new North();
    layout.appendChild(north);
    north.appendChild(grid);

    Center center = new Center();
    layout.appendChild(center);
    center.setFlex(true);
    Div div = new Div();
    div.appendChild(contentPanel);
    if (isLookup()) contentPanel.setWidth("99%");
    else contentPanel.setStyle("width: 99%; margin: 0px auto;");
    contentPanel.setVflex(true);
    div.setStyle("width :100%; height: 100%");
    center.appendChild(div);

    South south = new South();
    layout.appendChild(south);
    southBody = new Vbox();
    southBody.setWidth("100%");
    south.appendChild(southBody);
    southBody.appendChild(confirmPanel);
    southBody.appendChild(new Separator());
    southBody.appendChild(statusBar);
  }
예제 #7
0
  /**
   * Init Main Panel
   *
   * @return void
   */
  private void initMainPanel() {
    //	Instance Panel
    //
    Panel buttonsPanel = new Panel();
    Rows rows = null;
    Row row = null;
    South north = new South();

    northPanel = new Panel();
    mainLayout = new Borderlayout();
    north.setStyle("border: none");
    mainLayout.appendChild(north);
    north.appendChild(northPanel);
    Grid productLayout = GridFactory.newGridLayout();
    northPanel.appendChild(productLayout);
    rows = productLayout.newRows();
    row = rows.newRow();
    buttonsPanel.setAlign("Center");
    row.setHeight("65px");
    row.setSpans("6");

    buttonNew = createButtonAction("New", KeyStroke.getKeyStroke(KeyEvent.VK_N, 0));
    buttonNew.setId("New");
    buttonsPanel.appendChild(buttonNew);
    buttonNew.addActionListener(this);

    buttonEdit = createButtonAction("Edit", KeyStroke.getKeyStroke(KeyEvent.VK_N, 0));
    buttonEdit.setId("Edit");
    buttonsPanel.appendChild(buttonEdit);
    buttonEdit.addActionListener(this);

    buttonReset = createButtonAction("Reset", KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
    buttonsPanel.appendChild(buttonReset);
    buttonReset.setId("Reset");
    buttonRefresh = createButtonAction("Refresh", KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
    buttonsPanel.appendChild(buttonRefresh);
    buttonRefresh.setId("Refresh");

    buttonOk = createButtonAction("Ok", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
    buttonsPanel.appendChild(buttonOk);
    buttonOk.setId("Ok");
    buttonCancel = createButtonAction("Cancel", KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
    buttonsPanel.appendChild(buttonCancel);
    buttonCancel.setId("Cancel");
    buttonOk.setTooltiptext(Msg.translate(ctx, "Ok"));
    buttonCancel.setTooltiptext(Msg.translate(ctx, "Cancel"));
    buttonOk.setTooltiptext(Msg.translate(ctx, "Ok"));
    buttonCancel.setTooltiptext(Msg.translate(ctx, "Cancel"));
    buttonNew.setTooltiptext(Msg.translate(ctx, "New"));
    buttonEdit.setTooltiptext(Msg.translate(ctx, "Edit"));
    buttonRefresh.setTooltiptext(Msg.translate(ctx, "Refresh"));
    row.appendChild(buttonsPanel);
    //	Center
    posTable = new WListbox();

    posTable.addActionListener(this);
    //	Visible New
    buttonNew.setVisible(false);
    buttonEdit.setVisible(false);
    buttonEdit.setEnabled(false);
  }