本文整理汇总了Java中net.sf.memoranda.Note.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Note.getId方法的具体用法?Java Note.getId怎么用?Java Note.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.memoranda.Note
的用法示例。
在下文中一共展示了Note.getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: noteToDocument
import net.sf.memoranda.Note; //导入方法依赖的package包/类
private Document noteToDocument(Note note, String noteHtmlContents) {
Document d = new Document ();
String id = note.getId ();
Project project = note.getProject();
String projectId = project.getID();
String projectName = project.getTitle();
String title = note.getTitle ();
String date = note.getDate() != null ? new SimpleDateFormat ("yyyy-MM-dd").format(note.getDate().getDate()) : null;
d.add (new StringField ("id", id, Field.Store.YES));
d.add (new StringField ("project_id", projectId, Field.Store.YES));
d.add (new StoredField ("project_name", projectName));
d.add (new TextField ("title", title, Field.Store.YES));
d.add (new TextField ("title_cs", title, Field.Store.YES));
d.add (new TextField ("date", date != null ? date : "", Field.Store.YES));
d.add (new TextField ("body", noteHtmlContents, Field.Store.YES));
return d;
}
示例2: storeNote
import net.sf.memoranda.Note; //导入方法依赖的package包/类
/**
* @see net.sf.memoranda.util.Storage#storeNote(net.sf.memoranda.Note)
*/
public void storeNote(Note note, javax.swing.text.Document doc) {
String filename =
JN_DOCPATH + note.getProject().getID() + File.separator;
doc.putProperty(
javax.swing.text.Document.TitleProperty,
note.getTitle());
CalendarDate d = note.getDate();
filename += note.getId();//d.getDay() + "-" + d.getMonth() + "-" + d.getYear();
/*DEBUG*/System.out.println("[DEBUG] Save note: "+ filename);
try {
OutputStreamWriter fw =
new OutputStreamWriter(new FileOutputStream(filename), "UTF-8");
AltHTMLWriter writer = new AltHTMLWriter(fw, (HTMLDocument) doc);
writer.write();
fw.flush();
fw.close();
//editorKit.write(new FileOutputStream(filename), doc, 0, doc.getLength());
//editorKit.write(fw, doc, 0, doc.getLength());
}
catch (Exception ex) {
new ExceptionDialog(
ex,
"Failed to write a document to " + filename,
"");
}
/*String filename = JN_DOCPATH + note.getProject().getID() + "/";
doc.putProperty(javax.swing.text.Document.TitleProperty, note.getTitle());
CalendarDate d = note.getDate();
filename += d.getDay() + "-" + d.getMonth() + "-" + d.getYear();
try {
long t1 = new java.util.Date().getTime();
FileOutputStream ostream = new FileOutputStream(filename);
ObjectOutputStream oos = new ObjectOutputStream(ostream);
oos.writeObject((HTMLDocument)doc);
oos.flush();
oos.close();
ostream.close();
long t2 = new java.util.Date().getTime();
System.out.println(filename+" save:"+ (t2-t1) );
}
catch (Exception ex) {
ex.printStackTrace();
}*/
}
示例3: getNoteURL
import net.sf.memoranda.Note; //导入方法依赖的package包/类
public String getNoteURL(Note note) {
return "file:" + JN_DOCPATH + note.getProject().getID() + "/" + note.getId();
}
示例4: getNotePath
import net.sf.memoranda.Note; //导入方法依赖的package包/类
public String getNotePath(Note note) {
String filename = JN_DOCPATH + note.getProject().getID() + File.separator;
// CalendarDate d = note.getDate();
filename += note.getId();//d.getDay() + "-" + d.getMonth() + "-" + d.getYear();
return filename;
}
示例5: storeNote
import net.sf.memoranda.Note; //导入方法依赖的package包/类
/**
* @see net.sf.memoranda.util.Storage#storeNote(net.sf.memoranda.Note)
*/
public void storeNote(Note note, javax.swing.text.Document doc) {
String filename =
JN_DOCPATH + note.getProject().getID() + File.separator;
doc.putProperty(
javax.swing.text.Document.TitleProperty,
note.getTitle());
CalendarDate d = note.getDate();
String time = note.getTime();
filename += note.getId();//d.getDay() + "-" + d.getMonth() + "-" + d.getYear();
/*DEBUG*/System.out.println("[DEBUG] Save note: "+ filename);
try {
OutputStreamWriter fw =
new OutputStreamWriter(new FileOutputStream(filename), "UTF-8");
AltHTMLWriter writer = new AltHTMLWriter(fw, (HTMLDocument) doc);
writer.write();
fw.flush();
fw.close();
//editorKit.write(new FileOutputStream(filename), doc, 0, doc.getLength());
//editorKit.write(fw, doc, 0, doc.getLength());
}
catch (Exception ex) {
new ExceptionDialog(
ex,
"Failed to write a document to " + filename,
"");
}
/*String filename = JN_DOCPATH + note.getProject().getID() + "/";
doc.putProperty(javax.swing.text.Document.TitleProperty, note.getTitle());
CalendarDate d = note.getDate();
filename += d.getDay() + "-" + d.getMonth() + "-" + d.getYear();
try {
long t1 = new java.util.Date().getTime();
FileOutputStream ostream = new FileOutputStream(filename);
ObjectOutputStream oos = new ObjectOutputStream(ostream);
oos.writeObject((HTMLDocument)doc);
oos.flush();
oos.close();
ostream.close();
long t2 = new java.util.Date().getTime();
System.out.println(filename+" save:"+ (t2-t1) );
}
catch (Exception ex) {
ex.printStackTrace();
}*/
}
示例6: storeNote
import net.sf.memoranda.Note; //导入方法依赖的package包/类
/**
* @see net.sf.memoranda.util.Storage#storeNote(net.sf.memoranda.Note)
*/
public void storeNote(Note note, javax.swing.text.Document doc) {
String filename =
JN_DOCPATH + note.getProject().getID() + File.separator;
doc.putProperty(
javax.swing.text.Document.TitleProperty,
note.getTitle());
CalendarDate d = note.getDate();
filename += note.getId();//d.getDay() + "-" + d.getMonth() + "-" + d.getYear();
/*DEBUG*/System.out.println("[DEBUG] Save note: "+ filename);
try {
OutputStreamWriter fw =
new OutputStreamWriter(new FileOutputStream(filename), "UTF-8");
AltHTMLWriter writer = new AltHTMLWriter(fw, (HTMLDocument) doc);
writer.write();
fw.flush();
fw.close();
//editorKit.write(new FileOutputStream(filename), doc, 0, doc.getLength());
//editorKit.write(fw, doc, 0, doc.getLength());
}
catch (Exception ex) {
new ExceptionDialog(
ex,
"Failed to write a document to " + filename,
"");
}
try {
NoteIndexer.addOrUpdateNote(note, doc.getText(0, doc.getLength()));
} catch (Exception e) {
throw new RuntimeException ("could not add note to index", e);
}
/*String filename = JN_DOCPATH + note.getProject().getID() + "/";
doc.putProperty(javax.swing.text.Document.TitleProperty, note.getTitle());
CalendarDate d = note.getDate();
filename += d.getDay() + "-" + d.getMonth() + "-" + d.getYear();
try {
long t1 = new java.util.Date().getTime();
FileOutputStream ostream = new FileOutputStream(filename);
ObjectOutputStream oos = new ObjectOutputStream(ostream);
oos.writeObject((HTMLDocument)doc);
oos.flush();
oos.close();
ostream.close();
long t2 = new java.util.Date().getTime();
System.out.println(filename+" save:"+ (t2-t1) );
}
catch (Exception ex) {
ex.printStackTrace();
}*/
}