@Override protected void setup() { Locale locale = new Locale("fi", "FI"); Calendar cal = Calendar.getInstance(); cal.set(2010, 0, 1); DateField df = new DateField(); df.setResolution(Resolution.DAY); df.setLocale(locale); df.setWidth("300px"); String pattern = "d. MMMM'ta 'yyyy 'klo 'H.mm.ss"; df.setDateFormat(pattern); df.setValue(cal.getTime()); addComponent(df); }
@AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("650px"); mainLayout.setHeight("220px"); mainLayout.setMargin(true); // top-level component properties setWidth("650px"); setHeight("220px"); // jobGroupField jobGroupField = new TextField(); jobGroupField.setCaption("Grupo"); jobGroupField.setImmediate(false); jobGroupField.setWidth("140px"); jobGroupField.setHeight("-1px"); jobGroupField.setRequired(true); mainLayout.addComponent(jobGroupField, "top:20.0px;left:180.0px;"); // jobIntervalField jobIntervalField = new TextField(); jobIntervalField.setCaption("Intervalo"); jobIntervalField.setImmediate(false); jobIntervalField.setWidth("60px"); jobIntervalField.setHeight("-1px"); mainLayout.addComponent(jobIntervalField, "top:180.0px;left:20.0px;"); // jobNameField jobNameField = new TextField(); jobNameField.setCaption("Nombre"); jobNameField.setImmediate(false); jobNameField.setWidth("140px"); jobNameField.setHeight("-1px"); jobNameField.setRequired(true); mainLayout.addComponent(jobNameField, "top:20.0px;left:20.0px;"); // jobTriggerPriorityField jobTriggerPriorityField = new TextField(); jobTriggerPriorityField.setCaption("Job Trigger Priority"); jobTriggerPriorityField.setImmediate(false); jobTriggerPriorityField.setWidth("160px"); jobTriggerPriorityField.setHeight("-1px"); mainLayout.addComponent(jobTriggerPriorityField, "top:140.0px;left:200.0px;"); // jobTriggerTypeField jobTriggerTypeField = new ComboBox(); jobTriggerTypeField.setCaption("Tipo Disparador"); jobTriggerTypeField.setImmediate(true); jobTriggerTypeField.setWidth("160px"); jobTriggerTypeField.setHeight("-1px"); jobTriggerTypeField.setRequired(true); mainLayout.addComponent(jobTriggerTypeField, "top:140.0px;left:20.0px;"); // cronExpressionField cronExpressionField = new TextField(); cronExpressionField.setCaption("Expresión Cron "); cronExpressionField.setImmediate(false); cronExpressionField.setWidth("340px"); cronExpressionField.setHeight("-1px"); mainLayout.addComponent(cronExpressionField, "top:180.0px;left:20.0px;"); // descriptionField descriptionField = new TextField(); descriptionField.setCaption("Descripción"); descriptionField.setImmediate(false); descriptionField.setWidth("620px"); descriptionField.setHeight("-1px"); mainLayout.addComponent(descriptionField, "top:100.0px;left:20.0px;"); // endTimeField endTimeField = new DateField(); endTimeField.setCaption("Fecha Finalización"); endTimeField.setImmediate(false); endTimeField.setWidth("-1px"); endTimeField.setHeight("-1px"); endTimeField.setInvalidAllowed(false); mainLayout.addComponent(endTimeField, "top:60.0px;left:225.0px;"); // futureField futureField = new CheckBox(); futureField.setCaption("Futuro"); futureField.setImmediate(false); futureField.setWidth("-1px"); futureField.setHeight("-1px"); mainLayout.addComponent(futureField, "top:140.0px;left:585.0px;"); // future_timeField future_timeField = new TextField(); future_timeField.setCaption("Future_time"); future_timeField.setImmediate(false); future_timeField.setWidth("160px"); future_timeField.setHeight("-1px"); mainLayout.addComponent(future_timeField, "top:140.0px;left:400.0px;"); // repeatCountField repeatCountField = new TextField(); repeatCountField.setCaption("Repeticiones"); repeatCountField.setImmediate(false); repeatCountField.setWidth("60px"); repeatCountField.setHeight("24px"); mainLayout.addComponent(repeatCountField, "top:180.0px;right:290.0px;"); // startTimeField startTimeField = new DateField(); startTimeField.setCaption("Fecha Comienzo"); startTimeField.setImmediate(false); startTimeField.setWidth("-1px"); startTimeField.setHeight("-1px"); startTimeField.setInvalidAllowed(false); mainLayout.addComponent(startTimeField, "top:60.0px;left:20.0px;"); // areaField areaField = new ComboBox(); areaField.setCaption("Area Trabajo"); areaField.setImmediate(false); areaField.setWidth("-1px"); areaField.setHeight("-1px"); areaField.setRequired(true); mainLayout.addComponent(areaField, "top:60.0px;left:420.0px;"); // jobCalendarField jobCalendarField = new JobTriggerCalendarField(); jobCalendarField.setImmediate(false); jobCalendarField.setWidth("-1px"); jobCalendarField.setHeight("-1px"); mainLayout.addComponent(jobCalendarField, "top:167.0px;left:397.0px;"); // jobIntervalTypeField jobIntervalTypeField = new ComboBox(); jobIntervalTypeField.setCaption("Tipo Intervalo"); jobIntervalTypeField.setImmediate(false); jobIntervalTypeField.setWidth("175px"); jobIntervalTypeField.setHeight("-1px"); mainLayout.addComponent(jobIntervalTypeField, "top:180.0px;left:100.0px;"); return mainLayout; }
public DateFields() { setMargin(true); Label h1 = new Label("Date Fields"); h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); DateField date = new DateField("Default resolution"); setDate(date); row.addComponent(date); date = new DateField("Error"); setDate(date); date.setComponentError(new UserError("Fix it, now!")); row.addComponent(date); date = new DateField("Error, borderless"); setDate(date); date.setComponentError(new UserError("Fix it, now!")); date.addStyleName(ValoTheme.DATEFIELD_BORDERLESS); row.addComponent(date); CssLayout group = new CssLayout(); group.setCaption("Grouped with a Button"); group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); row.addComponent(group); final DateField date2 = new DateField(); group.addComponent(date2); Button today = new Button( "Today", new ClickListener() { @Override public void buttonClick(ClickEvent event) { date2.setValue(new Date()); } }); group.addComponent(today); date = new DateField("Default resolution, explicit size"); setDate(date); row.addComponent(date); date.setWidth("260px"); date.setHeight("60px"); date = new DateField("Second resolution"); setDate(date); date.setResolution(Resolution.SECOND); row.addComponent(date); date = new DateField("Minute resolution"); setDate(date); date.setResolution(Resolution.MINUTE); row.addComponent(date); date = new DateField("Hour resolution"); setDate(date); date.setResolution(Resolution.HOUR); row.addComponent(date); date = new DateField("Disabled"); setDate(date); date.setResolution(Resolution.HOUR); date.setEnabled(false); row.addComponent(date); date = new DateField("Day resolution"); setDate(date); date.setResolution(Resolution.DAY); row.addComponent(date); date = new DateField("Month resolution"); setDate(date); date.setResolution(Resolution.MONTH); row.addComponent(date); date = new DateField("Year resolution"); setDate(date); date.setResolution(Resolution.YEAR); row.addComponent(date); date = new DateField("Custom color"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("color1"); row.addComponent(date); date = new DateField("Custom color"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("color2"); row.addComponent(date); date = new DateField("Custom color"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("color3"); row.addComponent(date); date = new DateField("Small"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName(ValoTheme.DATEFIELD_SMALL); row.addComponent(date); date = new DateField("Large"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName(ValoTheme.DATEFIELD_LARGE); row.addComponent(date); date = new DateField("Borderless"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName(ValoTheme.DATEFIELD_BORDERLESS); row.addComponent(date); date = new DateField("Week numbers"); setDate(date); date.setResolution(Resolution.DAY); date.setLocale(new Locale("fi", "fi")); date.setShowISOWeekNumbers(true); row.addComponent(date); date = new DateField("US locale"); setDate(date); date.setResolution(Resolution.SECOND); date.setLocale(new Locale("en", "US")); row.addComponent(date); date = new DateField("Custom format"); setDate(date); date.setDateFormat("E dd/MM/yyyy"); row.addComponent(date); date = new DateField("Tiny"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName(ValoTheme.DATEFIELD_TINY); row.addComponent(date); date = new DateField("Huge"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName(ValoTheme.DATEFIELD_HUGE); row.addComponent(date); date = new InlineDateField("Date picker"); setDate(date); setDateRange(date); row.addComponent(date); date = new InlineDateField("Date picker with week numbers"); setDate(date); date.setLocale(new Locale("fi", "fi")); date.setShowISOWeekNumbers(true); row.addComponent(date); PropertysetItem item = new PropertysetItem(); item.addItemProperty("date", new ObjectProperty<Date>(getDefaultDate())); FormLayout form = new FormLayout(); form.setMargin(false); FieldGroup binder = new FieldGroup(item); form.addComponent(binder.buildAndBind("Picker in read-only field group", "date")); binder.setReadOnly(true); row.addComponent(form); }
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")); }
@Override public void init() { buttonCancel = new Button("Batalkan"); buttonCancel.addClickListener(this); buttonShow = new Button("Tampilkan Laporan"); buttonShow.addClickListener(this); buttonPrint = new Button("Cetak"); buttonPrint.addClickListener(this); buttonPrint.setIcon(new ThemeResource("icons/image/icon-print.png")); opener = new BrowserWindowOpener(ReportPrint.class); opener.setFeatures("height=200,width=400,resizable"); // A button to open the printer-friendly page. opener.extend(buttonPrint); DateTime now = DateTime.now(); Date beginYear = now.withDayOfYear(now.dayOfYear().getMinimumValue()) .withHourOfDay(now.hourOfDay().getMinimumValue()) .toDate(); Date endYear = now.withDayOfYear(now.dayOfYear().getMaximumValue()) .withHourOfDay(now.hourOfDay().getMaximumValue()) .toDate(); selectStartDate = new DateField("Dari Tanggal"); selectStartDate.setImmediate(true); selectStartDate.setWidth(function.FORM_WIDTH); selectStartDate.setValue(beginYear); selectEndDate = new DateField("Hingga Tanggal"); selectEndDate.setImmediate(true); selectEndDate.setWidth(function.FORM_WIDTH); selectEndDate.setValue(endYear); selectAcceptance = new OptionGroup("Persetujuan"); Item itemType1 = selectAcceptance.addItem("diterima"); Item itemType2 = selectAcceptance.addItem("belumditerima"); selectAcceptance.setImmediate(true); selectAcceptance.setValue("diterima"); selectAcceptance.setItemCaption("diterima", "Barang Kadaluarsa Disetujui"); selectAcceptance.setItemCaption("belumditerima", "Barang Kadaluarsa Belum Disetujui"); selectContent = new ComboBox("Pilih Tampilan"); selectContent.setImmediate(true); selectContent.addItem(ReportContent.CHART); selectContent.addItem(ReportContent.TABLE); selectContent.addItem(ReportContent.TABLE_CHART); selectContent.setItemCaption(ReportContent.CHART, "Tampilkan Chart"); selectContent.setItemCaption(ReportContent.TABLE, "Tampilkan Tabel"); selectContent.setItemCaption(ReportContent.TABLE_CHART, "Tampilkan Tabel dan Chart"); selectContent.setItemCaption(4, "Minggu Ke-4"); selectContent.setValue(ReportContent.TABLE); selectAcceptance.addValueChangeListener(this); selectStartDate.addValueChangeListener(this); selectEndDate.addValueChangeListener(this); selectContent.addValueChangeListener(this); updateWindowOpener(); construct(); }