本文整理汇总了Java中net.sf.memoranda.util.Util类的典型用法代码示例。如果您正苦于以下问题:Java Util类的具体用法?Java Util怎么用?Java Util使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Util类属于net.sf.memoranda.util包,在下文中一共展示了Util类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTagList
import net.sf.memoranda.util.Util; //导入依赖的package包/类
public static String getTagList(Project pjr){
try {
String filepath = FileStorage.JN_DOCPATH + ".projects";
Builder builder = new Builder();
Document projects = builder.build(new InputStreamReader(new FileInputStream(filepath)), "UTF-8");
String taglist="";
Elements prjs = projects.getRootElement().getChildElements("project");
for (int i = 0; i < prjs.size(); i++) {
String pid = ((Element) prjs.get(i)).getAttribute("id").getValue();
if (pid.equals(pjr.getID())){
Element tags=prjs.get(i).getFirstChildElement("tags");
Elements tagli=tags.getChildElements("tag");
if (tagli.size()<=0) return "no";
for (int j = 0; j < tagli.size(); j++) {
taglist+=tagli.get(j).getAttributeValue("name")+" - ";
}
break;
}
}
return taglist;
} catch (Exception e) {
Util.error(e);
return "no";
}
}
示例2: createEvent
import net.sf.memoranda.util.Util; //导入依赖的package包/类
public static Event createEvent(
CalendarDate date,
int hh,
int mm,
String text) {
Element el = new Element("event");
el.addAttribute(new Attribute("id", Util.generateId()));
el.addAttribute(new Attribute("hour", String.valueOf(hh)));
el.addAttribute(new Attribute("min", String.valueOf(mm)));
el.appendChild(text);
Day d = getDay(date);
if (d == null)
d = createDay(date);
d.getElement().appendChild(el);
return new EventImpl(el);
}
示例3: getTaskElement
import net.sf.memoranda.util.Util; //导入依赖的package包/类
private Element getTaskElement(String id) {
/*Nodes nodes = XQueryUtil.xquery(_doc, "//task[@id='" + id + "']");
if (nodes.size() > 0) {
Element el = (Element) nodes.get(0);
return el;
}
else {
Util.debug("Task " + id + " cannot be found in project " + _project.getTitle());
return null;
} */
Element el = (Element)elements.get(id);
if (el == null) {
Util.debug("Task " + id + " cannot be found in project " + _project.getTitle());
}
return el;
}
示例4: createTimelog
import net.sf.memoranda.util.Util; //导入依赖的package包/类
public static TimeLog createTimelog(LocalDateTime timeStart, LocalDateTime timeEnd, int interruption,PSP.Phase phase, String comments) throws Exception {
refresh();
Element element = new Element(TimeLog.ELEMENT_NAME);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(TimeLog.DATE_FORMAT);
element.addAttribute(new Attribute(TimeLog.ID_NAME, Util.generateId()));
element.addAttribute(new Attribute(TimeLog.TIME_START_NAME, timeStart.format(formatter)));
element.addAttribute(new Attribute(TimeLog.TIME_STOP_NAME, timeEnd.format(formatter)));
element.addAttribute(new Attribute(TimeLog.INTERRUPTION_NAME, String.valueOf(interruption)));
element.addAttribute(new Attribute(TimeLog.PHASE_NAME, phase.toString()));
element.addAttribute(new Attribute(TimeLog.COMMENTS_NAME, comments));
element.appendChild(comments);
Day d = getDay(timeStart);
if (d == null)
d = createDay(timeStart);
d.getElement().appendChild(element);
return new TimeLog(element);
}
示例5: createNoteForDate
import net.sf.memoranda.util.Util; //导入依赖的package包/类
public Note createNoteForDate(CalendarDate date) {
Year y = getYear(date.getYear());
if (y == null)
y = createYear(date.getYear());
Month m = y.getMonth(date.getMonth());
if (m == null)
m = y.createMonth(date.getMonth());
Day d = m.getDay(date.getDay());
if (d == null)
d = m.createDay(date.getDay());
NoteElement ne = d.createNote(Util.generateId());
return new NoteImpl(ne.getElement(), _project);
}
示例6: changeDay
import net.sf.memoranda.util.Util; //导入依赖的package包/类
/**
* Changes the day to display information about.
* @param date the day to change to
*/
public void changeDay(CalendarDate date) {
Util.debug("Switch day view to display info for " + date);
lastDate = date;
removeAll();
repaint();
if (EventsManager.isFreeDay(date) && ProjectManager.isFreeDay(date)) {
add(freeDayPanel);
} else {
addTitle();
updateEvents(date);
updateProjects();
addBottomSpacer();
}
}
示例7: fileSystemTraversal
import net.sf.memoranda.util.Util; //导入依赖的package包/类
/**
*
* @param dirsList list of directories on the system
* @param dir path to register directories to be read later
* @param watcher WatchService to register paths
* @param holdValueToKey hashmap containing key,value (paths, project id)
* @throws IOException
*/
private static synchronized void fileSystemTraversal(ArrayList<File> dirsList, Path dir, WatchService watcher, ConcurrentHashMap<String, String> holdValueToKey) throws IOException{
for(int i = 0;i<dirsList.size();i++){
dir = Paths.get(dirsList.get(i).getAbsolutePath()); //get path of selected file
dir.register(watcher,ENTRY_CREATE,ENTRY_DELETE,ENTRY_MODIFY); //register directory path with watcher
String subStr = dirsList.get(i).getAbsolutePath();
if(windows){
String let = subStr.substring(0,2);
subStr = let+"\\"+"\\"+subStr.substring(3,subStr.length());
}
Util.debug("WatchService: Registered: "+subStr);
String projID = (String) holdValueToKey.get(subStr); //returns the project id if src folder path is known
if(projID != null){
Util.debug("WatchService: Project ID = "+projID);
String fileAbsPath = fileChosenPaths.get(projID);
String LOCcnt = "0";
//pathLOCcount.put(fileAbsPath, LOCcnt);
//allPathsForFilesWithProjID.put(projID, pathLOCcount); // <ProjID,<AbsoluteFilePath, LOC count>>
}
}
}
示例8: setLOCcountsForProject
import net.sf.memoranda.util.Util; //导入依赖的package包/类
/**
* Sets line of code count as JSON in format (ProjID, (Path, LOC)), given project ID and path hashmap
* @param projectID
* @param pathWithLOCCount contains the src path as key, project loc count as value
* @param filePath file path
* @param filePathLOCcount file loc count
*
*/
private static synchronized void setLOCcountsForProject(String projectID, ConcurrentHashMap<String, String> pathWithLOCCount, String filePath, String filePathLOCcount){
java.util.Iterator<String> iter = pathWithLOCCount.keySet().iterator();
String jsonObj = "{";
while(iter.hasNext()){//iterate and construct string in JSON from paths, and LOC count
String key = iter.next();
String value = pathWithLOCCount.get(key).toString();
jsonObj = jsonObj+"\""+key+"\""+":"+"\""+value+"\""+",";
}
if(jsonObj.endsWith(",")){
jsonObj = jsonObj.substring(0,jsonObj.length()-1);
jsonObj = jsonObj+"}";
}
Util.debug("Set Path With LOC: "+jsonObj);
Util.debug("Set File path LOC count: "+filePathLOCcount);
Configuration.put(projectID+filePath, filePathLOCcount); //sets file LOC count to match with projectID+filePath
Configuration.put(projectID, jsonObj);
Configuration.saveConfig();
}
示例9: createEvent
import net.sf.memoranda.util.Util; //导入依赖的package包/类
public static Event createEvent(
CalendarDate date,
int hh,
int mm,
String text,
boolean sendSMS) {
Element el = new Element("event");
el.addAttribute(new Attribute("id", Util.generateId()));
el.addAttribute(new Attribute("hour", String.valueOf(hh)));
el.addAttribute(new Attribute("min", String.valueOf(mm)));
el.addAttribute(new Attribute("sendSMS", String.valueOf(sendSMS)));
el.appendChild(text);
Day d = getDay(date);
if (d == null)
d = createDay(date);
d.getElement().appendChild(el);
return new EventImpl(el);
}
示例10: addResource
import net.sf.memoranda.util.Util; //导入依赖的package包/类
/**
* @see net.sf.memoranda.ResourcesList#addResource(java.lang.String, boolean)
*/
public void addResource(String path, String description, boolean isInternetShortcut, boolean isProjectFile) {
Element el = new Element("resource");
el.addAttribute(new Attribute("id", Util.generateId()));
el.addAttribute(new Attribute("path", path));
el.addAttribute(new Attribute("description",description));
if (isInternetShortcut)
el.addAttribute(new Attribute("isInetShortcut", "true"));
if (isProjectFile)
el.addAttribute(new Attribute("isProjectFile", "true"));
_root.appendChild(el);
}
示例11: newResB_actionPerformed
import net.sf.memoranda.util.Util; //导入依赖的package包/类
void newResB_actionPerformed(ActionEvent e) {
AddResourceDialog dlg = new AddResourceDialog(App.getFrame(), Local.getString("New resource"));
Dimension frmSize = App.getFrame().getSize();
Point loc = App.getFrame().getLocation();
dlg.setLocation((frmSize.width - dlg.getSize().width) / 2 + loc.x, (frmSize.height - dlg.getSize().height) / 2 + loc.y);
dlg.setVisible(true);
if (dlg.CANCELLED)
return;
if (dlg.localFileRB.isSelected()) {
String fpath = dlg.pathField.getText();
MimeType mt = MimeTypesList.getMimeTypeForFile(fpath);
if (mt.getMimeTypeId().equals("__UNKNOWN")) {
mt = addResourceType(fpath);
if (mt == null)
return;
}
if (!checkApp(mt))
return;
// if file if projectFile, than copy the file and change url.
if (dlg.projectFileCB.isSelected()) {
fpath = copyFileToProjectDir(fpath);
CurrentProject.getResourcesList().addResource(fpath, false, true);
}
else
CurrentProject.getResourcesList().addResource(fpath);
resourcesTable.tableChanged();
}
else {
if (!Util.checkBrowser())
return;
CurrentProject.getResourcesList().addResource(dlg.urlField.getText(), true, false);
resourcesTable.tableChanged();
}
}
示例12: createSticker
import net.sf.memoranda.util.Util; //导入依赖的package包/类
public static void createSticker(String text, int prior) {
Element el = new Element("sticker");
el.addAttribute(new Attribute("id", Util.generateId()));
el.addAttribute(new Attribute("priority", prior+""));
el.appendChild(text);
_root.appendChild(el);
}
示例13: createNoteForDate
import net.sf.memoranda.util.Util; //导入依赖的package包/类
public Note createNoteForDate(CalendarDate date) {
Year y = getYear(date.getYear());
if (y == null)
y = createYear(date.getYear());
Month m = y.getMonth(date.getMonth());
if (m == null)
m = y.createMonth(date.getMonth());
Day d = m.getDay(date.getDay());
if (d == null)
d = m.createDay(date.getDay());
NoteElement ne = d.createNote(Util.generateId());
return new NoteImpl(ne.getElement(), _project);
}
示例14: createTask
import net.sf.memoranda.util.Util; //导入依赖的package包/类
public Task createTask(CalendarDate startDate, CalendarDate endDate, String text, int priority, long effort, long actual, String description, String parentTaskId) {
Element el = new Element("task");
el.addAttribute(new Attribute("startDate", startDate.toString()));
el.addAttribute(new Attribute("endDate", endDate != null? endDate.toString():""));
String id = Util.generateId();
el.addAttribute(new Attribute("id", id));
el.addAttribute(new Attribute("progress", "0"));
el.addAttribute(new Attribute("effort", String.valueOf(effort)));
el.addAttribute(new Attribute("actual", String.valueOf(actual)));
el.addAttribute(new Attribute("priority", String.valueOf(priority)));
Element txt = new Element("text");
txt.appendChild(text);
el.appendChild(txt);
Element desc = new Element("description");
desc.appendChild(description);
el.appendChild(desc);
if (parentTaskId == null) {
_root.appendChild(el);
}
else {
Element parent = getTaskElement(parentTaskId);
parent.appendChild(el);
}
elements.put(id, el);
Util.debug("Created task with parent " + parentTaskId);
return new TaskImpl(el, this);
}
示例15: saveNote
import net.sf.memoranda.util.Util; //导入依赖的package包/类
public void saveNote() {
if (currentNote == null)
currentNote = CurrentProject.getNoteList().createNoteForDate(currentDate);
currentNote.setTitle(editorPanel.titleField.getText());
currentNote.setId(Util.generateId());
CurrentStorage.get().storeNote(currentNote, editorPanel.getDocument());
/*DEBUG* System.out.println("Save");*/
}