private void initComponents() { articuloModel = new ValueHolder(); año = new JXDatePicker(); año.setFormats(new String[] {"yyyy"}); mes = new JXDatePicker(); mes.setFormats(new String[] {"MM"}); }
static Collection<String> selectImages( BundleContext ctx, Window parentWindow, final PhotoIterable sourceIterable, JXDatePicker parentFromDP, JXDatePicker parentToDP, Collection<String> initialSelection) { SelectImageDialog dialog = new SelectImageDialog( parentWindow, ctx, sourceIterable, parentFromDP.getDate(), parentToDP.getDate(), initialSelection); dialog.setLocationByPlatform(true); dialog.setModal(true); dialog.loadImagesAsync(); dialog.setVisible(true); if (!dialog.cancelled) { parentFromDP.setDate(dialog.fromDP.getDate()); parentToDP.setDate(dialog.toDP.getDate()); return dialog.getSelectedImages(parentWindow); } else { return null; } }
/** Called in order to adjust the route start time and the UI accordingly */ private void adjustStartTime() { // Stop widget listeners boolean wasQuiescent = quiescent; quiescent = true; // Get start time or default now if (!readOnlyRoute) { route.adjustStartTime(); } Date starttime = route.getStarttime(); departurePicker.setDate(starttime); departureSpinner.setValue(starttime); // Attempt to get ETA (only possible if GPS data is available) Date etaStart = route.getEta(starttime); if (etaStart != null) { // GPS data available. arrivalPicker.setDate(etaStart); arrivalSpinner.setValue(etaStart); } else { // No GPS data available. // Find the default ETA. Date defaultEta = route.getEtas().get(route.getEtas().size() - 1); arrivalPicker.setDate(defaultEta); arrivalSpinner.setValue(defaultEta); } // Recalculate and update route fields updateFields(); // Restore the quiescent state quiescent = wasQuiescent; }
private void viewReport() throws Exception { Date fromDate = fromDatePicker.getDate(); Date toDate = toDatePicker.getDate(); if (fromDate.after(toDate)) { POSMessageDialog.showError( com.floreantpos.util.POSUtil.getFocusedWindow(), com.floreantpos.POSConstants.FROM_DATE_CANNOT_BE_GREATER_THAN_TO_DATE_); return; } fromDate = DateUtil.startOfDay(fromDate); toDate = DateUtil.endOfDay(toDate); ReportService reportService = new ReportService(); JournalReportModel report = reportService.getJournalReport(fromDate, toDate); HashMap<String, Object> map = new HashMap<String, Object>(); map.put("reportTitle", "========= JOURNAL REPORT =========="); map.put("fromDate", ReportService.formatShortDate(fromDate)); map.put("toDate", ReportService.formatShortDate(toDate)); map.put("reportTime", ReportService.formatFullDate(new Date())); JasperReport jasperReport = ReportUtil.getReport("journal_report"); JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, map, new JRTableModelDataSource(report.getTableModel())); JRViewer viewer = new JRViewer(jasperPrint); reportContainer.removeAll(); reportContainer.add(viewer); reportContainer.revalidate(); }
// This method used to load service bill details between the date range public void load_sbd_bw_date_range() { List<Object[]> bill_details = dbh.get_bill_details_between_date_range( jdp_from.getDate().toString(), jdp_to.getDate().toString()); load_service_bill_details(bill_details); calculate_total(); }
private void init(String format) { jxdDate = new org.jdesktop.swingx.JXDatePicker(); jxdDate .getEditor() .setFormatterFactory( new javax.swing.text.DefaultFormatterFactory( new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat(format)))); jxdDate.addActionListener(this); jxdDate .getEditor() .addKeyListener( new java.awt.event.KeyAdapter() { @Override public void keyReleased(KeyEvent e) { if (e.getKeyCode() == java.awt.event.KeyEvent.VK_DELETE) jxdDate.getEditor().setText(""); } }); jxdDate .getEditor() .addMouseListener( new java.awt.event.MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (e.getButton() != java.awt.event.MouseEvent.BUTTON1) jxdDate.getEditor().setText(""); } }); }
@Override public void doApply() { super.doApply(); parametros.put("FECHA_INI", fechaInicial.getDate()); parametros.put("FECHA_FIN", fechaFinal.getDate()); String suc = String.valueOf(getSucursal()); if (todasLasSucursales.isSelected()) suc = "%"; if (suc.equals("6")) { parametros.put("EXI_SUCURSAL", " and X.SUCURSAL_ID in(6,11)"); } else if (suc.equals("9")) { parametros.put("EXI_SUCURSAL", " and X.SUCURSAL_ID in(9,14)"); } else { parametros.put("EXI_SUCURSAL", " and X.SUCURSAL_ID LIKE " + "\'" + suc + "\'"); } parametros.put("SUCURSAL", suc); parametros.put("LINEA", getLinea()); int order = getOrden(); parametros.put("ORDEN", String.valueOf(order)); parametros.put("FORMA", getForma()); parametros.put("MESES", getMeses()); parametros.put("FILTRO", getParam(filtrosBox).value); parametros.put("FILTRADO", getParam(filtrosBox).name); parametros.put("MESESF", (Double) mesesF.getValue()); parametros.put("DELINEA", getParam(filtro2Box).value); }
private void viewReport() throws Exception { Date fromDate = fromDatePicker.getDate(); Date toDate = toDatePicker.getDate(); if (fromDate.after(toDate)) { POSMessageDialog.showError( BackOfficeWindow.getInstance(), com.floreantpos.POSConstants.FROM_DATE_CANNOT_BE_GREATER_THAN_TO_DATE_); return; } fromDate = DateUtil.startOfDay(fromDate); toDate = DateUtil.endOfDay(toDate); ReportService reportService = new ReportService(); MenuUsageReport report = reportService.getMenuUsageReport(fromDate, toDate); HashMap<String, Object> map = new HashMap<String, Object>(); map.put("reportTitle", "========= LAPORAN PENJUALAN PER MENU =========="); map.put("fromDate", ReportService.formatShortDate(fromDate)); map.put("toDate", ReportService.formatShortDate(toDate)); map.put("reportTime", ReportService.formatFullDate(new Date())); JasperReport jasperReport = (JasperReport) JRLoader.loadObject( getClass().getResource("/com/floreantpos/ui/report/menu_usage_report.jasper")); JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, map, new JRTableModelDataSource(report.getTableModel())); JRViewer viewer = new JRViewer(jasperPrint); reportContainer.removeAll(); reportContainer.add(viewer); reportContainer.revalidate(); }
public void calcularComissao() throws ParseException { SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); try { Date data1 = dateInicio.getDate(); Date data2 = dateFim.getDate(); if (CalcularData.TirarDiferenca(data1, data2) < 0) { JOptionPane.showMessageDialog( null, "As datas devem ser iguais ou a data final ser superior a data inicial!"); } else { objPed = pedDao.comissaoTotalPedido( Integer.parseInt(textField.getText()), df.parse(dateInicio.getEditor().getText()), df.parse(dateFim.getEditor().getText())); total = objPed.getTotalPedido(); porCentCom = Double.parseDouble(textField_2.getText()); totalCom = (total * porCentCom) / 100; JOptionPane.showMessageDialog(null, "Comissão calculada!" + "\nR$ " + totalCom); textField_2.setText(String.valueOf(totalCom)); } } catch (NumberFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (DaoException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
private JXDatePicker createDatePicker(Date initialDate) { final JXDatePicker dp = new JXDatePicker(initialDate); dp.setFormats(PhotoCopyToolPanel.DATE_PICKER_FORMAT); dp.setEditable(true); dp.addActionListener( new ActionListener() { long lastTime = dp.getDate() == null ? -1 : dp.getDate().getTime(); @Override public void actionPerformed(ActionEvent e) { Date d = dp.getDate(); long t = -1; if (d != null) t = d.getTime(); if (t != lastTime) { lastTime = t; if (imagesLoaded) selection = getSelectedImages(SelectImageDialog.this); loadImagesAsync(); } } }); dp.getEditor() .addFocusListener( new FocusAdapter() { @Override public void focusLost(FocusEvent e) { try { dp.commitEdit(); } catch (ParseException pe) { } } }); return dp; }
public List<Poliza> findData() { Periodo p = new Periodo(datePicker.getDate(), datePicker2.getDate()); Poliza res = ServiceLocator2.getComprasDeGastosManager().generarPolizaDeProvision(p); res.setFecha(p.getFechaFinal()); List<Poliza> list = new ArrayList<Poliza>(); list.add(res); return list; }
@Override public void doApply() { super.doApply(); parametros.put("FECHA_INI", fechaInicial.getDate()); parametros.put("FECHA_FIN", fechaFinal.getDate()); ChoferFacturista ch = (ChoferFacturista) choferes.getSelectedItem(); if (ch != null) parametros.put("FAC_ID", ch.getId()); logger.info("Parametros de reporte:" + parametros); }
/** * Given a new arrival date, re-calculate the speed * * @param arrivalDate the new arrival date */ private void recalculateSpeeds(Date arrivalDate) { // Stop widget listeners boolean wasQuiescent = quiescent; quiescent = true; // Special case if the arrival date is before the start time if (route.getStarttime().after(arrivalDate)) { // Reset arrival to a valid time arrivalPicker.setDate(route.getEta()); arrivalSpinner.setValue(route.getEta()); quiescent = wasQuiescent; return; } // Total distance Dist distanceToTravel = new Dist(DistType.NAUTICAL_MILES, route.getRouteDtg()); // And we want to get there in milliseconds: Time timeToTravel = new Time(TimeType.MILLISECONDS, arrivalDate.getTime() - route.getStarttime().getTime()); // Subtract the distance and time from the locked way points for (int i = 0; i < route.getWaypoints().size() - 1; i++) { if (locked[i]) { distanceToTravel = distanceToTravel.subtract(new Dist(DistType.NAUTICAL_MILES, route.getWpRng(i))); timeToTravel = timeToTravel.subtract(new Time(TimeType.MILLISECONDS, route.getWpTtg(i + 1))); } } // Ensure the remaining time is actually positive (say, more than a minute) if (timeToTravel.in(TimeType.MINUTES).doubleValue() < 1.0) { // Reset arrival to a valid time arrivalPicker.setDate(route.getEta()); arrivalSpinner.setValue(route.getEta()); quiescent = wasQuiescent; return; } // So we need to travel how fast? double speed = distanceToTravel.inTime(timeToTravel).in(SpeedType.KNOTS).doubleValue(); for (int i = 0; i < route.getWaypoints().size(); i++) { if (!locked[i]) { route.getWaypoints().get(i).setSpeed(speed); } } // Update fields updateFields(); // Restore the quiescent state quiescent = wasQuiescent; }
private void clearFields() { patientNameField.setText(null); patientIDField.setText(null); modalityField.setText(null); anatomyField.setText(null); descriptionField.setText(null); startDatePicker.getEditor().setValue(null); endDatePicker.getEditor().setValue(null); }
private void initComponents() { fechaInicial = new JXDatePicker(); fechaInicial.setFormats("dd/MM/yyyy"); fechaFinal = new JXDatePicker(); fechaFinal.setFormats("dd/MM/yyyy"); List<ChoferFacturista> data = ServiceLocator2.getUniversalDao().getAll(ChoferFacturista.class); choferes = new JComboBox(data.toArray()); }
public void doApply() { SimpleDateFormat fechaaño = new SimpleDateFormat("yyyy"); SimpleDateFormat fechames = new SimpleDateFormat("MM"); Integer fechainicial = new Integer(fechaaño.format(año.getDate())); Integer fechafinal = new Integer(fechames.format(mes.getDate())); parametros.put("AÑO", fechainicial); parametros.put("MES", fechafinal); execute(); }
@Override public Object getValue() { final Calendar calendar = GregorianCalendar.getInstance(); final Date d = datePicker.getDate(); if (d != null) { calendar.setTime(datePicker.getDate()); calendar.set(Calendar.HOUR_OF_DAY, (Integer) hours.getValue()); calendar.set(Calendar.MINUTE, (Integer) minutes.getValue()); return new Timestamp(calendar.getTimeInMillis()); } return null; }
public void limpaFormulario() { textField.setText(""); textField_1.setText(""); textField_3.setText(""); textField_5.setText(""); textField_9.setText(""); textField_2.setText(""); textField_4.setText(""); textField_6.setText(""); dateInicio.getEditor().setText(""); dateFim.getEditor().setText(""); }
public void datePicker() { picker.setDate(Calendar.getInstance().getTime()); picker.setFormats(new SimpleDateFormat("yyyy-MM-dd")); if (countForSeek < 1) { frmSeekingParticularDataBasedonDate.getContentPane().add(pnlSeekingParticularDataBasedonDate); cbHourFill(); // truncAfterSelectingDate= picker.getDate().toString(); countForSeek++; } }
private Map<String, Object> collectInfos() { Map<String, Object> infos = new HashMap<String, Object>(); infos.put(IMedia.MEDIA_NAME, nameField.getText()); infos.put(IMedia.RELEASE_DATE, dateChooser.getDate()); infos.put(IMedia.FORMAT, formatField.getText()); return infos; }
/** * Configures the given date picker and associated time spinner * * @param picker the date picker * @param spinner the time spinner */ private void initDatePicker(JXDatePicker picker, JSpinner spinner) { picker.setFormats(new SimpleDateFormat("E dd/MM/yyyy")); picker.addPropertyChangeListener("date", this); DateEditor editor = new JSpinner.DateEditor(spinner, "HH:mm"); DateFormatter formatter = (DateFormatter) editor.getTextField().getFormatter(); formatter.setAllowsInvalid(false); formatter.setOverwriteMode(true); formatter.setCommitsOnValidEdit(true); spinner.setEditor(editor); spinner.addChangeListener(new SpinnerChangeListener()); // Set the enabled state picker.setEnabled(!readOnlyRoute); spinner.setEnabled(!readOnlyRoute); }
private JPanel createArchiveSearchFieldSubPanel() { FormLayout fl = new FormLayout( "pref,2dlu,pref:grow,5dlu,pref,2dlu,pref,5dlu,pref,2dlu,pref,5dlu,pref,2dlu,120px,5dlu,pref", "pref,2dlu,pref"); JPanel searchPanel = new JPanel(fl); startDatePicker.getMonthView().setAntialiased(true); startDatePicker.getMonthView().setBoxPaddingX(1); startDatePicker.getMonthView().setBoxPaddingY(1); startDatePicker.getMonthView().setSelectionMode(JXMonthView.SelectionMode.SINGLE_SELECTION); startDatePicker.getEditor().setValue(null); startDatePicker.setLinkPanel(null); endDatePicker.getMonthView().setAntialiased(true); endDatePicker.getMonthView().setBoxPaddingX(1); endDatePicker.getMonthView().setBoxPaddingY(1); endDatePicker.getMonthView().setSelectionMode(JXMonthView.SelectionMode.SINGLE_SELECTION); endDatePicker.getEditor().setValue(null); endDatePicker.setLinkPanel(null); searchButton.setActionCommand("search"); searchButton.addActionListener(this); clearFieldButton.setActionCommand("clear"); clearFieldButton.addActionListener(this); CellConstraints cc = new CellConstraints(); searchPanel.add(patientNameLabel, cc.xy(1, 1)); searchPanel.add(patientNameField, cc.xy(3, 1)); searchPanel.add(descriptionLabel, cc.xy(5, 1)); searchPanel.add(descriptionField, cc.xywh(7, 1, 5, 1)); searchPanel.add(startDateLabel, cc.xy(13, 1)); searchPanel.add(startDatePicker, cc.xy(15, 1)); searchPanel.add(clearFieldButton, cc.xy(17, 1)); searchPanel.add(patientIDLabel, cc.xy(1, 3)); searchPanel.add(patientIDField, cc.xy(3, 3)); searchPanel.add(modalityLabel, cc.xy(5, 3)); searchPanel.add(modalityField, cc.xy(7, 3)); searchPanel.add(anatomyLabel, cc.xy(9, 3)); searchPanel.add(anatomyField, cc.xy(11, 3)); searchPanel.add(endDateLabel, cc.xy(13, 3)); searchPanel.add(endDatePicker, cc.xy(15, 3)); searchPanel.add(searchButton, cc.xy(17, 3)); patientIDField.setActionCommand("search"); patientIDField.addActionListener(this); patientNameField.setActionCommand("search"); patientNameField.addActionListener(this); descriptionField.setActionCommand("search"); descriptionField.addActionListener(this); modalityField.setActionCommand("search"); modalityField.addActionListener(this); anatomyField.setActionCommand("search"); anatomyField.addActionListener(this); return searchPanel; }
public TimeStampEditor() { super(new BorderLayout()); add(BorderLayout.WEST, datePicker); add(BorderLayout.CENTER, hours); add(BorderLayout.EAST, minutes); datePicker.setOpaque(false); datePicker.addActionListener(this); datePicker.getEditor().addFocusListener(this); hours.setOpaque(false); hours.addChangeListener(this); ((JSpinner.DefaultEditor) hours.getEditor()).getTextField().addFocusListener(this); minutes.setOpaque(false); minutes.addChangeListener(this); ((JSpinner.DefaultEditor) minutes.getEditor()).getTextField().addFocusListener(this); }
private void viewReport() throws Exception { Date fromDate = fromDatePicker.getDate(); Date toDate = toDatePicker.getDate(); if (fromDate.after(toDate)) { POSMessageDialog.showError( BackOfficeWindow.getInstance(), com.floreantpos.POSConstants.FROM_DATE_CANNOT_BE_GREATER_THAN_TO_DATE_); return; } fromDate = DateUtil.startOfDay(fromDate); toDate = DateUtil.endOfDay(toDate); ReportService reportService = new ReportService(); CreditCardReport report = reportService.getCreditCardReport(fromDate, toDate); HashMap<String, Object> map = new HashMap<String, Object>(); ReportUtil.populateRestaurantProperties(map); map.put( "reportTitle", "========= " + Messages.getString("PosMessage.142").toUpperCase() + " =========="); map.put("fromDate", ReportService.formatShortDate(fromDate)); map.put("toDate", ReportService.formatShortDate(toDate)); map.put("reportTime", ReportService.formatFullDate(new Date())); map.put("salesCount", String.valueOf(report.getTotalSalesCount())); map.put("totalSales", NumberUtil.formatNumber(report.getTotalSales())); map.put("netTips", NumberUtil.formatNumber(report.getNetTips())); map.put("netTipsPaid", NumberUtil.formatNumber(report.getTipsPaid())); map.put("netCharge", NumberUtil.formatNumber(report.getNetCharge())); JasperReport jasperReport = (JasperReport) JRLoader.loadObject( getClass().getResource("/com/floreantpos/ui/report/credit_card_report.jasper")); JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, map, new JRTableModelDataSource(report.getTableModel())); JRViewer viewer = new JRViewer(jasperPrint); reportContainer.removeAll(); reportContainer.add(viewer); reportContainer.revalidate(); }
protected void init() { addProperty( new String[] { "fecha", "tipo", "concepto", "debe", "haber", "cuadre", "fecha", "year", "mes" }); addLabels( new String[] { "Fecha", "tipo", "concepto", "Debe", "Haber", "Cuadre", "fecha", "year", "mes" }); installTextComponentMatcherEditor("A Favor", "afavor"); installTextComponentMatcherEditor("Cuenta", "cuenta"); installTextComponentMatcherEditor("Año", "year"); installTextComponentMatcherEditor("Mes", "mes"); datePicker = new JXDatePicker(); datePicker.setFormats(new String[] {"dd/MM/yyyy"}); datePicker.addActionListener(this); }
public void atualizaFormulario(FolhaPagamento objFolha) { textField_9.setText(objFolha.getNomeFunc()); textField.setText(objFolha.getNumFunc().toString()); textField_3.setText(objFolha.getSalarioFunc().toString()); textField_1.setText(objFolha.getProfissaoFunc()); textField_2.setText(objFolha.getComissaoFuncTotal().toString()); textField_4.setText(objFolha.getBonusFunc().toString()); textField_6.setText(String.valueOf(objFolha.getTotalFunc())); dateInicio.setDate(objFolha.getDataInicio()); dateFim.setDate(objFolha.getDataFim()); Integer matr = objFolha.getNumFunc(); textField_5.setText(matr.toString()); lista.setVisible(false); formulario.setVisible(true); buttonPanel.setVisible(false); }
/** * DOCUMENT ME! * * @param evt DOCUMENT ME! */ private void btnThisMonthActionPerformed(final java.awt.event.ActionEvent evt) { final Calendar calendar = Calendar.getInstance(); final Date toDate = calendar.getTime(); calendar.set(Calendar.DAY_OF_MONTH, 1); final Date fromDate = calendar.getTime(); try { lockDateButtons = true; dpiFrom.setDate(fromDate); dpiTo.setDate(toDate); } finally { lockDateButtons = false; } periodChanged(); refreshFortfuehrungsList(); }
/** Updates the enabled state of the buttons */ private void updateButtonEnabledState() { boolean wpSelected = selectedWp >= 0; btnActivate.setEnabled(wpSelected && readOnlyRoute); btnDelete.setEnabled(wpSelected && !readOnlyRoute); btnZoomToWp.setEnabled(wpSelected && chartPanel != null); btnZoomToRoute.setEnabled(chartPanel != null); boolean allRowsLocked = checkLockedRows(); arrivalPicker.setEnabled(!readOnlyRoute && !allRowsLocked); arrivalSpinner.setEnabled(!readOnlyRoute && !allRowsLocked); }
private void initComponents() { fechaInicial = new JXDatePicker(); Date ini = DateUtils.addMonths(new Date(), -2); fechaInicial.setDate(ini); fechaInicial.setFormats("dd/MM/yyyy"); fechaFinal = new JXDatePicker(); fechaFinal.setFormats("dd/MM/yyyy"); sucursalControl = createSucursalControl(); lineaControl = buildLineaControl(); NumberFormatter formatter = new NumberFormatter(NumberFormat.getNumberInstance()); formatter.setValueClass(Double.class); // formatter.setMaximum(new Integer(0)); meses = new JFormattedTextField(formatter); meses.setValue(new Double(0)); ordenBox = new JComboBox(TIPO_DE_ORDENAMIENTO); formaBox = new JComboBox(ORDENAMIENTO); filtrosBox = new JComboBox( new Object[] { new ParamLabelValue("TODOS", " LIKE '%'"), new ParamLabelValue("ALCANCE MAYOR", ">$P{MESESF}"), new ParamLabelValue("ALCANCE MENOR", "<=$P{MESESF}") }); mesesF = new JFormattedTextField(formatter); mesesF.setValue(new Double(0)); alcance = new JCheckBox("", false); todasLasSucursales = new JCheckBox("", false); todasLasSucursales.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { sucursalControl.setEnabled(!todasLasSucursales.isSelected()); } }); filtro2Box = new JComboBox( new Object[] { new ParamLabelValue("TODOS", " "), new ParamLabelValue("DE LINEA", "AND DELINEA IS TRUE"), new ParamLabelValue("ESPECIALES", "AND DELINEA IS FALSE") }); }
/** * Called when one of the arrival and departure spinners changes value * * @param spinner the spinner */ protected void spinnerValueChanged(JSpinner spinner) { // Check if we are in a quiescent state if (quiescent) { return; } if (spinner == departureSpinner) { Date date = ParseUtils.combineDateTime(departurePicker.getDate(), (Date) departureSpinner.getValue()); route.setStarttime(date); adjustStartTime(); } else if (spinner == arrivalSpinner) { Date date = ParseUtils.combineDateTime(arrivalPicker.getDate(), (Date) arrivalSpinner.getValue()); recalculateSpeeds(date); } else { return; } routeUpdated(); }