Example usage for java.text DateFormat getTimeInstance

List of usage examples for java.text DateFormat getTimeInstance

Introduction

In this page you can find the example usage for java.text DateFormat getTimeInstance.

Prototype

public static final DateFormat getTimeInstance(int style) 

Source Link

Document

Gets the time formatter with the given formatting style for the default java.util.Locale.Category#FORMAT FORMAT locale.

Usage

From source file:op.care.prescription.PnlScheduleDose.java

private void initPanel() {

    tabWdh.setTitleAt(0, SYSTools.xx("misc.msg.daily"));
    tabWdh.setTitleAt(1, SYSTools.xx("misc.msg.weekly"));
    tabWdh.setTitleAt(2, SYSTools.xx("misc.msg.monthly"));

    lblLDate.setText(SYSTools.xx(internalClassID + ".lblLDate") + " ");
    lblOnThe.setText(SYSTools.xx(internalClassID + ".lblOnThe"));
    lblMonth.setText(SYSTools.xx("misc.msg.months"));
    lblEach.setText(SYSTools.xx("misc.msg.every"));
    lblEvery1.setText(SYSTools.xx("misc.msg.every"));
    lblEvery2.setText(SYSTools.xx("misc.msg.every"));
    lblWeeksAt.setText(SYSTools.xx("misc.msg.weeks") + " " + SYSTools.xx("misc.msg.atchrono"));
    lblDays.setText(SYSTools.xx("misc.msg.Days2"));

    ArrayList<Date> timelist = SYSCalendar.getTimeList();
    cmbUhrzeit.setModel(new DefaultComboBoxModel(timelist.toArray()));
    cmbUhrzeit.setRenderer(SYSCalendar.getTimeRenderer());

    String[] wdaymodel = new String[] { SYSTools.xx("misc.msg.dayOfMonth"), SYSTools.xx("misc.msg.monday"),
            SYSTools.xx("misc.msg.tuesday"), SYSTools.xx("misc.msg.wednesday"),
            SYSTools.xx("misc.msg.thursday"), SYSTools.xx("misc.msg.friday"), SYSTools.xx("misc.msg.saturday"),
            SYSTools.xx("misc.msg.sunday") };
    cmbWDay.setModel(new DefaultComboBoxModel(wdaymodel));

    lblMon.setText(SYSTools.xx("misc.msg.monday"));
    lblTue.setText(SYSTools.xx("misc.msg.tuesday"));
    lblWed.setText(SYSTools.xx("misc.msg.wednesday"));
    lblThu.setText(SYSTools.xx("misc.msg.thursday"));
    lblFri.setText(SYSTools.xx("misc.msg.friday"));
    lblSat.setText(SYSTools.xx("misc.msg.saturday"));
    lblSun.setText(SYSTools.xx("misc.msg.sunday"));

    lblVeryEarly.setText(SYSTools.xx("misc.msg.earlyinthemorning.long"));
    lblMorning.setText(SYSTools.xx("misc.msg.morning.long"));
    lblNoon.setText(SYSTools.xx("misc.msg.noon.long"));
    lblAfternoon.setText(SYSTools.xx("misc.msg.afternoon.long"));
    lblEvening.setText(SYSTools.xx("misc.msg.evening.long"));
    lblVeryLate.setText(SYSTools.xx("misc.msg.lateatnight.long"));

    txtEveryDay.setText("1");
    txtEveryWeek.setText("1");
    txtEveryMonth.setText("1");
    txtEveryWDayOfMonth.setText("1");

    //        txtEveryDay.setText(schedule.getTaeglich().toString());
    //        txtEveryWeek.setText(schedule.getWoechentlich().toString());
    //        txtEveryMonth.setText(schedule.getMonatlich().toString());
    //        txtEveryWDayOfMonth.setText(schedule.getTagNum().toString());

    tabWdh.setSelectedIndex(TAB_DAILY);/*from   w w  w . j  a v  a 2s.co  m*/

    if (schedule.getWoechentlich() > 0) {
        cbMon.setSelected(schedule.getMon() > 0);
        cbTue.setSelected(schedule.getTue() > 0);
        cbWed.setSelected(schedule.getWed() > 0);
        cbThu.setSelected(schedule.getThu() > 0);
        cbFri.setSelected(schedule.getFri() > 0);
        cbSat.setSelected(schedule.getSat() > 0);
        cbSun.setSelected(schedule.getSun() > 0);
        tabWdh.setSelectedIndex(TAB_WEEKLY);
    }

    if (schedule.getMonatlich() > 0) {
        if (schedule.getTagNum() > 0) {
            txtEveryWDayOfMonth.setText(Short.toString(schedule.getTagNum()));
            cmbWDay.setSelectedIndex(0);
        } else {
            if (schedule.getMon() > 0) {
                cmbWDay.setSelectedIndex(1);
                txtEveryWDayOfMonth.setText(Short.toString(schedule.getMon()));
            } else if (schedule.getTue() > 0) {
                cmbWDay.setSelectedIndex(2);
                txtEveryWDayOfMonth.setText(Short.toString(schedule.getTue()));
            } else if (schedule.getWed() > 0) {
                cmbWDay.setSelectedIndex(3);
                txtEveryWDayOfMonth.setText(Short.toString(schedule.getWed()));
            } else if (schedule.getThu() > 0) {
                cmbWDay.setSelectedIndex(4);
                txtEveryWDayOfMonth.setText(Short.toString(schedule.getThu()));
            } else if (schedule.getFri() > 0) {
                cmbWDay.setSelectedIndex(5);
                txtEveryWDayOfMonth.setText(Short.toString(schedule.getFri()));
            } else if (schedule.getSat() > 0) {
                cmbWDay.setSelectedIndex(6);
                txtEveryWDayOfMonth.setText(Short.toString(schedule.getSat()));
            } else if (schedule.getSun() > 0) {
                cmbWDay.setSelectedIndex(7);
                txtEveryWDayOfMonth.setText(Short.toString(schedule.getSun()));
            }
        }
        tabWdh.setSelectedIndex(TAB_MONTHLY);
    }

    //        jdcLDatum.setMinSelectableDate(new Date());
    //        jdcLDatum.setDate(new Date(Math.max(schedule.getLDatum().getTime(), SYSCalendar.startOfDay())));

    DateMidnight scheduleLDate = new DateMidnight(schedule.getLDatum());
    DateMidnight today = new DateMidnight();
    DateMidnight ldate = new DateMidnight(Math.max(scheduleLDate.getMillis(), today.getMillis()));
    txtLDate.setText(DateFormat.getDateInstance().format(ldate.toDate()));

    txtVeryEarly.setText(schedule.getNachtMo().setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString());
    txtMorning.setText(schedule.getMorgens().setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString());
    txtNoon.setText(schedule.getMittags().setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString());
    txtAfternoon.setText(schedule.getNachmittags().setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString());
    txtEvening.setText(schedule.getAbends().setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString());
    txtVeryLate.setText(schedule.getNachtAb().setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString());
    txtTimeDose.setText(schedule.getUhrzeitDosis().setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString());

    txtMorning.setBackground(SYSConst.lightblue);
    txtNoon.setBackground(SYSConst.gold7);
    txtAfternoon.setBackground(SYSConst.melonrindgreen);
    txtEvening.setBackground(SYSConst.bermuda_sand);
    txtVeryLate.setBackground(SYSConst.bluegrey);

    Date now = null;
    if (schedule.getUhrzeitDosis().compareTo(BigDecimal.ZERO) > 0) {
        splitRegularPos = 0.0d;
        now = schedule.getUhrzeit();
    } else {
        now = new Date();
        splitRegularPos = 1.0d;
    }

    for (Date zeit : timelist) {
        if (SYSCalendar.compareTime(zeit, now) >= 0) {
            now = zeit;
            break;
        }
    }
    cmbUhrzeit.setSelectedItem(now);
    lblTimeDose.setText(SYSTools.xx(internalClassID + ".lblTimeDose") + " "
            + DateFormat.getTimeInstance(DateFormat.SHORT).format(now) + " "
            + SYSTools.xx("misc.msg.Time.short"));

    panelMainComponentResized(null);
}

From source file:com.cachirulop.moneybox.activity.MovementDetailActivity.java

/**
 * Update the get time field of the window with the value of the movement
 * object./*from  ww  w  .j a  v  a2s .  c  om*/
 */
private void updateGetTime() {
    TextView txt;

    txt = (TextView) findViewById(R.id.txtGetTime);
    if (_movement.getGetDate() != null) {
        txt.setText(DateFormat.getTimeInstance(DateFormat.SHORT).format(_movement.getGetDate()));
    } else {
        txt.setText("");
    }
}

From source file:com.cachirulop.moneybox.activity.MovementDetailActivity.java

/**
 * Update the insert time field of the window with the value of the movement
 * object./*  ww  w.jav a  2s . c  o m*/
 */
private void updateInsertTime() {
    TextView txt;

    txt = (TextView) findViewById(R.id.txtTime);
    txt.setText(DateFormat.getTimeInstance(DateFormat.SHORT).format(_movement.getInsertDate()));
}

From source file:org.svij.taskwarriorapp.activities.TaskAddActivity.java

@Override
public void onTimeSet(RadialPickerLayout view, int hourOfDay, int minute) {
    cal.set(Calendar.HOUR_OF_DAY, hourOfDay);
    cal.set(Calendar.MINUTE, minute);
    cal.set(Calendar.SECOND, 0);//w w  w.  j a  v a  2s.c  o m

    timestamp = cal.getTimeInMillis();

    TextView etTaskTime = (TextView) findViewById(R.id.tvDueTime);
    etTaskTime.setText(DateFormat.getTimeInstance(DateFormat.SHORT).format(timestamp));
    TextView etTaskDate = (TextView) findViewById(R.id.tvDueDate);
    etTaskDate.setText(DateFormat.getDateInstance(DateFormat.SHORT).format(timestamp));
}

From source file:eu.trentorise.smartcampus.jp.MyRecurItineraryFragment.java

private String formatTime(String time) {
    SimpleDateFormat inFormat = new SimpleDateFormat("hh:mmaa", Locale.getDefault());
    DateFormat outFormat = DateFormat.getTimeInstance(DateFormat.SHORT);
    try {//from   w  w  w  .  jav  a2 s.c  o m
        Date date = inFormat.parse(time);
        String out = outFormat.format(date);
        return out;
    } catch (ParseException e) {
        return time;
    }
}

From source file:gov.nih.nci.ncicb.tcga.dcc.dam.processors.FilePackager.java

private void sendEmailToUser() {
    try {//  w  ww . j  a  v a2 s .  c  om
        if (filePackagerBean.getEmail() != null && getMailSender() != null) {
            if (filePackagerBean.isDone()) {
                final StringBuilder buf = new StringBuilder();
                buf.append("The archive you created is available at ").append(filePackagerBean.getLinkText())
                        .append(DOUBLE_LINE_SEPARATOR);
                buf.append("It will be available for download for ").append(getHoursTillDeletion())
                        .append(" hours, after which it will be deleted from our servers.")
                        .append(DOUBLE_LINE_SEPARATOR);

                buf.append(
                        "IMPORTANT: Data downloaders are urged to use the data annotation search interface (https://tcga-data.nci.nih.gov/annotations/) to query the case, sample, and aliquot identifiers in their download to obtain the latest information associated with their data.");
                buf.append(DOUBLE_LINE_SEPARATOR);

                if (filePackagerBean.getFilterRequest() != null) {
                    buf.append(generateFilterTextForEmail());
                }
                if (isEmailTiming()) { //debug performance numbers
                    long fileProcessingTime = endFileProcessingTime - startTime;
                    long archiveGenerationTime = endTime - startArchiveCreationTime;
                    long totalTime = endTime - startTime;
                    long waitingInQueueTime = startTime - filePackagerBean.getCreationTime();
                    Date fpCreationDate = new Date(filePackagerBean.getCreationTime());
                    buf.append(DOUBLE_LINE_SEPARATOR).append("Archive Processing Details: ")
                            .append(DOUBLE_LINE_SEPARATOR);
                    buf.append("Total file processing time: ").append(formatTime(fileProcessingTime))
                            .append(DOUBLE_LINE_SEPARATOR);
                    buf.append("Total archive generation time: ").append(formatTime(archiveGenerationTime))
                            .append(DOUBLE_LINE_SEPARATOR);
                    buf.append("Total processing time: ").append(formatTime(totalTime))
                            .append(DOUBLE_LINE_SEPARATOR);
                    buf.append("When added to queue: ")
                            .append(DateFormat.getTimeInstance(DateFormat.MEDIUM).format(fpCreationDate))
                            .append(DOUBLE_LINE_SEPARATOR);
                    buf.append("Time waiting in queue: ").append(formatTime(waitingInQueueTime))
                            .append(DOUBLE_LINE_SEPARATOR);
                }
                buf.append(DOUBLE_LINE_SEPARATOR).append("The TCGA Data Coordinating Center");
                getMailSender().send(filePackagerBean.getEmail(), null, "Download Available", buf.toString(),
                        false);
            } else if (filePackagerBean.isFailed()) {
                final StringBuilder buf = new StringBuilder();
                String errmsg = filePackagerBean.getException().getMessage();
                if (errmsg == null) {
                    errmsg = filePackagerBean.getException().getClass().toString();
                }
                buf.append("Sorry, we were unable to process your archive. Please try again.")
                        .append(DOUBLE_LINE_SEPARATOR).append("Error message: ").append(errmsg)
                        .append(DOUBLE_LINE_SEPARATOR).append("The TCGA Data Coordinating Center");
                getMailSender().send(filePackagerBean.getEmail(), getFailEmail(), "Download Unavailable",
                        buf.toString(), true);
            }
        }
    } catch (Exception ex) {
        logger.logToLogger(Level.ERROR, "Could not send user email: " + ex.getMessage());
    }
}

From source file:taximetro.main.java

private void jButtoncomienzoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtoncomienzoActionPerformed
    //Establecer parmetros del nuevo estado de los botones comiezo y fin
    // de carrera, despus de la accin del botn.
    jButtonfin.setEnabled(true);//www  .j ava  2 s. c  o  m
    jButtoncomienzo.setEnabled(false);
    //Borrado del texto existente del area de texto.
    jTextAreaticket.setText("");
    //Guardar la hora de comienzo de carrera al presionar el boton de comenzar.
    Calendar tiempo = Calendar.getInstance(zona);
    DateFormat formatohoras = DateFormat.getTimeInstance(DateFormat.MEDIUM);
    horacomienzocarrera = formatohoras.format(tiempo.getTimeInMillis());
    //Establecer contador de tiempo ponerlo a cero, y inicarlo.
    cronometro.reset();
    cronometro.start();
    //Establecer contador del nmero de ticket.
    ticket++;
    //Darle formato al nmero del ticket con 5 dgitos, sin punto.
    NumberFormat formato = NumberFormat.getInstance();
    formato.setMinimumIntegerDigits(5);
    formato.setGroupingUsed(false);
    textoticket = String.valueOf(formato.format(ticket));

}

From source file:taximetro.main.java

private void jButtonfinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonfinActionPerformed
    //Establecer de nuevo parametros de los botones de fin y comienzo carrera.
    jButtonfin.setEnabled(false);//ww  w .  ja  v a2 s. c om
    jButtoncomienzo.setEnabled(true);
    //Parar el contador.
    cronometro.stop();
    //Darle formato HH:mm:ss al resultado del contador.
    String tiempotexto = DurationFormatUtils.formatDuration(cronometro.getTime(), "HH:mm:ss");
    //Guardar la hora de fin de carrera al presionar botn de fin carrera.
    Calendar tiempo = Calendar.getInstance(zona);
    //Dar formato a la hora de fin de carrera al presionar el boton de fin.
    DateFormat formatohoras = DateFormat.getTimeInstance(DateFormat.MEDIUM);
    String horafincarrera = formatohoras.format(tiempo.getTimeInMillis());
    //Dar formato a la fecha.
    DateFormat formatotiempo = DateFormat.getDateInstance(DateFormat.LONG);
    String fechatexto = formatotiempo.format(tiempo.getTime());
    //Calcular el coste del trayecto, a partir del tiempo del contador.
    float coste = (cronometro.getTime() / 1000) * (TARIFA / 60);
    float iva = coste * 0.21F;
    float costetotal = coste * 1.21F;
    //Dar formato al coste del trayecto.
    NumberFormat formatoeuro = NumberFormat.getCurrencyInstance(zona);
    //Escribir en el area de texto todos los parmetros.
    jTextAreaticket.append("TICKET:\n \n");
    jTextAreaticket.append("=================\n");
    jTextAreaticket.append("Ticket N: " + textoticket + " .\n");
    jTextAreaticket.append("Fecha:\n" + fechatexto + " .\n\n");
    jTextAreaticket.append("Hora de comienzo de carrera: " + horacomienzocarrera + " .\n");
    jTextAreaticket.append("Hora de fin de carrera: " + horafincarrera + " .\n");
    jTextAreaticket.append("El tiempo del trayecto es: " + tiempotexto + " .\n\n\n");
    jTextAreaticket.append("Importe: " + formatoeuro.format(coste) + " .\n");
    jTextAreaticket.append("IVA: " + formatoeuro.format(iva) + " .\n");
    jTextAreaticket.append("Importe Total: " + formatoeuro.format(costetotal) + " .\n");
}

From source file:de.blizzy.backup.settings.SettingsDialog.java

private void updateExplanationLabel() {
    DateFormat timeFormat = DateFormat.getTimeInstance(DateFormat.SHORT);
    Calendar c = Calendar.getInstance();
    c.set(Calendar.HOUR_OF_DAY, dailyTime.getHours());
    c.set(Calendar.MINUTE, dailyTime.getMinutes());
    scheduleExplanationLabel.setText("- " + (runHourlyRadio.getSelection() ? //$NON-NLS-1$
            Messages.ScheduleExplanation_HourlyBackups
            : NLS.bind(Messages.ScheduleExplanation_DailyBackups, timeFormat.format(c.getTime()))) + "\n" + //$NON-NLS-1$
            (runHourlyRadio.getSelection() ? "- " + //$NON-NLS-1$
                    NLS.bind(Messages.ScheduleExplanation_HourlyBackupsKeepTime,
                            Integer.valueOf(BackupPlugin.KEEP_HOURLIES_DAYS))
                    + "\n" : //$NON-NLS-1$
                    "") //$NON-NLS-1$
            + "- " + NLS.bind(Messages.ScheduleExplanation_DailyBackupsKeepTime,
                    Integer.valueOf(BackupPlugin.KEEP_DAILIES_DAYS))
            + "\n" + //$NON-NLS-1$
            "- " + (maxAgeDaysRadio.getSelection() ? //$NON-NLS-1$
                    NLS.bind(Messages.ScheduleExplanation_WeeklyBackupsKeepDays,
                            Integer.valueOf(maxAgeDaysSpinner.getSelection()))
                    : Messages.ScheduleExplanation_WeeklyBackupsNoAge)
            + "\n" + //$NON-NLS-1$
            "- " + //$NON-NLS-1$
            NLS.bind(Messages.ScheduleExplanation_WeeklyBackupsKeepDisk,
                    Integer.valueOf(maxDiskFillRateSpinner.getSelection()))
            +/* w  w w . ja  v  a2 s  .  c  o m*/
            // compensate for missing line
            (!runHourlyRadio.getSelection() ? "\n " : "")); //$NON-NLS-1$ //$NON-NLS-2$
}

From source file:op.care.supervisor.PnlHandover.java

private void createContentPanel4Day(final LocalDate day, final CollapsiblePane cpDay) {

    final JPanel dayPanel = new JPanel(new VerticalLayout());

    OPDE.getDisplayManager().setProgressBarMessage(new DisplayMessage(SYSTools.xx("misc.msg.wait"), -1, 100));
    OPDE.getMainframe().setBlocked(true);

    SwingWorker worker = new SwingWorker() {

        @Override/* w w w  . java 2 s. c  om*/
        protected Object doInBackground() throws Exception {

            //                final JPanel dayPanel = new JPanel(new VerticalLayout());
            dayPanel.setOpaque(false);

            ArrayList<Handovers> listHO = HandoversTools.getBy(day, (Homes) cmbHomes.getSelectedItem());
            ArrayList<NReport> listNR = NReportTools.getNReports4Handover(day,
                    (Homes) cmbHomes.getSelectedItem());

            Collections.sort(listNR, myComparator);

            int max = listHO.size() + listNR.size();
            int i = 0; // for zebra pattern and progress
            for (final Handovers handover : listHO) {
                OPDE.getDisplayManager()
                        .setProgressBarMessage(new DisplayMessage(SYSTools.xx("misc.msg.wait"), i, max));

                String title = "<html><table border=\"0\">" + "<tr valign=\"top\">"
                        + "<td width=\"100\" align=\"left\">"
                        + DateFormat.getTimeInstance(DateFormat.SHORT).format(handover.getPit()) + " "
                        + SYSTools.xx("misc.msg.Time.short") + "</td>"
                        + "<td width=\"100\" align=\"center\">--</td>" + "<td width=\"400\" align=\"left\">"
                        + handover.getText() + "</td>" +

                        "<td width=\"100\" align=\"left\">" + handover.getUser().getFullname() + "</td>"
                        + "</tr>" + "</table>" + "</html>";

                final DefaultCPTitle pnlSingle = new DefaultCPTitle(SYSTools.toHTMLForScreen(title),
                        new ActionListener() {
                            @Override
                            public void actionPerformed(ActionEvent evt) {
                                EntityManager em = OPDE.createEM();
                                if (Handover2UserTools.containsUser(em, handover, OPDE.getLogin().getUser())) {
                                    em.close();
                                    return;
                                }
                                try {
                                    em.getTransaction().begin();
                                    Handovers myHO = em.merge(handover);
                                    Handover2User connObj = em.merge(
                                            new Handover2User(myHO, em.merge(OPDE.getLogin().getUser())));
                                    myHO.getUsersAcknowledged().add(connObj);
                                    em.getTransaction().commit();

                                    createCP4Day(day);
                                    buildPanel();

                                } catch (OptimisticLockException ole) {
                                    OPDE.warn(ole);
                                    if (em.getTransaction().isActive()) {
                                        em.getTransaction().rollback();
                                    }
                                    if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) {
                                        OPDE.getMainframe().emptyFrame();
                                        OPDE.getMainframe().afterLogin();
                                    }
                                    OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage());
                                } catch (Exception e) {
                                    if (em.getTransaction().isActive()) {
                                        em.getTransaction().rollback();
                                    }
                                    OPDE.fatal(e);
                                } finally {
                                    em.close();
                                }
                            }
                        });

                final JButton btnInfo = new JButton(SYSConst.icon22info);
                btnInfo.setPressedIcon(SYSConst.icon22infoPressed);
                btnInfo.setAlignmentX(Component.RIGHT_ALIGNMENT);
                btnInfo.setAlignmentY(Component.TOP_ALIGNMENT);
                btnInfo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
                btnInfo.setContentAreaFilled(false);
                btnInfo.setBorder(null);
                btnInfo.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        OPDE.getDisplayManager().setProgressBarMessage(
                                new DisplayMessage(SYSTools.xx("misc.msg.wait"), -1, 100));
                        OPDE.getMainframe().setBlocked(true);

                        SwingWorker worker = new SwingWorker() {

                            @Override
                            protected Object doInBackground() throws Exception {
                                SYSFilesTools.print(Handover2UserTools.getAsHTML(handover), false);
                                return null;
                            }

                            @Override
                            protected void done() {
                                try {
                                    get();
                                } catch (Exception ex1) {
                                    OPDE.fatal(ex1);
                                }
                                OPDE.getDisplayManager().setProgressBarMessage(null);
                                OPDE.getMainframe().setBlocked(false);
                            }

                        };
                        worker.execute();

                    }
                });
                pnlSingle.getRight().add(btnInfo);

                EntityManager em = OPDE.createEM();
                pnlSingle.getButton()
                        .setIcon(Handover2UserTools.containsUser(em, handover, OPDE.getLogin().getUser())
                                ? SYSConst.icon22ledGreenOn
                                : SYSConst.icon22ledRedOn);
                em.close();

                pnlSingle.getButton().setVerticalTextPosition(SwingConstants.TOP);

                JPanel zebra = new JPanel();
                zebra.setLayout(new BoxLayout(zebra, BoxLayout.LINE_AXIS));
                zebra.setOpaque(true);
                if (i % 2 == 0) {
                    zebra.setBackground(SYSConst.orange1[SYSConst.light2]);
                } else {
                    zebra.setBackground(Color.WHITE);
                }
                zebra.add(pnlSingle.getMain());
                i++;
                dayPanel.add(zebra);
            }
            for (final NReport nreport : listNR) {
                OPDE.getDisplayManager()
                        .setProgressBarMessage(new DisplayMessage(SYSTools.xx("misc.msg.wait"), i, max));

                String title = "<html><table border=\"0\">" + "<tr valign=\"top\">"
                        + "<td width=\"100\" align=\"left\">"
                        + DateFormat.getTimeInstance(DateFormat.SHORT).format(nreport.getPit()) + " "
                        + SYSTools.xx("misc.msg.Time.short") + "<br/>" + nreport.getMinutes() + " "
                        + SYSTools.xx("misc.msg.Minute(s)") + "</td>" + "<td width=\"100\" align=\"left\">"
                        + ResidentTools.getTextCompact(nreport.getResident()) + "</td>"
                        + "<td width=\"400\" align=\"left\">" + nreport.getText() + "</td>" +

                        "<td width=\"100\" align=\"left\">" + nreport.getUser().getFullname() + "</td>"
                        + "</tr>" + "</table>" + "</html>";

                final DefaultCPTitle pnlSingle = new DefaultCPTitle(SYSTools.toHTMLForScreen(title),
                        new ActionListener() {
                            @Override
                            public void actionPerformed(ActionEvent evt) {
                                EntityManager em = OPDE.createEM();
                                if (NR2UserTools.containsUser(em, nreport, OPDE.getLogin().getUser())) {
                                    em.close();
                                    return;
                                }

                                try {
                                    em.getTransaction().begin();
                                    NReport myNR = em.merge(nreport);
                                    NR2User connObj = em
                                            .merge(new NR2User(myNR, em.merge(OPDE.getLogin().getUser())));
                                    myNR.getUsersAcknowledged().add(connObj);
                                    em.getTransaction().commit();
                                    createCP4Day(day);
                                    buildPanel();
                                } catch (OptimisticLockException ole) {
                                    OPDE.warn(ole);
                                    if (em.getTransaction().isActive()) {
                                        em.getTransaction().rollback();
                                    }
                                    if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) {
                                        OPDE.getMainframe().emptyFrame();
                                        OPDE.getMainframe().afterLogin();
                                    }
                                    OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage());
                                } catch (Exception e) {
                                    if (em.getTransaction().isActive()) {
                                        em.getTransaction().rollback();
                                    }
                                    OPDE.fatal(e);
                                } finally {
                                    em.close();
                                }
                            }
                        });

                final JButton btnInfo = new JButton(SYSConst.icon22info);
                btnInfo.setPressedIcon(SYSConst.icon22infoPressed);
                btnInfo.setAlignmentX(Component.RIGHT_ALIGNMENT);
                btnInfo.setAlignmentY(Component.TOP_ALIGNMENT);
                btnInfo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
                btnInfo.setContentAreaFilled(false);
                btnInfo.setBorder(null);
                btnInfo.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {

                        SYSFilesTools.print(NR2UserTools.getAsHTML(nreport), false);

                        //                            OPDE.getDisplayManager().setProgressBarMessage(new DisplayMessage(SYSTools.xx("misc.msg.wait"), -1, 100));
                        //                            OPDE.getMainframe().setBlocked(true);
                        //
                        //                            SwingWorker worker = new SwingWorker() {
                        //
                        //                                @Override
                        //                                protected Object doInBackground() throws Exception {
                        //
                        //                                    return null;
                        //                                }
                        //
                        //                                @Override
                        //                                protected void done() {
                        //                                    OPDE.getDisplayManager().setProgressBarMessage(null);
                        //                                    OPDE.getMainframe().setBlocked(false);
                        //                                }
                        //
                        //                            };
                        //                            worker.execute();

                    }
                });
                pnlSingle.getRight().add(btnInfo);

                EntityManager em = OPDE.createEM();
                pnlSingle.getButton()
                        .setIcon(NR2UserTools.containsUser(em, nreport, OPDE.getLogin().getUser())
                                ? SYSConst.icon22ledGreenOn
                                : SYSConst.icon22ledRedOn);
                em.close();

                pnlSingle.getButton().setVerticalTextPosition(SwingConstants.TOP);

                JPanel zebra = new JPanel();
                zebra.setLayout(new BoxLayout(zebra, BoxLayout.LINE_AXIS));
                zebra.setOpaque(true);
                if (i % 2 == 0) {
                    zebra.setBackground(SYSConst.orange1[SYSConst.light2]);
                } else {
                    zebra.setBackground(Color.WHITE);
                }
                zebra.add(pnlSingle.getMain());
                i++;

                dayPanel.add(zebra);
            }
            final String key = DateFormat.getDateInstance().format(day.toDate());
            synchronized (cacheHO) {
                cacheHO.put(key, listHO);
            }
            synchronized (cacheNR) {
                cacheNR.put(key, listNR);
            }
            return null;

        }

        @Override
        protected void done() {
            try {
                get();
            } catch (Exception ex2) {
                OPDE.fatal(ex2);
            }
            cpDay.setContentPane(dayPanel);
            OPDE.getDisplayManager().setProgressBarMessage(null);
            OPDE.getMainframe().setBlocked(false);
        }
    };
    worker.execute();

}