Example usage for java.text DateFormat SHORT

List of usage examples for java.text DateFormat SHORT

Introduction

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

Prototype

int SHORT

To view the source code for java.text DateFormat SHORT.

Click Source Link

Document

Constant for short style pattern.

Usage

From source file:com.rogchen.common.xml.UtilDateTime.java

/**
 * Returns an initialized DateFormat object.
 *
 * @param dateTimeFormat optional format string
 * @param tz/*from ww w  .  j a va 2 s.  co m*/
 * @param locale can be null if dateTimeFormat is not null
 * @return DateFormat object
 */
public static DateFormat toDateTimeFormat(String dateTimeFormat, TimeZone tz, Locale locale) {
    DateFormat df = null;
    if (dateTimeFormat == null) {
        df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, locale);
    } else {
        df = new SimpleDateFormat(dateTimeFormat);
    }
    df.setTimeZone(tz);
    return df;
}

From source file:com.bizosys.hsearch.index.IndexReaderTest.java

public void testCreatedAfter() throws Exception {
    String id = "ID021";

    DateFormat format = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);

    HDocument doc1 = new HDocument(ANONYMOUS);
    doc1.key = "Id 1 : " + id;
    doc1.title = "My daughter birth was after my birth";
    doc1.createdOn = format.parse("Nov 18, 2008 6:15 AM");
    IndexWriter.getInstance().insert(doc1, acc, isMultiClient);

    String myBirth = new Long(format.parse("Feb 05, 1977 8:00 PM").getTime()).toString();
    QueryResult res1 = IndexReader.getInstance()
            .search(new QueryContext(acc, "createda:" + myBirth + " birth"));
    assertEquals(1, res1.teasers.length);

    String toDate = new Long(new Date().getTime()).toString();
    QueryResult res2 = IndexReader.getInstance().search(new QueryContext(acc, "createda:" + toDate + " birth"));
    assertEquals(0, res2.teasers.length);

    IndexWriter.getInstance().delete(ANONYMOUS, doc1.key, isMultiClient);
}

From source file:com.bizosys.hsearch.index.IndexReaderTest.java

public void testModifiedAfter() throws Exception {
    String id = "ID022";

    DateFormat format = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);

    HDocument doc1 = new HDocument(ANONYMOUS);
    doc1.key = "Id 1 : " + id;
    doc1.title = "My Trading balance as 234.00";
    doc1.modifiedOn = new Date();
    IndexWriter.getInstance().insert(doc1, acc, isMultiClient);

    String myBirth = new Long(format.parse("Feb 05, 1977 8:00 PM").getTime()).toString();
    QueryResult res1 = IndexReader.getInstance()
            .search(new QueryContext(acc, "modifieda:" + myBirth + " balance"));
    assertEquals(1, res1.teasers.length);

    String future = new Long(format.parse("Feb 05, 2121 8:00 PM").getTime()).toString();
    QueryResult res2 = IndexReader.getInstance()
            .search(new QueryContext(acc, "modifieda:" + future + " balance"));
    assertEquals(0, res2.teasers.length);

    IndexWriter.getInstance().delete(ANONYMOUS, doc1.key, isMultiClient);
}

From source file:op.care.reports.PnlReport.java

private JPanel createContentPanel4Day(LocalDate day) {
    //        OPDE.getDisplayManager().setProgressBarMessage(new DisplayMessage("misc.msg.wait", progress, progressMax));
    //        progress++;

    final String key = DateFormat.getDateInstance().format(day.toDate());
    synchronized (contentmap) {
        if (contentmap.containsKey(key)) {
            return contentmap.get(key);
        }/*from  w ww  . ja v  a 2 s . c  om*/
    }
    final JPanel dayPanel = new JPanel(new VerticalLayout());
    dayPanel.setOpaque(false);
    synchronized (valuecache) {
        if (!valuecache.containsKey(key)) {
            valuecache.put(key, NReportTools.getNReports4Day(resident, day));
        }

        int i = 0; // for zebra pattern
        for (final NReport nreport : valuecache.get(key)) {

            if (tbShowReplaced.isSelected() || !nreport.isObsolete()) {

                String title = SYSTools.toHTMLForScreen(SYSConst.html_table(SYSConst
                        .html_table_tr("<td width=\"800\" align=\"left\">" + "<b><p>"
                                + (nreport.isObsolete() ? SYSConst.html_16x16_Eraser_internal : "")
                                + (nreport.isReplacement() ? SYSConst.html_16x16_Edited_internal : "")
                                + DateFormat.getTimeInstance(DateFormat.SHORT).format(nreport.getPit()) + " "
                                + SYSTools.xx("misc.msg.Time.short") + ", " + nreport.getMinutes() + " "
                                + SYSTools.xx("misc.msg.Minute(s)") + ", " + nreport.getUser().getFullname()
                                + (nreport.getCommontags().isEmpty() ? ""
                                        : " " + CommontagsTools.getAsHTML(nreport.getCommontags(),
                                                SYSConst.html_16x16_tagPurple_internal))
                                + "</p></b></td>")
                        + SYSConst.html_table_tr("<td width=\"800\" align=\"left\">"
                                + SYSTools.replace(nreport.getText(), "\n", "<br/>", false) + "</td>"),
                        "0"));

                final DefaultCPTitle pnlSingle = new DefaultCPTitle(SYSTools.toHTMLForScreen(title), null);
                pnlSingle.getButton().addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        GUITools.showPopup(GUITools.getHTMLPopup(pnlSingle.getButton(),
                                NReportTools.getInfoAsHTML(nreport)), SwingConstants.NORTH);
                    }
                });

                if (!nreport.getAttachedFilesConnections().isEmpty()) {
                    /***
                     *      _     _         _____ _ _
                     *     | |__ | |_ _ __ |  ___(_) | ___  ___
                     *     | '_ \| __| '_ \| |_  | | |/ _ \/ __|
                     *     | |_) | |_| | | |  _| | | |  __/\__ \
                     *     |_.__/ \__|_| |_|_|   |_|_|\___||___/
                     *
                     */
                    final JButton btnFiles = new JButton(
                            Integer.toString(nreport.getAttachedFilesConnections().size()),
                            SYSConst.icon22greenStar);
                    btnFiles.setToolTipText(SYSTools.xx("misc.btnfiles.tooltip"));
                    btnFiles.setForeground(Color.BLUE);
                    btnFiles.setHorizontalTextPosition(SwingUtilities.CENTER);
                    btnFiles.setFont(SYSConst.ARIAL18BOLD);
                    btnFiles.setPressedIcon(SYSConst.icon22Pressed);
                    btnFiles.setAlignmentX(Component.RIGHT_ALIGNMENT);
                    btnFiles.setAlignmentY(Component.TOP_ALIGNMENT);
                    btnFiles.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
                    btnFiles.setContentAreaFilled(false);
                    btnFiles.setBorder(null);

                    btnFiles.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent actionEvent) {
                            Closure fileHandleClosure = OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE,
                                    internalClassID) ? null : new Closure() {
                                        @Override
                                        public void execute(Object o) {
                                            EntityManager em = OPDE.createEM();
                                            final NReport myReport = em.find(NReport.class, nreport.getID());
                                            em.close();

                                            final String keyNewDay = DateFormat.getDateInstance()
                                                    .format(myReport.getPit());

                                            synchronized (contentmap) {
                                                contentmap.remove(keyNewDay);
                                            }
                                            synchronized (linemap) {
                                                linemap.remove(nreport);
                                            }

                                            synchronized (valuecache) {
                                                valuecache.get(keyNewDay).remove(nreport);
                                                valuecache.get(keyNewDay).add(myReport);
                                                Collections.sort(valuecache.get(keyNewDay));
                                            }

                                            createCP4Day(new LocalDate(myReport.getPit()));

                                            buildPanel();
                                            GUITools.flashBackground(linemap.get(myReport), Color.YELLOW, 2);
                                        }
                                    };
                            new DlgFiles(nreport, fileHandleClosure);
                        }
                    });
                    btnFiles.setEnabled(OPDE.isFTPworking());
                    pnlSingle.getRight().add(btnFiles);
                }

                if (!nreport.getAttachedQProcessConnections().isEmpty()) {
                    /***
                     *      _     _         ____
                     *     | |__ | |_ _ __ |  _ \ _ __ ___   ___ ___  ___ ___
                     *     | '_ \| __| '_ \| |_) | '__/ _ \ / __/ _ \/ __/ __|
                     *     | |_) | |_| | | |  __/| | | (_) | (_|  __/\__ \__ \
                     *     |_.__/ \__|_| |_|_|   |_|  \___/ \___\___||___/___/
                     *
                     */
                    final JButton btnProcess = new JButton(
                            Integer.toString(nreport.getAttachedQProcessConnections().size()),
                            SYSConst.icon22redStar);
                    btnProcess.setToolTipText(SYSTools.xx("misc.btnprocess.tooltip"));
                    btnProcess.setForeground(Color.YELLOW);
                    btnProcess.setHorizontalTextPosition(SwingUtilities.CENTER);
                    btnProcess.setFont(SYSConst.ARIAL18BOLD);
                    btnProcess.setPressedIcon(SYSConst.icon22Pressed);
                    btnProcess.setAlignmentX(Component.RIGHT_ALIGNMENT);
                    btnProcess.setAlignmentY(Component.TOP_ALIGNMENT);
                    btnProcess.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
                    btnProcess.setContentAreaFilled(false);
                    btnProcess.setBorder(null);
                    btnProcess.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent actionEvent) {
                            new DlgProcessAssign(nreport, new Closure() {
                                @Override
                                public void execute(Object o) {
                                    if (o == null) {
                                        return;
                                    }
                                    Pair<ArrayList<QProcess>, ArrayList<QProcess>> result = (Pair<ArrayList<QProcess>, ArrayList<QProcess>>) o;

                                    ArrayList<QProcess> assigned = result.getFirst();
                                    ArrayList<QProcess> unassigned = result.getSecond();

                                    EntityManager em = OPDE.createEM();

                                    try {
                                        em.getTransaction().begin();

                                        em.lock(em.merge(resident), LockModeType.OPTIMISTIC);
                                        NReport myReport = em.merge(nreport);
                                        em.lock(myReport, LockModeType.OPTIMISTIC_FORCE_INCREMENT);

                                        ArrayList<SYSNR2PROCESS> attached = new ArrayList<SYSNR2PROCESS>(
                                                myReport.getAttachedQProcessConnections());
                                        for (SYSNR2PROCESS linkObject : attached) {
                                            if (unassigned.contains(linkObject.getQProcess())) {
                                                linkObject.getQProcess().getAttachedNReportConnections()
                                                        .remove(linkObject);
                                                linkObject.getNReport().getAttachedQProcessConnections()
                                                        .remove(linkObject);
                                                em.merge(new PReport(
                                                        SYSTools.xx(PReportTools.PREPORT_TEXT_REMOVE_ELEMENT)
                                                                + ": " + nreport.getTitle() + " ID: "
                                                                + nreport.getID(),
                                                        PReportTools.PREPORT_TYPE_REMOVE_ELEMENT,
                                                        linkObject.getQProcess()));

                                                em.remove(linkObject);
                                            }
                                        }
                                        attached.clear();

                                        for (QProcess qProcess : assigned) {
                                            java.util.List<QProcessElement> listElements = qProcess
                                                    .getElements();
                                            if (!listElements.contains(myReport)) {
                                                QProcess myQProcess = em.merge(qProcess);
                                                SYSNR2PROCESS myLinkObject = em
                                                        .merge(new SYSNR2PROCESS(myQProcess, myReport));
                                                em.merge(new PReport(
                                                        SYSTools.xx(PReportTools.PREPORT_TEXT_ASSIGN_ELEMENT)
                                                                + ": " + nreport.getTitle() + " ID: "
                                                                + nreport.getID(),
                                                        PReportTools.PREPORT_TYPE_ASSIGN_ELEMENT, myQProcess));
                                                qProcess.getAttachedNReportConnections().add(myLinkObject);
                                                myReport.getAttachedQProcessConnections().add(myLinkObject);
                                            }
                                        }

                                        em.getTransaction().commit();

                                        final String keyNewDay = DateFormat.getDateInstance()
                                                .format(myReport.getPit());

                                        synchronized (contentmap) {
                                            contentmap.remove(keyNewDay);
                                        }
                                        synchronized (linemap) {
                                            linemap.remove(nreport);
                                        }

                                        synchronized (valuecache) {
                                            valuecache.get(keyNewDay).remove(nreport);
                                            valuecache.get(keyNewDay).add(myReport);
                                            Collections.sort(valuecache.get(keyNewDay));
                                        }

                                        createCP4Day(new LocalDate(myReport.getPit()));

                                        buildPanel();
                                        GUITools.flashBackground(linemap.get(myReport), Color.YELLOW, 2);
                                    } 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();
                                        } else {
                                            reloadDisplay(true);
                                        }
                                    } catch (RollbackException 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();
                                    }

                                }
                            });
                        }
                    });
                    btnProcess.setEnabled(
                            OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID));
                    pnlSingle.getRight().add(btnProcess);
                }

                /***
                 *      __  __
                 *     |  \/  | ___ _ __  _   _
                 *     | |\/| |/ _ \ '_ \| | | |
                 *     | |  | |  __/ | | | |_| |
                 *     |_|  |_|\___|_| |_|\__,_|
                 *
                 */
                final JButton btnMenu = new JButton(SYSConst.icon22menu);
                btnMenu.setPressedIcon(SYSConst.icon22Pressed);
                btnMenu.setAlignmentX(Component.RIGHT_ALIGNMENT);
                btnMenu.setAlignmentY(Component.TOP_ALIGNMENT);
                btnMenu.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
                btnMenu.setContentAreaFilled(false);
                btnMenu.setBorder(null);
                btnMenu.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        JidePopup popup = new JidePopup();
                        popup.setMovable(false);
                        popup.getContentPane()
                                .setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS));
                        popup.setOwner(btnMenu);
                        popup.removeExcludedComponent(btnMenu);
                        JPanel pnl = getMenu(nreport);
                        popup.getContentPane().add(pnl);
                        popup.setDefaultFocusComponent(pnl);

                        GUITools.showPopup(popup, SwingConstants.WEST);
                    }
                });
                btnMenu.setEnabled(!nreport.isObsolete());
                pnlSingle.getRight().add(btnMenu);

                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);
                linemap.put(nreport, pnlSingle.getMain());
            }
        }
    }
    synchronized (contentmap) {
        contentmap.put(key, dayPanel);
    }
    return dayPanel;
}

From source file:org.kalypso.kalypsomodel1d2d.conv.results.ResultMeta1d2dHelper.java

public static void addToResultDB(final IStepResultMeta stepResultMeta, final Date stepDate,
        final File outputDir) {
    // TODO: retrieve time zone from central plugin preferences
    final DateFormat dateFormatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG);
    dateFormatter.setTimeZone(KalypsoCorePlugin.getDefault().getTimeZone());

    if (ResultManager.STEADY_DATE.equals(stepDate)) {
        stepResultMeta.setName(/*from  w  ww . jav a  2 s  .c o  m*/
                Messages.getString("org.kalypso.kalypsomodel1d2d.conv.results.ResultMeta1d2dHelper.93")); //$NON-NLS-1$
        stepResultMeta.setDescription(
                Messages.getString("org.kalypso.kalypsomodel1d2d.conv.results.ResultMeta1d2dHelper.94")); //$NON-NLS-1$
        stepResultMeta.setStepType(IStepResultMeta.STEPTYPE.steady);
        stepResultMeta.setStepTime(null);
    } else if (ResultManager.MAXI_DATE.equals(stepDate)) {
        stepResultMeta.setName(
                Messages.getString("org.kalypso.kalypsomodel1d2d.conv.results.ResultMeta1d2dHelper.95")); //$NON-NLS-1$
        stepResultMeta.setDescription(
                Messages.getString("org.kalypso.kalypsomodel1d2d.conv.results.ResultMeta1d2dHelper.96")); //$NON-NLS-1$
        stepResultMeta.setStepType(IStepResultMeta.STEPTYPE.maximum);
        stepResultMeta.setStepTime(null);
    } else {
        // TODO: check for right time zone
        final String dateString = dateFormatter.format(stepDate);
        stepResultMeta.setName(Messages
                .getString("org.kalypso.kalypsomodel1d2d.conv.results.ResultMeta1d2dHelper.97", dateString)); //$NON-NLS-1$
        stepResultMeta.setDescription(
                Messages.getString("org.kalypso.kalypsomodel1d2d.conv.results.ResultMeta1d2dHelper.98") //$NON-NLS-1$
                        + dateString);
        stepResultMeta.setStepType(IStepResultMeta.STEPTYPE.unsteady);
        stepResultMeta.setStepTime(stepDate);
    }

    stepResultMeta.setPath(new Path(outputDir.getName()));
}

From source file:com.lp.client.frame.component.PanelDokumentenablage.java

private void dto2Components() {
    try {/* www.  j  a va  2 s  .c  o m*/
        JCRDocDto dataJCR = DelegateFactory.getInstance().getJCRDocDelegate().getData(jcrDocDto);
        if (dataJCR != null) {
            jcrDocDto = dataJCR;
        }
    } catch (Throwable t) {
    }
    if (jcrDocDto.getbData() != null) {
        if (file == null) {
            try {
                file = File.createTempFile(jcrDocDto.getsFilename(), jcrDocDto.getsMIME());
                FileOutputStream fosFileGetter = new FileOutputStream(file);
                fosFileGetter.write(jcrDocDto.getbData());
                fosFileGetter.close();
            } catch (Exception e) {
            }
        }
    }
    PersonalDto anlegerDto = null;
    try {
        anlegerDto = DelegateFactory.getInstance().getPersonalDelegate()
                .personalFindByPrimaryKey(new Integer((int) jcrDocDto.getlAnleger()));
    } catch (Throwable e1) {

    }
    if (anlegerDto == null) {
        wtfAnleger.setText("");
    } else {
        wtfAnleger.setText(anlegerDto.getCKurzzeichen());
    }
    try {
        if (jcrDocDto.getlPartner() != null) {
            partnerDto = DelegateFactory.getInstance().getPartnerDelegate()
                    .partnerFindByPrimaryKey(jcrDocDto.getlPartner().intValue());
        }
    } catch (ExceptionLP e) {
        // e.printStackTrace();
    }
    if (partnerDto != null) {
        wtfPartner.setText(partnerDto.formatFixTitelName1Name2());
    } else {
        wtfPartner.setText("");
    }
    DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.GERMANY);
    wdfZeitpunkt.setText(df.format(new Timestamp(jcrDocDto.getlZeitpunkt())));
    wtfBelegnummer.setText(jcrDocDto.getsBelegnummer());
    wtfSchlagworte.setText(jcrDocDto.getsSchlagworte());
    wtfName.setText(jcrDocDto.getsName());
    wtfFilename.setText(jcrDocDto.getsFilename());
    wtfTable.setText(
            (jcrDocDto.getsTable() == null || jcrDocDto.getsTable().isEmpty()) ? " " : jcrDocDto.getsTable());
    wtfRow.setText(jcrDocDto.getsRow());
    wtfMIME.setText(jcrDocDto.getsMIME());
    wcbVersteckt.setSelected(jcrDocDto.getbVersteckt());
    if (jcrDocDto.getlSicherheitsstufe() == JCRDocFac.SECURITY_ARCHIV) {
        wcbSicherheitsstufe.addItem(JCRDocFac.SECURITY_ARCHIV);
    }
    wcbSicherheitsstufe.setSelectedItem(jcrDocDto.getlSicherheitsstufe());
    if (JCRDocFac.DEFAULT_ARCHIV_BELEGART.equals(jcrDocDto.getsBelegart())) {
        wcbBelegart.addItem(JCRDocFac.DEFAULT_ARCHIV_BELEGART);
    }
    wcbBelegart.setSelectedItem(jcrDocDto.getsBelegart());
    wcbGruppierung.setSelectedItem(jcrDocDto.getsGruppierung());
    try {
        if (".JPG".equals(jcrDocDto.getsMIME().toUpperCase())
                || ".JPEG".equals(jcrDocDto.getsMIME().toUpperCase())) {
            wmcMedia.setMimeType(MediaFac.DATENFORMAT_MIMETYPE_IMAGE_JPEG);
            wmcMedia.setOMedia(Helper.getBytesFromFile(file));
        } else if (".JRPRINT".equals(jcrDocDto.getsMIME().toUpperCase())) {
            wmcMedia.setMimeType(MediaFac.DATENFORMAT_MIMETYPE_APP_JASPER);
            wmcMedia.setOMedia(Helper.getBytesFromFile(file));
        } else {
            wmcMedia.setMimeType(null);
        }
    } catch (Throwable e) {
    }
}

From source file:com.aurel.track.prop.LoginBL.java

private static String getLocaleDatePattern(Locale locale) {
    DateFormat guiDateFormat = DateFormat.getDateInstance(DateFormat.SHORT, locale);
    // GUI calendar date format: 4 digits year
    String s = ((SimpleDateFormat) guiDateFormat).toPattern();
    // be sure the format is short
    s = s.replaceAll("dd", "d");
    s = s.replaceAll("MM", "M");
    s = s.replaceAll("YYYY", "YY");
    s = s.replaceAll("yyyy", "yy");
    // replace the format to be dd.MM.yyyy
    s = s.replaceAll("d", "dd");
    s = s.replaceAll("M", "MM");
    s = s.replaceAll("YY", "YYYY");
    s = s.replaceAll("yy", "yyyy");// most imoportant: 4 digits year
    return s;//from www.j a va  2  s  .com
}

From source file:com.bizosys.hsearch.index.IndexReaderTest.java

public void testModifiedBefore() throws Exception {
    String id = "ID023";

    DateFormat format = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);

    HDocument doc1 = new HDocument(ANONYMOUS);
    doc1.key = "Id 1 : " + id;
    doc1.title = "My Trading balance as 234.00";
    doc1.modifiedOn = new Date();
    IndexWriter.getInstance().insert(doc1, acc, isMultiClient);

    String myBirth = new Long(format.parse("Feb 05, 1977 8:00 PM").getTime()).toString();
    QueryResult res1 = IndexReader.getInstance()
            .search(new QueryContext(acc, "modifiedb:" + myBirth + " balance"));
    assertEquals(0, res1.teasers.length);

    String future = new Long(format.parse("Feb 05, 2121 8:00 PM").getTime()).toString();
    QueryResult res2 = IndexReader.getInstance()
            .search(new QueryContext(acc, "modifiedb:" + future + " balance"));
    assertEquals(1, res2.teasers.length);

    IndexWriter.getInstance().delete(ANONYMOUS, doc1.key, isMultiClient);
}

From source file:main.java.edu.isistan.genCom.gui.Principal.java

/**
  * Registra la generacin en el historial
  *///from w w w.  j a v a2  s.  com
 private void cargarHistorial() {
     ConfiguracionAG conf = generacionCargada.getConfiguracion();

     // Carga la tabla de historial
     DefaultTableModel dtmLog = (DefaultTableModel) tbHistorial.getModel();

     dtmLog.addRow(new String[] {
             DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG)
                     .format(generacionCargada.getFecha()),
             conf.getCruce().toString(), conf.getMutacion().toString(), conf.getSeleccion().toString(),
             conf.getModelo().toString(), String.valueOf(generacionCargada.getEjecuciones().size()),
             String.valueOf(conf.getCorte()), generacionCargada.getConfiguracion().getFitness().toString(),
             String.valueOf(generacionCargada.getFitnessPromedio()),
             String.valueOf(generacionCargada.getFitnessDesviacion()) });
 }

From source file:org.sakaiproject.cheftool.VelocityPortletPaneledAction.java

public String[] getDateFormatString() {
    SimpleDateFormat sdf = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, rb.getLocale());
    String[] formatArray = sdf.toPattern().split("[/\\-\\.]");
    for (int i = 0; i < formatArray.length; i++)
        formatArray[i] = formatArray[i].trim().substring(0, 1).toLowerCase();

    if (formatArray.length != DEFAULT_FORMAT_ARRAY.length) {
        M_log.warn("Unknown date format string (using default): " + sdf.toPattern());
        return DEFAULT_FORMAT_ARRAY;
    } else {/*w w  w  .  j a v a  2 s  .  c om*/
        return formatArray;
    }
}