google-code-export / gwt-cal

Automatically exported from code.google.com/p/gwt-cal
1 stars 0 forks source link

Add a 'tool-tip' on mouse hover #71

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Description of the new feature:

Allow to add 'tool-tip' text info when the mouse is hover an appointment (in 
dayView).

To have this change working, I was oblige to change function setTitle() in 
AppointmentWidget into setApptTitle() because it was overiding the function 
that allow to use the tool-tip.

Thanks a lot for your calendar

Code / psuedo-code:

Index: src/main/java/com/bradrydzewski/gwt/calendar/client/Appointment.java
===================================================================
--- 
src/main/java/com/bradrydzewski/gwt/calendar/client/Appointment.java    (revision 
336)
+++ 
src/main/java/com/bradrydzewski/gwt/calendar/client/Appointment.java    (working 
copy)
@@ -49,6 +49,7 @@
    private String id;
    private String title;
    private String description;
+    private String onHoverText;
    private Date start;
    private Date end;
    private String location;
@@ -177,6 +178,26 @@
        this.description = description;
    }

+
+   /**
+    * Returns the text witch appear on hover for this <code>Appointment</code>.
+    * 
+    * @return The <code>appointment</code>'s on hover text
+    */
+   public String getOnHoverText() {
+       return onHoverText;
+   }
+
+   /**
+    * Sets the text on hover of this <code>Appointment</code>.
+    * 
+    * @param text to set
+    *            The title's short text
+    */
+   public void setOnHoverText(String onHoverText) {
+       this.onHoverText = onHoverText;
+   }
+
    /**
     * Returns a location of this <code>Appointment</code>.
     * 
Index: 
src/main/java/com/bradrydzewski/gwt/calendar/client/dayview/AppointmentWidget.ja
va
===================================================================
--- 
src/main/java/com/bradrydzewski/gwt/calendar/client/dayview/AppointmentWidget.ja
va  (revision 336)
+++ 
src/main/java/com/bradrydzewski/gwt/calendar/client/dayview/AppointmentWidget.ja
va  (working copy)
@@ -84,6 +84,7 @@

    private String title;
    private String description;
+   private String onHoverText;
    private Date start;
    private Date end;
    private boolean selected;
@@ -190,8 +191,11 @@
    public String getTitle() {
       return title;
    }
-
-   public void setTitle(String title) {
+   /***
+    *  Add a title in the header of the Appointment Widget
+    *  @param title: title to add
+    */
+   public void setApptTitle(String title) {
       this.title = title;
       DOM.setInnerHTML(headerPanel.getElement(), title);
    }
@@ -205,6 +209,19 @@
       DOM.setInnerHTML(bodyPanel.getElement(), description);
    }

+   public String getOnHoverText() {
+      return onHoverText;
+   }
+
+   /**
+    * Set a "tool-tip" text view when the user is onHover of the Appointment
+    * @param onHoverText: the text to show on the hover
+    */
+   public void setOnHoverText(String onHoverText) {
+      this.onHoverText= onHoverText;
+      this.setTitle(onHoverText);
+   }
+
    public void formatTimeline(float top, float height) {
       timelineFillPanel.setHeight(height + "%");
       DOM.setStyleAttribute(timelineFillPanel.getElement(), "top", top + "%");
Index: src/main/java/com/bradrydzewski/gwt/calendar/client/dayview/DayView.java
===================================================================
--- 
src/main/java/com/bradrydzewski/gwt/calendar/client/dayview/DayView.java    (revisi
on 336)
+++ 
src/main/java/com/bradrydzewski/gwt/calendar/client/dayview/DayView.java    (workin
g copy)
@@ -116,11 +116,12 @@
                AppointmentWidget panel = new AppointmentWidget();
                panel.setWidth(appt.getWidth());
                panel.setHeight(appt.getHeight());
-               panel.setTitle(appt.getAppointment().getTitle());
+               panel.setApptTitle(appt.getAppointment().getTitle());
                panel.setTop(appt.getTop());
                panel.setLeft(appt.getLeft());
                panel.setAppointment(appt.getAppointment());
                panel.setDescription(appt.getAppointment().getDescription());
+               panel.setOnHoverText(appt.getAppointment().getOnHoverText());
                //panel.setAppointmentStyle(appt.getAppointment().getAppointmentStyle());
                dayViewBody.getGrid().grid.add(panel);
                boolean selected = calendarWidget.isTheSelectedAppointment(panel
@@ -159,7 +160,7 @@

            panel.setWidth(appt.getWidth());
            panel.setHeight(appt.getHeight());
-           panel.setTitle(appt.getAppointment().getTitle());
+           panel.setApptTitle(appt.getAppointment().getTitle());
            panel.setTop(appt.getTop());
            panel.setLeft(appt.getLeft());
            panel.setAppointment(appt.getAppointment());

Original issue reported on code.google.com by pier...@pvittet.com on 20 Jul 2010 at 9:06

GoogleCodeExporter commented 9 years ago

Original comment by Brad.Ryd...@gmail.com on 15 Aug 2010 at 8:31