Example usage for java.text DateFormat LONG

List of usage examples for java.text DateFormat LONG

Introduction

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

Prototype

int LONG

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

Click Source Link

Document

Constant for long style pattern.

Usage

From source file:org.hyperic.hq.livedata.formatters.TopFormatter.java

private String formatHtml(ConfigResponse cfg, TopData t) {
    StringBuffer r = new StringBuffer();
    DateFormat dateFmt = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
    UptimeData utd = t.getUptime();/*from   ww  w  . j  a  v a2 s .  c om*/

    r.append("<div class='top_livedata'><div class='fivepad' style='background:#efefef;'><b>Time</b>: ")
            .append(h(dateFmt.format(new Date(utd.getTime())))).append(" up ")
            .append(h(utd.getFormattedUptime())).append("<br/>");

    r.append("<b>Load Avg</b>: ").append(h(utd.getFormattedLoadavg())).append("<br/>");

    CpuPerc cpu = t.getCpu();
    r.append("<b>CPU States</b>: ")
            .append(h(BUNDLE.format("formatter.top.cpuStates", CpuPerc.format(cpu.getUser()),
                    CpuPerc.format(cpu.getSys()), CpuPerc.format(cpu.getNice()), CpuPerc.format(cpu.getWait()),
                    CpuPerc.format(cpu.getIdle()))))
            .append("<br/>");

    Mem mem = t.getMem();
    r.append("<b>Mem</b>: ").append(h(BUNDLE.format("formatter.top.memUse", (mem.getTotal() / 1024) + "k",
            (mem.getUsed() / 1024) + "k", (mem.getFree() / 1024) + "k"))).append("<br/>");

    Swap swap = t.getSwap();
    r.append("<b>Swap</b>: ").append(h(BUNDLE.format("formatter.top.memUse", (swap.getTotal() / 1024) + "k",
            (swap.getUsed() / 1024) + "k", (swap.getFree() / 1024) + "k"))).append("<br/>");

    ProcStat ps = t.getProcStat();
    r.append("<b>Processes</b>: ").append(h(BUNDLE.format("formatter.top.procSummary", "" + ps.getTotal(),
            "" + ps.getRunning(), "" + ps.getSleeping(), "" + ps.getStopped(), "" + ps.getZombie())))
            .append("<br/><br/>");

    r.append("</div><table cellpadding='0' cellspacing='0' width='100%'><thead><tr><td>")
            .append(BUNDLE.format("formatter.top.proc.pid")).append("</td><td>")
            .append(BUNDLE.format("formatter.top.proc.user")).append("</td><td>")
            .append(BUNDLE.format("formatter.top.proc.stime")).append("</td><td>")
            .append(BUNDLE.format("formatter.top.proc.size")).append("</td><td>")
            .append(BUNDLE.format("formatter.top.proc.rss")).append("</td><td>")
            .append(BUNDLE.format("formatter.top.proc.share")).append("</td><td>")
            .append(BUNDLE.format("formatter.top.proc.state")).append("</td><td>")
            .append(BUNDLE.format("formatter.top.proc.time")).append("</td><td>")
            .append(BUNDLE.format("formatter.top.proc.cpu")).append("</td><td>")
            .append(BUNDLE.format("formatter.top.proc.mem")).append("</td><td>")
            .append(BUNDLE.format("formatter.top.proc.name")).append("</td></tr></thead><tbody>");

    for (Object element : t.getProcesses()) {
        ProcessData d = (ProcessData) element;
        char[] buf = new char[1];
        buf[0] = d.getState();
        String str = new String(buf);
        char stateStr = ((str.trim().length() == 0) ? '-' : d.getState());
        r.append("<tr><td>").append(d.getPid()).append("</td>").append("<td>").append(d.getOwner())
                .append("</td>").append("<td>").append(d.getFormattedStartTime()).append("</td>").append("<td>")
                .append(d.getFormattedSize()).append("</td>").append("<td>").append(d.getFormattedResident())
                .append("</td>").append("<td>").append(d.getFormattedShare()).append("</td>").append("<td>")
                .append(stateStr).append("</td>").append("<td>").append(d.getFormattedCpuTotal())
                .append("</td>").append("<td>").append(d.getFormattedCpuPerc()).append("</td>").append("<td>")
                .append(d.getFormattedMemPerc()).append("</td>").append("<td>").append(h(d.getBaseName()))
                .append("</td></tr>");
    }

    r.append("</tbody></table></div>");
    return r.toString();
}

From source file:org.sakaiproject.evaluation.tool.SetupEvalBean.java

/**
 * sets he locale on the date formatter correctly
 */
public void init() {
    df = DateFormat.getDateInstance(DateFormat.LONG, locale);
}

From source file:org.openmrs.module.reportingcompatibility.reporting.export.DataExportFunctions.java

public DataExportFunctions() {
    this.rcs = Context.getService(ReportingCompatibilityService.class);
    this.patientService = Context.getPatientService();
    this.conceptService = Context.getConceptService();
    this.encounterService = Context.getEncounterService();
    this.personService = Context.getPersonService();

    locale = Context.getLocale();
    dateFormatLong = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
    dateFormatShort = Context.getDateFormat();
    dateFormatYmd = new SimpleDateFormat("yyyy-MM-dd", locale);
}

From source file:qtiscoringengine.QTIUtility.java

public static String getUniqueFileName(String fileNamePrefix, String fileExtension) {
    Date d = Calendar.getInstance().getTime();
    long now = System.currentTimeMillis();
    return "QTIScoringEngine_" + fileNamePrefix + "_"
            + DateFormat.getDateInstance(DateFormat.SHORT).format(d).replace("/", "-") + "_"
            + DateFormat.getTimeInstance(DateFormat.LONG).format(d).replace(" ", "").replace(":", "_")
            + fileExtension;//from ww  w  . ja  va 2  s .com
}

From source file:useraccess.ejb.RegistrationBean.java

/**
 * Notifies by email to the validator users the new registration.
 * //from   w  w w  .  ja va  2s. co  m
 */
public void notifyNewValidationNeeded() {
    //Gets the email addresses for admin users
    String emailList = getAdminsEmails();
    if (emailList != null) {
        String subject = "Nuevos registros en ECUSA";
        DateFormat dateFormatter = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT);
        Date timeStamp = new Date();
        String messageBody = "Se han producido nuevos registros en ECUSA el " + dateFormatter.format(timeStamp)
                + ".\n" + "Dichos registros estn disponibles para su validacin.\n" + "\n Saludos.";
        this.mailSender.sendMail(emailList, subject, messageBody);
    }
}

From source file:com.pos.spatobiz.app.view.karyawan.HapusKaryawan.java

/** This method is called from within the constructor to
 * initialize the form./*from   w  ww.  j av  a2 s  .c  o m*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jeniskelamin = new ButtonGroup();
    labelKode = new WhiteLabel();
    labelNama = new WhiteLabel();
    labelTanggalLahir = new WhiteLabel();
    labelAlamat = new WhiteLabel();
    textKode = new TextBoxTransfer();
    textNama = new TextBoxTransfer();
    textTanggalLahir = new DateBox();
    textAlamat = new WhiteTextArea();
    textTelepon = new TextBoxTransfer();
    labelTelepon = new WhiteLabel();
    labelEmail = new WhiteLabel();
    labelJenisKelamin = new WhiteLabel();
    labelPhoto = new WhiteLabel();
    textEmail = new TextBoxTransfer();
    radioPria = new JRadioButton();
    radioWanita = new JRadioButton();
    imageChooser = new ImageChooser();
    buttonBatal = new Button();
    buttonHapus = new Button();
    buttonCari = new Button();

    setBackground(new Color(0, 0, 0));

    labelKode.setHorizontalAlignment(SwingConstants.RIGHT);
    labelKode.setText("Kode :");

    labelNama.setHorizontalAlignment(SwingConstants.RIGHT);
    labelNama.setText("Nama :");

    labelTanggalLahir.setHorizontalAlignment(SwingConstants.RIGHT);
    labelTanggalLahir.setText("Tanggal Lahir :");

    labelAlamat.setHorizontalAlignment(SwingConstants.RIGHT);
    labelAlamat.setText("Alamat :");

    textNama.setEnabled(false);

    textTanggalLahir.setEnabled(false);
    textTanggalLahir.setFormatterFactory(
            new DefaultFormatterFactory(new DateFormatter(DateFormat.getDateInstance(DateFormat.LONG))));
    textTanggalLahir.setPreferredSize(new Dimension(120, 24));
    textTanggalLahir.setValue(new Date());

    textAlamat.setEnabled(false);

    textTelepon.setEnabled(false);

    labelTelepon.setHorizontalAlignment(SwingConstants.RIGHT);
    labelTelepon.setText("Telepon :");

    labelEmail.setHorizontalAlignment(SwingConstants.RIGHT);
    labelEmail.setText("Email :");

    labelJenisKelamin.setHorizontalAlignment(SwingConstants.RIGHT);
    labelJenisKelamin.setText("Jenis Kelamin :");

    labelPhoto.setHorizontalAlignment(SwingConstants.RIGHT);
    labelPhoto.setText("Photo :");

    textEmail.setEnabled(false);

    jeniskelamin.add(radioPria);
    radioPria.setFont(new Font("Tahoma", 1, 11));
    radioPria.setForeground(new Color(255, 255, 255));
    radioPria.setSelected(true);
    radioPria.setText("Pria");
    radioPria.setEnabled(false);
    radioPria.setOpaque(false);

    jeniskelamin.add(radioWanita);
    radioWanita.setFont(new Font("Tahoma", 1, 11));
    radioWanita.setForeground(new Color(255, 255, 255));
    radioWanita.setText("Wanita");
    radioWanita.setEnabled(false);
    radioWanita.setOpaque(false);

    imageChooser.setEnabled(false);

    buttonBatal.setMnemonic('B');
    buttonBatal.setText("Batal");

    buttonHapus.setMnemonic('H');
    buttonHapus.setText("Hapus");

    buttonCari.setText("Cari");

    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
            layout.createParallelGroup(Alignment.LEADING)
                    .addGroup(
                            Alignment.TRAILING, layout
                                    .createSequentialGroup().addContainerGap().addGroup(layout
                                            .createParallelGroup(Alignment.TRAILING).addGroup(layout
                                                    .createSequentialGroup().addComponent(
                                                            buttonHapus, GroupLayout.PREFERRED_SIZE,
                                                            GroupLayout.DEFAULT_SIZE,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(
                                                            buttonBatal, GroupLayout.PREFERRED_SIZE,
                                                            GroupLayout.DEFAULT_SIZE,
                                                            GroupLayout.PREFERRED_SIZE))
                                            .addGroup(layout.createSequentialGroup().addGroup(layout
                                                    .createParallelGroup(Alignment.LEADING).addGroup(layout
                                                            .createParallelGroup(Alignment.TRAILING, false)
                                                            .addComponent(labelPhoto, Alignment.LEADING,
                                                                    GroupLayout.DEFAULT_SIZE,
                                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                            .addComponent(labelJenisKelamin, Alignment.LEADING,
                                                                    GroupLayout.DEFAULT_SIZE,
                                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                            .addComponent(
                                                                    labelEmail, Alignment.LEADING,
                                                                    GroupLayout.DEFAULT_SIZE,
                                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                                    .addGroup(layout
                                                            .createParallelGroup(Alignment.TRAILING, false)
                                                            .addComponent(labelTelepon,
                                                                    GroupLayout.DEFAULT_SIZE,
                                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                            .addComponent(labelTanggalLahir, Alignment.LEADING,
                                                                    GroupLayout.DEFAULT_SIZE,
                                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                            .addComponent(labelAlamat, Alignment.LEADING,
                                                                    GroupLayout.DEFAULT_SIZE,
                                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                            .addComponent(labelNama, Alignment.LEADING,
                                                                    GroupLayout.DEFAULT_SIZE,
                                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                            .addComponent(
                                                                    labelKode, Alignment.LEADING,
                                                                    GroupLayout.DEFAULT_SIZE,
                                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                                                    .addPreferredGap(ComponentPlacement.RELATED)
                                                    .addGroup(layout.createParallelGroup(Alignment.TRAILING)
                                                            .addComponent(textAlamat, Alignment.LEADING,
                                                                    GroupLayout.DEFAULT_SIZE,
                                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                            .addComponent(textNama, Alignment.LEADING,
                                                                    GroupLayout.DEFAULT_SIZE, 552,
                                                                    Short.MAX_VALUE)
                                                            .addComponent(textTanggalLahir, Alignment.LEADING,
                                                                    GroupLayout.DEFAULT_SIZE, 552,
                                                                    Short.MAX_VALUE)
                                                            .addComponent(textTelepon, GroupLayout.DEFAULT_SIZE,
                                                                    552, Short.MAX_VALUE)
                                                            .addGroup(Alignment.LEADING, layout
                                                                    .createSequentialGroup()
                                                                    .addComponent(radioPria)
                                                                    .addPreferredGap(
                                                                            ComponentPlacement.UNRELATED)
                                                                    .addComponent(radioWanita))
                                                            .addComponent(
                                                                    imageChooser, Alignment.LEADING,
                                                                    GroupLayout.PREFERRED_SIZE, 253,
                                                                    GroupLayout.PREFERRED_SIZE)
                                                            .addComponent(textEmail, GroupLayout.DEFAULT_SIZE,
                                                                    552, Short.MAX_VALUE)
                                                            .addGroup(layout.createSequentialGroup()
                                                                    .addComponent(textKode,
                                                                            GroupLayout.DEFAULT_SIZE, 488,
                                                                            Short.MAX_VALUE)
                                                                    .addPreferredGap(
                                                                            ComponentPlacement.UNRELATED)
                                                                    .addComponent(buttonCari,
                                                                            GroupLayout.PREFERRED_SIZE,
                                                                            GroupLayout.DEFAULT_SIZE,
                                                                            GroupLayout.PREFERRED_SIZE)))))
                                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout
            .createSequentialGroup().addContainerGap()
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(labelKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(textKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonCari, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(labelNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(textNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(labelTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(textTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                    .addComponent(labelAlamat, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(textAlamat, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(textTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(labelEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(textEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(labelJenisKelamin, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(radioPria).addComponent(radioWanita))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                    .addComponent(labelPhoto, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(imageChooser, GroupLayout.PREFERRED_SIZE, 189, GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(buttonBatal, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonHapus, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addContainerGap()));
}

From source file:com.pos.spatobiz.app.view.karyawan.TambahKaryawan.java

/** This method is called from within the constructor to
 * initialize the form./* w w w. j a va 2s .com*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jeniskelamin = new ButtonGroup();
    labelKode = new WhiteLabel();
    labelNama = new WhiteLabel();
    labelTanggalLahir = new WhiteLabel();
    labelAlamat = new WhiteLabel();
    textKode = new TextBoxTransfer();
    textNama = new TextBoxTransfer();
    textTanggalLahir = new DateBox();
    textAlamat = new WhiteTextArea();
    errorKode = new RedLabel();
    errorNama = new RedLabel();
    errorTanggalLahir = new RedLabel();
    errorAlamat = new RedLabel();
    textTelepon = new TextBoxTransfer();
    labelTelepon = new WhiteLabel();
    labelEmail = new WhiteLabel();
    labelJenisKelamin = new WhiteLabel();
    labelPhoto = new WhiteLabel();
    textEmail = new TextBoxTransfer();
    radioPria = new JRadioButton();
    radioWanita = new JRadioButton();
    errorTelepon = new RedLabel();
    errorEmail = new RedLabel();
    imageChooser = new ImageChooser();
    buttonBatal = new Button();
    buttonTambah = new Button();

    setBackground(new Color(0, 0, 0));

    labelKode.setHorizontalAlignment(SwingConstants.RIGHT);
    labelKode.setText("Kode :");

    labelNama.setHorizontalAlignment(SwingConstants.RIGHT);
    labelNama.setText("Nama :");

    labelTanggalLahir.setHorizontalAlignment(SwingConstants.RIGHT);
    labelTanggalLahir.setText("Tanggal Lahir :");

    labelAlamat.setHorizontalAlignment(SwingConstants.RIGHT);
    labelAlamat.setText("Alamat :");

    textTanggalLahir.setFormatterFactory(
            new DefaultFormatterFactory(new DateFormatter(DateFormat.getDateInstance(DateFormat.LONG))));
    textTanggalLahir.setPreferredSize(new Dimension(120, 24));
    textTanggalLahir.setValue(new Date());

    errorKode.setText("error kode");

    errorNama.setText("error nama");

    errorTanggalLahir.setText("error tanggal lahir");

    errorAlamat.setText("error alamat");

    labelTelepon.setHorizontalAlignment(SwingConstants.RIGHT);
    labelTelepon.setText("Telepon :");

    labelEmail.setHorizontalAlignment(SwingConstants.RIGHT);
    labelEmail.setText("Email :");

    labelJenisKelamin.setHorizontalAlignment(SwingConstants.RIGHT);
    labelJenisKelamin.setText("Jenis Kelamin :");

    labelPhoto.setHorizontalAlignment(SwingConstants.RIGHT);
    labelPhoto.setText("Photo :");

    jeniskelamin.add(radioPria);
    radioPria.setFont(new Font("Tahoma", 1, 11)); // NOI18N
    radioPria.setForeground(new Color(255, 255, 255));
    radioPria.setSelected(true);
    radioPria.setText("Pria");
    radioPria.setOpaque(false);

    jeniskelamin.add(radioWanita);
    radioWanita.setFont(new Font("Tahoma", 1, 11));
    radioWanita.setForeground(new Color(255, 255, 255));
    radioWanita.setText("Wanita");
    radioWanita.setOpaque(false);

    errorTelepon.setText("error telepon");

    errorEmail.setText("error email");

    buttonBatal.setMnemonic('B');
    buttonBatal.setText("Batal");

    buttonTambah.setMnemonic('T');
    buttonTambah.setText("Tambah");

    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout
            .createSequentialGroup().addContainerGap()
            .addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING,
                    layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.LEADING)
                            .addGroup(layout.createParallelGroup(Alignment.TRAILING, false)
                                    .addComponent(labelPhoto, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labelJenisKelamin, Alignment.LEADING,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labelEmail, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(layout.createParallelGroup(Alignment.TRAILING, false)
                                    .addComponent(labelTelepon, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labelTanggalLahir, Alignment.LEADING,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labelAlamat, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labelNama, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labelKode, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                            .addPreferredGap(ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(Alignment.TRAILING)
                                    .addComponent(textAlamat, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 403,
                                            Short.MAX_VALUE)
                                    .addComponent(textNama, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 403,
                                            Short.MAX_VALUE)
                                    .addComponent(textTanggalLahir, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            403, Short.MAX_VALUE)
                                    .addComponent(textKode, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 403,
                                            Short.MAX_VALUE)
                                    .addComponent(textTelepon, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)
                                    .addGroup(Alignment.LEADING,
                                            layout.createSequentialGroup().addComponent(radioPria)
                                                    .addPreferredGap(ComponentPlacement.UNRELATED)
                                                    .addComponent(radioWanita))
                                    .addComponent(imageChooser, Alignment.LEADING, GroupLayout.PREFERRED_SIZE,
                                            253, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(textEmail, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE))
                            .addGap(4, 4, 4)
                            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                                    .addComponent(errorKode, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(errorNama, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(errorTanggalLahir, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(errorAlamat, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(errorTelepon, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(errorEmail, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                    .addGroup(Alignment.TRAILING, layout.createSequentialGroup()
                            .addComponent(buttonTambah, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.RELATED).addComponent(buttonBatal,
                                    GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE)))
            .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout
            .createSequentialGroup().addContainerGap()
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(labelKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(textKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(errorKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(labelNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(textNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(errorNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(labelTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(textTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(errorTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                    .addComponent(labelAlamat, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(textAlamat, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE)
                    .addComponent(errorAlamat, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(textTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(errorTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(labelEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(textEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(errorEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(labelJenisKelamin, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(radioPria).addComponent(radioWanita))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                    .addComponent(labelPhoto, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(imageChooser, GroupLayout.PREFERRED_SIZE, 189, GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(buttonBatal, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonTambah, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addContainerGap()));
}

From source file:org.apache.cocoon.generation.CalendarGenerator.java

/**
 * Set the request parameters. Must be called before the generate method.
 *
 * @param resolver     the SourceResolver object
 * @param objectModel  a <code>Map</code> containing model object
 * @param src          the source URI (ignored)
 * @param par          configuration parameters
 *///from  w ww.  j a v  a2 s.  co  m
public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
        throws ProcessingException, SAXException, IOException {
    super.setup(resolver, objectModel, src, par);

    this.cacheKeyParList = new ArrayList();
    this.cacheKeyParList.add(src);

    // Determine the locale
    String langString = par.getParameter("lang", null);
    locale = Locale.getDefault();
    if (langString != null) {
        this.cacheKeyParList.add(langString);
        String countryString = par.getParameter("country", "");
        if (!"".equals(countryString)) {
            this.cacheKeyParList.add(countryString);
        }
        locale = new Locale(langString, countryString);
    }

    // Determine year and month. Default is current year and month.
    Calendar now = Calendar.getInstance(locale);
    this.year = par.getParameterAsInteger("year", now.get(Calendar.YEAR));
    this.cacheKeyParList.add(String.valueOf(this.year));
    this.month = par.getParameterAsInteger("month", now.get(Calendar.MONTH) + 1) - 1;
    this.cacheKeyParList.add(String.valueOf(this.month));

    String dateFormatString = par.getParameter("dateFormat", null);
    this.cacheKeyParList.add(dateFormatString);
    if (dateFormatString != null) {
        this.dateFormatter = new SimpleDateFormat(dateFormatString, locale);
    } else {
        this.dateFormatter = DateFormat.getDateInstance(DateFormat.LONG, locale);
    }
    this.padWeeks = par.getParameterAsBoolean("padWeeks", false);
    this.cacheKeyParList.add(BooleanUtils.toBooleanObject(this.padWeeks));
    this.monthFormatter = new SimpleDateFormat("MMMM", locale);
    this.attributes = new AttributesImpl();
}

From source file:ilearn.orb.controller.AnnotationController.java

@RequestMapping(value = "/annotated/{userid}", method = RequestMethod.POST)
public ModelAndView annotatedText(Locale locale, ModelMap modelMap, HttpServletRequest request,
        HttpSession session, @PathVariable("userid") Integer userid) {
    try {/*w  w  w . j a  v  a  2 s .  c  o  m*/
        request.setCharacterEncoding("UTF-8");
    } catch (UnsupportedEncodingException e1) {
        e1.printStackTrace();
    }
    ActiveRule activeRules[] = null;
    String activatedRules = request.getParameter("activeRules");
    if (!activatedRules.trim().isEmpty()) {
        String p[] = activatedRules.trim().split(",");
        activeRules = new ActiveRule[p.length];
        for (int i = 0; i < p.length; i++) {
            activeRules[i] = new ActiveRule();
            String q[] = p[i].trim().split("_");
            activeRules[i].category = Integer.parseInt(q[0]);
            activeRules[i].index = Integer.parseInt(q[1]);
            activeRules[i].rule = Integer.parseInt(q[2]);
            activeRules[i].color = Integer.parseInt(q[3].substring(1), 16);
        }
    }
    ModelAndView model = new ModelAndView();
    model.setViewName("annotated");
    try {
        Gson gson = new GsonBuilder().registerTypeAdapter(java.util.Date.class, new UtilDateDeserializer())
                .setDateFormat(DateFormat.LONG).create();
        User[] students = null;
        try {
            String json = UserServices.getProfiles(Integer.parseInt(session.getAttribute("id").toString()),
                    session.getAttribute("auth").toString());
            students = gson.fromJson(json, User[].class);
        } catch (NullPointerException e) {
        }
        if (students == null || students.length == 0) {
            students = HardcodedUsers.defaultStudents();
        }
        modelMap.put("students", students);
        String text = request.getParameter("inputText");
        if (text != null) {
            text = new String(text.getBytes("8859_1"), "UTF-8");
        } else
            text = "";

        modelMap.put("profileId", userid);
        modelMap.put("text", text);
        UserProfile pr = retrieveProfile(session, userid);
        String annotatedJson;
        if (userid > 0)
            annotatedJson = TextServices.getAnnotatedText(userid,
                    pr.getLanguage() == LanguageCode.EN ? "EN" : "GR", session.getAttribute("auth").toString(),
                    text);
        else
            annotatedJson = TextServices.getAnnotatedText(HardcodedUsers.defaultProfileLanguage(userid), text);
        annotatedPack = (new Gson()).fromJson(annotatedJson, AnnotatedPack.class);
        txModule = new TextAnnotationModule();
        txModule.setProfile(pr);
        txModule.initializePresentationModule();
        txModule.setInputHTMLFile(annotatedPack.getHtml());
        txModule.setJSonObject(annotatedPack.getWordSet());
        if (activeRules != null && activeRules.length > 0) {
            for (ActiveRule ar : activeRules) {
                txModule.getPresentationRulesModule().setPresentationRule(ar.category, ar.index, ar.rule);
                txModule.getPresentationRulesModule().setTextColor(ar.category, ar.index, ar.color);
                txModule.getPresentationRulesModule().setHighlightingColor(ar.category, ar.index, ar.color);
                txModule.getPresentationRulesModule().setActivated(ar.category, ar.index, true);
            }
        }
        txModule.annotateText();
        String result = new String(txModule.getAnnotatedHTMLFile());
        modelMap.put("annotatedText", result);
    } catch (NumberFormatException e) {
        //e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return model;
}

From source file:eu.e43.impeller.Utils.java

public static String humanDate(long milis) {
    return DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT).format(new Date(milis))
            .replace(' ', '\u00A0');
}