home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 1.8 KB | 80 lines |
- // TodayEventPanel.java
- // 24.03.96
- //
- // a subpanel of the TodayPanel, shows info on the events happening today
-
- package cybcerone.main;
-
- import java.awt.Image;
- import java.awt.Graphics;
- import java.awt.FontMetrics;
- import java.awt.Rectangle;
- import java.awt.Color;
-
- import cybcerone.utils.Manif;
- import cybcerone.utils.ManifVector;
- import cybcerone.utils.VectorScrollingPanel;
- import cybcerone.utils.Appletlike;
-
- /**
- * Scrolls along at the bottom of the TodayPanel, giving relevant
- * information about the displayed event.
- */
- class TodayEventPanel extends VectorScrollingPanel {
- Rectangle placement = new Rectangle (86, 37, 1024-91, 26);
-
- public TodayEventPanel (String id, String statusText, Appletlike app) {
- super (id, statusText, app);
- reshape (placement);
- setSpace (scale (placement.width / 2));
- }
-
- public void update (ManifVector theEvents) {
- setText (theEvents.toVector ());
- }
-
- protected String getInfo (Object elem) {
- if (elem instanceof Manif) {
- return getInfo ((Manif) elem);
- } else
- return null;
- }
-
- private String getInfo (Manif theManif) {
- String faculte = theManif.getFaculte ();
- String person = theManif.getPerson ();
- String where = theManif.getWhere ();
- String comments = theManif.getComments ();
-
- String retVal = "";
-
- if (faculte != null)
- retVal += faculte;
- if (person != null) {
- if (retVal.length () > 0)
- retVal += ", ";
- retVal += person;
- }
- if (where != null) {
- if (retVal.length () > 0)
- retVal += ", ";
- retVal += where;
- }
- if (comments.length () > 0) {
- if (retVal.length () > 0)
- retVal += ", ";
- retVal += comments;
- }
-
- return retVal;
- }
-
-
- protected Object setText () {
- Object theVal = super.setText ();
- if (theVal != null)
- app.update (theVal);
- return theVal;
- }
- }
-