Exemple #1
0
  /** Tests if setting the footer visibility works properly */
  public void testFooterVisibility() {
    Table table = new Table("Test table", createContainer());

    // The footer should by default be hidden
    assertFalse(table.isFooterVisible());

    // Set footer visibility to tru should be reflected in the
    // isFooterVisible() method
    table.setFooterVisible(true);
    assertTrue(table.isFooterVisible());
  }
  public Table buildTable(TimingsTableDataHolder holder) {
    Table table = new Table();
    table.setWidth("100%");
    table.setPageLength(0);
    table.addStyleName("pq");
    table.setSortEnabled(false);
    table.setFooterVisible(true);
    table.setColumnCollapsingAllowed(true);
    table.setColumnCollapsible(columnNames[0], false);
    table.setColumnCollapsible(columnNames[1], false);
    table.setColumnCollapsible(columnNames[3], false);

    table.setColumnAlignment(columnNames[0], Table.Align.LEFT);
    for (String name : columnNames) {
      table.addContainerProperty(name, String.class, null);
      table.setColumnExpandRatio(name, 2);
    }
    fillTable(table, holder.getTotal(), holder.getRows());

    return table;
  }
  public void initComponent() {

    tableList =
        new Table() {
          @Override
          protected String formatPropertyValue(Object rowId, Object colId, Property property) {
            // Format by property type
            if (property.getType() == Date.class && property.getValue() != null) {
              SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
              return df.format((Date) property.getValue());
            }

            //		        if (property.getType()==Boolean.class){
            //		        	if ((Boolean) property.getValue()==true) {
            //		        		return "Active";
            //		        	} else {
            //		        		return "-";
            //		        	}
            //		        }

            return super.formatPropertyValue(rowId, colId, property);
          }
        };
    tableDetil =
        new Table() {
          @Override
          protected String formatPropertyValue(Object rowId, Object colId, Property property) {
            // Format by property type
            if (property.getType() == Date.class && property.getValue() != null) {
              SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
              return df.format((Date) property.getValue());
            }

            //		        if (property.getType()==Boolean.class){
            //		        	if ((Boolean) property.getValue()==true) {
            //		        		return "Active";
            //		        	} else {
            //		        		return "-";
            //		        	}
            //		        }

            return super.formatPropertyValue(rowId, colId, property);
          }
        };

    // ::LIST
    fieldSearch1.setWidth("100px");
    fieldSearch2.setWidth("100px");
    fieldSearch2.setWidth("100px");
    comboSearch1.setWidth("200px");
    comboSearch2.setWidth("200px");

    // ::DETIL
    fieldNomor.setNullRepresentation("");
    fieldInvoiceno.setNullRepresentation("");

    fieldNomor.setWidth("100px");
    fieldInvoiceno.setWidth("100px");
    comboTipeopname.setWidth("200px");
    comboTipeopname.setFilteringMode(FilteringMode.CONTAINS);
    comboWarehouse.setWidth("200px");
    comboWarehouse.setFilteringMode(FilteringMode.CONTAINS);

    dateFieldTrdate.setDateFormat("dd/MM/yyyy");
    dateFieldEntrydate.setDateFormat("dd/MM/yyyy");
    dateFieldTrdate.setWidth("100px");
    dateFieldEntrydate.setWidth("100px");

    btnSearch.setIcon(new ThemeResource("../images/navigation/12x12/Find.png"));
    btnNewForm.setIcon(new ThemeResource("../images/navigation/12x12/Create.png"));
    btnEditForm.setIcon(new ThemeResource("../images/navigation/12x12/Pencil.png"));
    btnDeleteForm.setIcon(new ThemeResource("../images/navigation/12x12/Erase.png"));
    //		btnPrint.setIcon(new ThemeResource("../images/navigation/12x12/Print.png"));

    btnSaveForm.setIcon(new ThemeResource("../images/navigation/12x12/Save.png"));
    btnCancelForm.setIcon(new ThemeResource("../images/navigation/12x12/Undo.png"));

    btnAddItem.setIcon(new ThemeResource("../images/navigation/12x12/Create.png"));
    btnEditForm.setIcon(new ThemeResource("../images/navigation/12x12/Pencil.png"));
    btnRemoveItem.setIcon(new ThemeResource("../images/navigation/12x12/Erase.png"));

    btnPosting.setIcon(new ThemeResource("../images/navigation/12x12/OK.png"));
    //		btnPostingBatal.setIcon(new ThemeResource("../images/navigation/12x12/OK.png"));
    btnLapselisih.setIcon(new ThemeResource("../images/navigation/12x12/Print.png"));

    tableList.setSelectable(true);
    tableList.setImmediate(true);
    tableList.setBuffered(false);
    tableList.setFooterVisible(true);

    tableDetil.setSelectable(true);
    tableDetil.setImmediate(true);
    tableDetil.setBuffered(false);
    tableDetil.setFooterVisible(true);

    // VALIDATOR
    fieldNomor.setRequired(true);
    comboTipeopname.setRequired(true);
    comboWarehouse.setRequired(true);
    dateFieldTrdate.setRequired(true);
    //		fieldDescription.setRequired(true);

    btnSeparator1.setEnabled(false);
    btnSeparator2.setEnabled(false);

    // FIELD FOOTER
    fieldDisc1 = new TextField();
    fieldDisc1rp = new TextField();
    fieldDisc1rpafterppn = new TextField();
    fieldDisc1.setWidth("50px");
    fieldDisc1rp.setWidth("50px");
    fieldDisc1rpafterppn.setWidth("150px");
    fieldDisc1rpafterppn.addStyleName("numerical");

    fieldDisc2 = new TextField();
    fieldDisc2rp = new TextField();
    fieldDisc2rpafterppn = new TextField();
    fieldDisc2.setWidth("50px");
    fieldDisc2rp.setWidth("50px");
    fieldDisc2rpafterppn.setWidth("150px");
    fieldDisc2rpafterppn.addStyleName("numerical");

    fieldDisc = new TextField();
    fieldDiscrp = new TextField();
    fieldDiscrpafterppn = new TextField();
    fieldDisc.setWidth("50px");
    fieldDiscrp.setWidth("50px");
    fieldDiscrpafterppn.setWidth("150px");
    fieldDiscrpafterppn.addStyleName("numerical");

    fieldAmount.setWidth("200px");
    fieldAmount.addStyleName("numerical");
    fieldAmountafterdisc.setWidth("200px");
    fieldAmountafterdisc.addStyleName("numerical");
    fieldAmountafterdiscafterppn.setWidth("200px");
    fieldAmountafterdiscafterppn.addStyleName("numerical");
    fieldAmountafterppn.setWidth("200px");
    fieldAmountafterppn.addStyleName("numerical");
    fieldAmountpay.setWidth("200px");
    fieldAmountpay.addStyleName("numerical");
    fieldAmountpayfaterppn.setWidth("200px");
    fieldAmountpayfaterppn.addStyleName("numerical");
    fieldPpnrp.setWidth("200px");
    fieldPpnrp.addStyleName("numerical");

    fieldPpnpercent.setWidth("50px");
  }
  public void initComponent() {
    table =
        new Table() {
          @Override
          protected String formatPropertyValue(Object rowId, Object colId, Property property) {
            // Format by property type
            try {
              if (property.getType() == Date.class && property.getValue() != null) {
                SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
                return df.format((Date) property.getValue());
              }
            } catch (Exception ex) {
            }

            try {
              if (property.getType() == Boolean.class) {
                if ((Boolean) property.getValue() == true) {
                  return "CLOSE";
                } else {
                  return "-";
                }
              }
            } catch (Exception ex) {
            }

            return super.formatPropertyValue(rowId, colId, property);
          }
        };

    // Inisialisasi Panel
    setSizeFull();
    content.setSizeFull();
    content.setMargin(true);

    // INIT COMPONENT TENGAH
    table.setSizeFull();
    table.setSelectable(true);
    table.setImmediate(true);
    table.setBuffered(false);
    table.setFooterVisible(true);

    // INIT COMPONENT ATAS
    btnSeparator1.setEnabled(false);
    btnSeparator2.setEnabled(false);

    //		fieldSearchByRekap = new TextField("NO. REKAP");
    fieldSearchById = new TextField("NO. REKAP");
    fieldSearchById.setInputPrompt("NO. REKAP");
    fieldSearchById.setStyleName(Reindeer.TEXTFIELD_SMALL);
    fieldSearchById.setWidth("120px");

    //		fieldSearchByInvoice = new TextField("INVOICE");
    comboSearchByDivision = new ComboBox("DIVISION");
    comboSearchByDivision.setInputPrompt("DIVISION");
    comboSearchByDivision.setStyleName(Reindeer.TEXTFIELD_SMALL);
    comboSearchByDivision.setWidth("120px");

    dateFieldSearchByTransdateFrom = new DateField("INV FROM");
    dateFieldSearchByTransdateFrom.setStyleName(Reindeer.TEXTFIELD_SMALL);
    dateFieldSearchByTransdateFrom.setWidth("120px");

    dateFieldSearchByTransdateTo = new DateField("INV TO");
    dateFieldSearchByTransdateTo.setStyleName(Reindeer.TEXTFIELD_SMALL);
    dateFieldSearchByTransdateTo.setWidth("120px");

    btnSearch.setStyleName(Reindeer.BUTTON_SMALL);

    btnSearch.setIcon(new ThemeResource("images/navigation/12x12/Find.png"));
    btnSelect.setIcon(new ThemeResource("images/navigation/16x16/OK.png"));
  }