List of usage examples for java.text DateFormat LONG
int LONG
To view the source code for java.text DateFormat LONG.
Click Source Link
From source file:op.FrmMain.java
public FrmMain() { initPhase = true;//from ww w.j a v a 2s .c o m initComponents(); if (OPDE.isTraining()) { pnlMainMessage.setBackground(SYSConst.mediumorchid2.brighter().brighter()); } // pbTimeout.setToolTipText(SYSTools.xx("opde.mainframe.pbTimeout.tooltip")); // for the timeout function Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { if (OPDE.getLogin() != null) { displayManager.touch(); } } }, AWTEvent.MOUSE_MOTION_EVENT_MASK); Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { if (OPDE.getLogin() != null) { displayManager.touch(); } } }, AWTEvent.KEY_EVENT_MASK); currentVisiblePanel = null; currentResident = null; lblWait.setText(SYSTools.xx("misc.msg.wait")); lblWait.setVisible(false); listOfNursingrecords = new ArrayList<CollapsiblePane>(); btnHelp.setToolTipText(SYSTools.xx("opde.mainframe.btnHelp.tooltip")); iconPanels = Collections.synchronizedMap(new HashMap<Resident, JPanel>()); if (OPDE.isDebug()) { setSize(1366, 768); } else { this.setExtendedState(JFrame.MAXIMIZED_BOTH); } setTitle(SYSTools.getWindowTitle("")); displayManager = new DisplayManager(pbMsg, lblMainMsg, lblSubMsg, pnlIcons, pbTimeout, new Closure() { @Override public void execute(Object o) { OPDE.debug("TIMEOUT"); logout(); showLogin(); } }); displayManager.start(); printProcessor = new PrintProcessor(); printProcessor.start(); // StatusBar Setup final LabelStatusBarItem label = new LabelStatusBarItem("Line"); label.setText(OPDE.getUrl() + " [Build " + OPDE.getAppInfo().getBuildnum() + "]" + " [JVM " + System.getProperty("java.version") + "]"); if (OPDE.isCustomUrl()) { label.setForeground(Color.RED); } label.setFont(new Font("Arial", Font.PLAIN, 14)); statusBar.add(label, JideBoxLayout.FLEXIBLE); labelUSER = new LabelStatusBarItem("Line"); labelUSER.setText("--"); labelUSER.setAlignment(JLabel.CENTER); labelUSER.setFont(new Font("Arial", Font.PLAIN, 14)); statusBar.add(labelUSER, JideBoxLayout.FLEXIBLE); final TimeStatusBarItem time = new TimeStatusBarItem(); time.setFont(new Font("Arial", Font.PLAIN, 14)); time.setUpdateInterval(10000); time.setTextFormat(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT)); time.setAlignment(JLabel.CENTER); statusBar.add(time, JideBoxLayout.FLEXIBLE); final MemoryStatusBarItem gc = new MemoryStatusBarItem(); gc.setFont(new Font("Arial", Font.PLAIN, 14)); statusBar.add(gc, JideBoxLayout.FLEXIBLE); btnResetSplitpane.setToolTipText(SYSTools.xx("opde.mainframe.btnSplitReset.tooltip")); initPhase = false; // JDialog dlg = new JDialog(this, false); // // JPanel pnl = new JPanel(); // pnl.setLayout(new VerticalLayout()); // // for (float f = 0.0f; f <= 1.0; f = f + 0.01f){ // JLabel lbl = new JLabel(Float.toString(f)); // lbl.setForeground(GUITools.blend(Color.red, Color.WHITE, f)); // pnl.add(lbl); // } // // dlg.setContentPane(new JScrollPane(pnl)); // // dlg.pack(); // dlg.setVisible(true); }
From source file:org.exoplatform.social.webui.profile.UIExperienceSection.java
/** * Display date time.//from w w w .j av a 2 s. co m * * @param d * @return * @since 1.2.5 * @throws ParseException */ protected String displayDateTime(Object d) throws ParseException { Date date = this.stringToCalendar(d.toString()).getTime(); Locale l = WebuiRequestContext.getCurrentInstance().getLocale(); DateFormat sf = SimpleDateFormat.getDateInstance(DateFormat.LONG, l); return sf.format(date); }
From source file:org.pentaho.reporting.engine.classic.core.modules.gui.base.parameters.DatePickerParameterComponent.java
private DateFormat createDateFormat(final String parameterFormatString, final Locale locale, final TimeZone timeZone) { if (parameterFormatString != null) { try {//w w w. ja v a 2s.c o m final SimpleDateFormat dateFormat = new SimpleDateFormat(parameterFormatString, locale); dateFormat.setTimeZone(timeZone); dateFormat.setLenient(false); return dateFormat; } catch (Exception e) { // boo! Not a valid pattern ... // its not a show-stopper either, as the pattern is a mere hint, not a mandatory thing logger.warn("Parameter format-string for date-parameter was not a valid date-format-string", e); // NON-NLS } } return DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); }
From source file:biz.taoconsulting.dominodav.LockManager.java
/** * @return Status of the lock/*www . j av a 2s . co m*/ */ public String status() { StringBuffer s = new StringBuffer(); // Faster than Strings Set<String> keys = this.lockTable.keySet(); Iterator<String> it = keys.iterator(); while (it.hasNext()) { LockInfo li = this.lockTable.get(it.next()); s.append(" \n" + li.getUsername() + " --> " + li.getToken() + " (" + (DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(li.getExpirydate())) + ")"); } return s.toString(); }
From source file:de.langerhans.wallet.ui.ImportKeysQrFragment.java
private void updateDate(final int year, final int month, final int day) { calendar.set(year, month, day, 0, 0); date.setText(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT).format(calendar.getTime())); }
From source file:com.appeligo.channelfeed.work.FileWriter.java
private synchronized void closeDoc() { if (body == null) { return;/* w w w . ja v a2 s. c o m*/ } try { doc = new PrintStream(new GZIPOutputStream(new FileOutputStream(filenamePrefix + ".html.gz"))); writeHead(); } catch (IOException e) { log.error("Can't create .html.gz file.", e); return; } try { String programTitle = program.getProgramTitle(); doc.println("<!-- WARNING, XDS IS INFORMATIONAL ONLY AND CAN BE VERY UNRELIABLE -->"); if (xdsData.getCallLettersAndNativeChannel() != null) { doc.println( "<meta name=\"XDSCallLettersAndNativeChannel\" content=\"" + StringEscapeUtils.escapeHtml( xdsData.getCallLettersAndNativeChannel().replaceAll("[\\p{Cntrl}]", "")) + "\"/>"); } if (xdsData.getNetworkName() != null) { doc.println("<meta name=\"XDSNetworkName\" content=\"" + StringEscapeUtils.escapeHtml(xdsData.getNetworkName().replaceAll("[\\p{Cntrl}]", "")) + "\"/>"); } if (xdsData.getProgramName() != null) { doc.println("<meta name=\"XDSProgramName\" content=\"" + StringEscapeUtils.escapeHtml(xdsData.getProgramName().replaceAll("[\\p{Cntrl}]", "")) + "\"/>"); if (programTitle == null) { programTitle = xdsData.getProgramName(); } } try { if (xdsData.getProgramType() != null) { doc.println("<meta name=\"XDSProgramType\" content=\"" + XDSData.convertProgramType(xdsData.getProgramType()) + "\"/>"); } if (xdsData.getProgramStartTimeID() != null) { long startTimestamp = XDSData.convertProgramStartTimeID(xdsData.getProgramStartTimeID()); doc.println("<meta name=\"XDSProgramStartTimeID\" content=\"" + startTimestamp + "\"/>"); Date date = new Date(startTimestamp); DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG); df.setTimeZone(TimeZone.getTimeZone("GMT")); doc.println("<meta name=\"XDSProgramStartTime\" content=\"" + df.format(date) + "\"/>"); if (XDSData.convertProgramTapeDelayed(xdsData.getProgramStartTimeID())) { doc.println("<meta name=\"XDSProgramTapeDelayed\" content=\"true\"/>"); } } if (xdsData.getProgramLength() != null) { doc.println("<meta name=\"XDSProgramLength\" content=\"" + XDSData.convertProgramLength(xdsData.getProgramLength()) + "\"/>"); } } catch (Exception e) { //ignore program type errors... probably bad data... such is XDS } if (program != null) { doc.println("<meta name=\"ProgramID\" content=\"" + program.getProgramId() + "\"/>"); doc.println("<meta name=\"ScheduleID\" content=\"" + program.getScheduleId() + "\"/>"); doc.println("<meta name=\"EpisodeTitle\" content=\"" + StringEscapeUtils.escapeHtml(program.getEpisodeTitle()) + "\"/>"); doc.println("<meta name=\"StartTime\" content=\"" + program.getStartTime().getTime() + "\"/>"); doc.println("<meta name=\"EndTime\" content=\"" + program.getEndTime().getTime() + "\"/>"); doc.println("<meta name=\"TVRating\" content=\"" + StringEscapeUtils.escapeHtml(program.getTvRating()) + "\"/>"); if (programTitle == null) { programTitle = Long.toString(program.getStartTime().getTime()); } } doc.println("<title>" + StringEscapeUtils.escapeHtml(programTitle) + "</title>"); doc.println("</head>"); doc.println("<body>"); doc.println("<h1>" + StringEscapeUtils.escapeHtml(programTitle) + "</h1>"); body.close(); body = null; InputStream readBody = new BufferedInputStream(new FileInputStream(filenamePrefix + ".body")); int b = readBody.read(); while (b >= 0) { doc.write(b); b = readBody.read(); } readBody.close(); File f = new File(filenamePrefix + ".body"); f.delete(); writeFoot(); doc.close(); doc = null; } catch (FileNotFoundException e) { log.error("Lost .body file!", e); } catch (IOException e) { log.error("Error copying .body to .html.gz", e); } doc = null; }
From source file:edu.hawaii.soest.kilonalu.dvp2.DavisWxXMLSink.java
/** * Export data to disk.//from w w w. j a v a 2 s .co m */ public boolean export() { logger.debug("DavisWxXMLSink.export() called."); if (setup(this.getServerName(), this.getServerPort(), this.getRBNBClientName())) { try { ChannelMap requestMap = new ChannelMap(); String fullSourceName = "/KNHIGCampusDataTurbine" + "/" + this.getRBNBClientName() + "/"; int channelIndex = 0; // add the barTrendAsString field data channelIndex = requestMap.Add(fullSourceName + "barTrendAsString"); // Falling Slowly // add the barometer field data channelIndex = requestMap.Add(fullSourceName + "barometer"); // 29.9 // add the insideTemperature field data channelIndex = requestMap.Add(fullSourceName + "insideTemperature"); // 83.9 // add the insideHumidity field data channelIndex = requestMap.Add(fullSourceName + "insideHumidity"); // 51 // add the outsideTemperature field data channelIndex = requestMap.Add(fullSourceName + "outsideTemperature"); // 76.7 // add the windSpeed field data channelIndex = requestMap.Add(fullSourceName + "windSpeed"); // 5 // add the tenMinuteAverageWindSpeed field data channelIndex = requestMap.Add(fullSourceName + "tenMinuteAverageWindSpeed"); // 4 // add the windDirection field data channelIndex = requestMap.Add(fullSourceName + "windDirection"); // 80 // add the outsideHumidity field data channelIndex = requestMap.Add(fullSourceName + "outsideHumidity"); // 73 // add the rainRate field data channelIndex = requestMap.Add(fullSourceName + "rainRate"); // 0.0 // add the uvRadiation field data channelIndex = requestMap.Add(fullSourceName + "uvRadiation"); // 0 // add the solarRadiation field data channelIndex = requestMap.Add(fullSourceName + "solarRadiation"); // 0.0 // add the dailyRain field data channelIndex = requestMap.Add(fullSourceName + "dailyRain"); // 0.0 // add the monthlyRain field data channelIndex = requestMap.Add(fullSourceName + "monthlyRain"); // 0.0 // add the forecastAsString field data channelIndex = requestMap.Add(fullSourceName + "forecastAsString"); // Partially Cloudy // make the request to the DataTurbine for the above channels sink.Request(requestMap, 0.0, 0.0, "newest"); ChannelMap responseMap = sink.Fetch(3000); // fetch with 5 sec timeout // then parse the results to and build the XML output int index = responseMap.GetIndex(fullSourceName + "barTrendAsString"); if (index >= 0) { // convert sec to millisec double timestamp = responseMap.GetTimes(index)[0]; long unixTime = (long) (timestamp * 1000.0); // get the updateDate Date updateDate = new Date(unixTime); String updateDateString = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG) .format(updateDate); // create the ad hoc XML file from the data from the DataTurbine this.fileOutputStream = new FileOutputStream(xmlFile); StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\"?>\n"); sb.append("<wx>\n"); sb.append(" <updatetime>" + updateDateString + "</updatetime>\n"); sb.append(" <barotrend>" + responseMap .GetDataAsString(responseMap.GetIndex(fullSourceName + "barTrendAsString"))[0] + "</barotrend>\n"); sb.append(" <baropress>" + String.format("%5.3f", (Object) (new Float(responseMap.GetDataAsFloat32( responseMap.GetIndex(fullSourceName + "barometer"))[0]))) + "</baropress>\n"); sb.append( " <outtemp>" + String.format("%4.1f", (Object) (new Float(responseMap.GetDataAsFloat32(responseMap .GetIndex(fullSourceName + "outsideTemperature"))[0]))) + "</outtemp>\n"); sb.append( " <intemp>" + String.format("%4.1f", (Object) (new Float(responseMap.GetDataAsFloat32(responseMap .GetIndex(fullSourceName + "insideTemperature"))[0]))) + "</intemp>\n"); sb.append(" <inrelhum>" + String.format("%3d", (Object) (new Integer(responseMap.GetDataAsInt32( responseMap.GetIndex(fullSourceName + "insideHumidity"))[0]))) + "</inrelhum>\n"); sb.append(" <outrelhum>" + String.format("%3d", (Object) (new Integer(responseMap.GetDataAsInt32( responseMap.GetIndex(fullSourceName + "outsideHumidity"))[0]))) + "</outrelhum>\n"); sb.append(" <windspd>" + String.format("%3d", (Object) (new Integer(responseMap.GetDataAsInt32( responseMap.GetIndex(fullSourceName + "windSpeed"))[0]))) + "</windspd>\n"); sb.append(" <winddir>" + String.format("%3d", (Object) (new Integer(responseMap.GetDataAsInt32( responseMap.GetIndex(fullSourceName + "windDirection"))[0]))) + "</winddir>\n"); sb.append(" <windavg>" + String.format("%3d", (Object) (new Integer(responseMap.GetDataAsInt32(responseMap .GetIndex(fullSourceName + "tenMinuteAverageWindSpeed"))[0]))) + "</windavg>\n"); sb.append(" <todayrain>" + String.format("%4.2f", (Object) (new Float(responseMap.GetDataAsFloat32( responseMap.GetIndex(fullSourceName + "dailyRain"))[0]))) + "</todayrain>\n"); sb.append(" <monthrain>" + String.format("%4.2f", (Object) (new Float(responseMap.GetDataAsFloat32( responseMap.GetIndex(fullSourceName + "monthlyRain"))[0]))) + "</monthrain>\n"); sb.append(" <rainrate>" + String.format("%4.2f", (Object) (new Float(responseMap.GetDataAsFloat32( responseMap.GetIndex(fullSourceName + "rainRate"))[0]))) + "</rainrate>\n"); sb.append(" <uv>" + String.format("%4d", (Object) (new Integer(responseMap.GetDataAsInt32( responseMap.GetIndex(fullSourceName + "uvRadiation"))[0]))) + "</uv>\n"); sb.append(" <solrad>" + String.format("%4.0f", (Object) (new Float(responseMap.GetDataAsFloat32( responseMap.GetIndex(fullSourceName + "solarRadiation"))[0]))) + "</solrad>\n"); sb.append(" <forecast>" + responseMap .GetDataAsString(responseMap.GetIndex(fullSourceName + "forecastAsString"))[0] + "</forecast>\n"); sb.append("</wx>\n"); logger.info("\n" + sb.toString()); this.fileOutputStream.write(sb.toString().getBytes()); this.fileOutputStream.close(); } else { logger.debug("The index is out of bounds: " + index); } } catch (java.io.FileNotFoundException fnfe) { logger.debug("Error: Unable to open XML output file for writing."); logger.debug("Error message: " + fnfe.getMessage()); disconnect(); return false; } catch (java.io.IOException ioe) { logger.debug("Error: There was a problem writing to the XML file."); logger.debug("Error message: " + ioe.getMessage()); disconnect(); return false; } catch (com.rbnb.sapi.SAPIException sapie) { logger.debug("Error: There was a problem with the DataTurbine connection."); logger.debug("Error message: " + sapie.getMessage()); disconnect(); return false; } return true; } else { return false; } }
From source file:de.langerhans.wallet.ui.ImportKeysQrFragment.java
private void updateDate(final long timeSeconds) { calendar.setTimeInMillis(timeSeconds * 1000); date.setText(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT).format(calendar.getTime())); }
From source file:com.pos.spatobiz.app.view.karyawan.UbahKaryawan.java
/** This method is called from within the constructor to * initialize the form.//w w w . j a v a2 s. co 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(); 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(); buttonUbah = 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 :"); 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)); 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"); buttonUbah.setMnemonic('U'); buttonUbah.setText("Ubah"); buttonCari.setText("Cari"); 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(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) .addGroup(layout.createSequentialGroup() .addComponent(textKode, GroupLayout.DEFAULT_SIZE, 339, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(buttonCari, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .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(buttonUbah, 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) .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) .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(buttonUbah, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); }
From source file:ch.entwine.weblounge.kernel.command.SiteCommand.java
/** * Prints out information about the given url or page identifier. * /* w ww. j ava2 s . co m*/ * @param site * the site * @param args * arguments to this function */ private void inspect(Site site, String[] args) { if (args.length == 0) { System.err.println("Please specify what to inspect"); System.err.println("Usage: site <id> inspect <url>|<id>"); return; } // What are we looking at? ContentRepository repository = site.getContentRepository(); Page page = null; // Is it a page? try { String objectId = args[0]; // TODO: What if we hit a file or an image? if (objectId.startsWith("/")) page = (Page) repository.get(new PageURIImpl(site, args[0])); else page = (Page) repository.get(new PageURIImpl(site, null, args[0])); if (page != null) { title("page"); pad("id", page.getURI().getIdentifier().toString()); pad("path", page.getURI().getPath()); section("lifecycle"); DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG); // Created if (page.getCreationDate() != null) { StringBuffer buf = new StringBuffer(); buf.append(df.format(page.getCreationDate())); if (page.getCreator() != null) { buf.append(" by ").append(page.getCreator().toString()); } pad("created", buf.toString()); } // Modified if (page.getModificationDate() != null) { StringBuffer buf = new StringBuffer(); buf.append(df.format(page.getModificationDate())); if (page.getModifier() != null) { buf.append(" by ").append(page.getModifier().toString()); } pad("modified", buf.toString()); } // Published if (page.getPublishFrom() != null) { StringBuffer buf = new StringBuffer(); buf.append(df.format(page.getPublishFrom())); if (page.getPublisher() != null) { buf.append(" by ").append(page.getPublisher().toString()); } pad("published", buf.toString()); if (page.getPublishTo() != null) pad("published until", df.format(page.getPublishTo())); } section("header"); if (page.getTitle() != null) pad("title", page.getTitle()); // subjects StringBuffer subjectList = new StringBuffer(); for (String c : page.getSubjects()) { if (subjectList.length() > 0) subjectList.append(", "); subjectList.append(c); } pad("subjects", subjectList.toString()); section("content"); // composers StringBuffer composerList = new StringBuffer(); for (Composer c : page.getComposers()) { if (composerList.length() > 0) composerList.append(", "); composerList.append(c.getIdentifier()); composerList.append(" (").append(c.getPagelets().length).append(")"); } pad("composers", composerList.toString()); } } catch (ContentRepositoryException e) { System.err.println("Error trying to access the content repository"); e.printStackTrace(System.err); } }