本文整理汇总了Java中net.sf.memoranda.Event类的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Event类属于net.sf.memoranda包,在下文中一共展示了Event类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toApi
import net.sf.memoranda.Event; //导入依赖的package包/类
/**
* Converts the given internal event to the corresponding API event.
* @param event internal event to convert
* @return converted API event
*/
public static ApiEvent toApi(Event event) {
Date endDate = null;
if (event.getEndDate() != null) {
endDate = event.getEndDate().getDate();
}
return new ApiEvent.Builder()
.setId(event.getId())
.setTime(event.getTime())
.setText(event.getText())
.setRepeatType(event.getRepeatType().ordinal())
.setStartDate(event.getStartDate().getDate())
.setEndDate(endDate)
.setPeriod(event.getPeriod())
.setRepeatable(event.isRepeatable())
.setWorkingDays(event.getWorkingDays())
.setDuration(event.getDuration())
.setRepeatDays(event.getRepeatDays())
.setSendsSms(event.getSendSMS())
.create();
}
示例2: getAll
import net.sf.memoranda.Event; //导入依赖的package包/类
/**
* Returns all the user's events.
* @return all events
*/
public List<Event> getAll() throws IOException {
if (!apiAuthenticationService.loggedIn()) {
throw new IOException("user is not logged in");
}
String endpoint = String.format(ApiConstants.GET_ALL_EVENTS_ENDPOINT, apiAuthenticationService.getUserId());
Response response = httpRequestService.get(endpoint);
List<ApiEvent> apiEvents = response.readEntity(new GenericType<List<ApiEvent>>() {});
if (response.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {
throw new ApiException(response, "Could not get all events");
}
return ApiEventDto.toInternal(apiEvents);
}
示例3: getValueAt
import net.sf.memoranda.Event; //导入依赖的package包/类
public Object getValueAt(int row, int col) {
Event ev = (Event)events.get(row);
if (col == 0)
//return ev.getHour()+":"+ev.getMinute();
return ev.getTimeString();
else if (col == 1){
int dur = ev.getDuration();//convert from event duration in minutes to days and hours
int days = dur/1440;
dur%=1440;
int hours = dur/60;
dur%=60;
return ((days > 0)? days + "d":"") +
((hours > 0)? hours + "h":"") +
((dur > 0)? dur + "m":""); //format as XdYhZm
}else if (col == 2)
return ev.getText();
else if (col == EVENT_ID)
return ev.getId();
else return ev;
}
示例4: getValueAt
import net.sf.memoranda.Event; //导入依赖的package包/类
public Object getValueAt(int row, int col) {
Event ev = getEventAt(row,col);
if(ev == null) return "";
Calendar cal = (Calendar)days[col].get(row);
String res = "";
switch(cal.get(Calendar.DAY_OF_WEEK)){
case Calendar.SUNDAY: res += "SU";
break;
case Calendar.MONDAY: res += "MO";
break;
case Calendar.TUESDAY: res += "TU";
break;
case Calendar.WEDNESDAY: res += "WE";
break;
case Calendar.THURSDAY: res += "TH";
break;
case Calendar.FRIDAY: res += "FR";
break;
case Calendar.SATURDAY: res += "SA";
break;
default: res += "??";
}
String dOM = cal.get(Calendar.DAY_OF_MONTH) + "";
switch(cal.get(Calendar.DAY_OF_MONTH)%10){
case 1: dOM += "st";
break;
case 2: dOM += "nd";
break;
case 3: dOM += "rd";
break;
default:dOM+="th";
}
res+= " / " + dOM + ": ";
if(ev.getText().equals("")) res+= "EVENT";
else res += ev.getText();
return res;
}
示例5: addDescriptionSection
import net.sf.memoranda.Event; //导入依赖的package包/类
/**
* Builds up the "description" section of the event display. This section
* shows details about the event itself.
* @param event the event being displayed
*/
private void addDescriptionSection(Event event) {
JPanel container = new JPanel();
container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS));
container.setMinimumSize(new Dimension(300, MAX_HEIGHT));
// Add the description text
container.add(makeDescLabel(event.getText()));
// Add this section to the parent
GridBagConstraints cons = new GridBagConstraints();
cons.gridx = 1; cons.gridy = 0;
cons.gridwidth = 1; cons.gridheight = 1;
cons.fill = GridBagConstraints.HORIZONTAL;
cons.anchor = GridBagConstraints.WEST;
cons.weightx = 1.0; cons.weighty = 1.0;
add(container, cons);
}
示例6: eventToDocument
import net.sf.memoranda.Event; //导入依赖的package包/类
private Document eventToDocument(Event newEvent) {
Document d = new Document ();
String eventId = newEvent.getId ();
String eventText = newEvent.getText();
String eventStartDate = newEvent.getStartDate() != null ? new SimpleDateFormat ("yyyy-MM-dd").format(newEvent.getStartDate().getDate()) : null;
String eventStartTime = newEvent.getTimeString();
if (eventStartDate != null) eventStartTime = eventStartDate + " @ " + eventStartTime;
d.add (new StringField ("id", eventId, Field.Store.YES));
d.add (new TextField ("text", eventText, Field.Store.YES));
d.add (new TextField ("text_cs", eventText, Field.Store.YES));
d.add (new StoredField ("original_start_date", eventStartTime != null ? eventStartTime : ""));
return d;
}
示例7: getValueAt
import net.sf.memoranda.Event; //导入依赖的package包/类
public Object getValueAt(int row, int col) {
Event ev = (Event)events.get(row);
if (col == 0)
//return ev.getHour()+":"+ev.getMinute();
return ev.getTimeString();
else if (col == 1)
return ev.getText();
else if (col == EVENT_ID)
return ev.getId();
else return ev;
}
示例8: generateEventsInfo
import net.sf.memoranda.Event; //导入依赖的package包/类
static String generateEventsInfo(CalendarDate date) {
String s = "<td width=\"34%\" valign=\"top\">" + "<a href=\"memoranda:events\"><h1>" + Local.getString("Events")
+ "</h1></a>\n"
+ "<table width=\"100%\" valign=\"top\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#FFFFF6\">\n";
Vector v = (Vector) EventsManager.getEventsForDate(date);
int n = 0;
for (Iterator i = v.iterator(); i.hasNext();) {
Event e = (Event) i.next();
String txt = e.getText();
System.out.println("Event: "+txt);
String iurl = net.sf.memoranda.ui.AppFrame.class.getResource("resources/agenda/spacer.gif")
.toExternalForm();
if (date.equals(CalendarDate.today())) {
if (e.getTime().after(new Date()))
txt = "<b>" + txt + "</b>";
if ((EventsScheduler.isEventScheduled())
&& (EventsScheduler.getFirstScheduledEvent().getTime().equals(e.getTime()))) {
iurl = net.sf.memoranda.ui.AppFrame.class.getResource("resources/agenda/arrow.gif")
.toExternalForm();
}
}
String icon = "<img align=\"right\" width=\"16\" height=\"16\" src=\"" + iurl
+ "\" border=\"0\" hspace=\"0\" vspace=\"0\" alt=\"\">";
s += "<tr>\n<td>" + icon + "</td>" + "<td nowrap class=\"eventtime\">" + e.getTimeString() + "</td>"
+ "<td width=\"100%\" class=\"eventtext\"> " + txt + "</td>\n" + "</tr>";
}
return s + "</table>";
}
示例9: getById
import net.sf.memoranda.Event; //导入依赖的package包/类
/**
* Returns an event from the server with the given ID.
* @param id the ID to search for an event under
* @return event with ID
*/
public Event getById(String id) throws IOException {
String endpoint = String.format(ApiConstants.GET_EVENT_BY_ID_ENDPOINT, id);
Response response = httpRequestService.get(endpoint);
if (response.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {
throw new ApiException(response, "Could not get by ID");
}
return ApiEventDto.toInternal(response.readEntity(ApiEvent.class));
}
示例10: getEventAt
import net.sf.memoranda.Event; //导入依赖的package包/类
public Event getEventAt(int row, int column){
try{
return (Event)events[column].get(row);
}
catch(Exception e){
return null;
}
}
示例11: getValueAt
import net.sf.memoranda.Event; //导入依赖的package包/类
public Object getValueAt(int row, int col) {
Event ev = getEventAt(row,col);
if(ev == null) return "";
String res = ev.getTimeString() + ": ";
if(ev.getText().equals("")) res += "EVENT";
else res += ev.getText();
return res;
}
示例12: DayViewEventListing
import net.sf.memoranda.Event; //导入依赖的package包/类
DayViewEventListing(Event event) {
setLayout(new GridBagLayout());
Color color = getHighlightColor(event);
addTimeSection(event, color);
addDescriptionSection(event);
addDurationSection(event, color);
}
示例13: getHighlightColor
import net.sf.memoranda.Event; //导入依赖的package包/类
/**
* Returns the highlight color of the event display. This color should be
* used to accentuate certain parts of the display. The color is dependent
* on the time of day of the event.
* @param event the event in question
* @return the highlight color
*/
private Color getHighlightColor(Event event) {
Date time = event.getTime();
if (time.getHours() < MORNING_HOUR) {
return MORNING_COLOR;
} else if (time.getHours() < AFTERNOON_HOUR) {
return AFTERNOON_COLOR;
} else {
return EVENING_COLOR;
}
}
示例14: addTimeSection
import net.sf.memoranda.Event; //导入依赖的package包/类
/**
* Builds up the "time" section of the event display. This section shows
* what time the event happens at.
* @param event the event being displayed
* @param color the highlight color to use
*/
private void addTimeSection(Event event, Color color) {
// Build the container that will house the section
JPanel container = new JPanel();
container.setLayout(new GridBagLayout());
// Add the time display
GridBagConstraints cons = new GridBagConstraints();
cons.insets = new Insets(0, 0, 0, 10);
container.add(makeHighlightedLabel(
event.getTimeString(),
color,
SwingConstants.RIGHT),
cons);
// Add the separator
container.add(makeSeparator(color));
// Add this section to the parent
cons = new GridBagConstraints();
cons.gridx = 0; cons.gridy = 0;
cons.gridwidth = 1; cons.gridheight = 1;
cons.anchor = GridBagConstraints.EAST;
cons.fill = GridBagConstraints.NONE;
cons.insets = new Insets(0, 0, 0,15);
cons.weightx = 1.0; cons.weighty = 1.0;
add(container, cons);
}
示例15: removeEventB_actionPerformed
import net.sf.memoranda.Event; //导入依赖的package包/类
void removeEventB_actionPerformed(ActionEvent e) {
String msg;
HashMap<String,Event> evs = new HashMap<String,Event>();
for(int i=0; i< eventsTable.getSelectedRows().length;i++) {
for(int j = 0;j<eventsTable.getSelectedColumns().length;j++){
Event ev = eventsTable.getEventAt(eventsTable.getSelectedRows()[i], eventsTable.getSelectedColumns()[j]);
if(ev != null && !evs.containsKey(ev.getId())) evs.put(ev.getId(),ev);
}
}
if(evs.size() == 0) return;
msg = Local.getString("Remove ") + evs.size() + Local.getString(" event(s)") + "\n" + Local.getString("Are you sure?");
int n =
JOptionPane.showConfirmDialog(
App.getFrame(),
msg,
Local.getString("Remove event"),
JOptionPane.YES_NO_OPTION);
if (n != JOptionPane.YES_OPTION) return;
for(Event eo:evs.values())
EventsManager.removeEvent(eo);
eventsTable.getSelectionModel().clearSelection();
saveEvents();
}