home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 2.8 KB | 115 lines |
- // ManifInfoPanel.java
- // 17.03.96
- //
- // a map panel for an event
-
- package cybcerone.utils;
-
- import java.awt.Image;
-
- import cybcerone.orient.OrientPanel;
-
- /**
- * The information from an event that gets put on the top of the
- * map screen.
- */
- public class ManifInfoPanel extends MapInfoPanel {
- private static final String id = "ManifInfoPanel";
- private static final String statusText = "Selected event";
-
- private static final String imageFile = "pictoInfoManif.gif";
-
- private static ScrollingPanel theTitle;
- private static ScrollingPanel theSubTitle;
- private static ScrollingPanel theTime;
- private static ScrollingPanel thePerson;
- private static ScrollingPanel theComments;
-
- private static final int x = scale (49);
- private static final int y1 = scale (0);
- private static final int y2 = scale (27);
- private static final int y3 = scale (54);
- private static final int y4 = scale (81);
- private static final int y5 = scale (108);
-
-
- public ManifInfoPanel (Appletlike app) {
- super (id, statusText, app);
-
- setBackground (OrientPanel.imagePath + imageFile, 3);
-
- theTitle = newPanel (x, y1);
- theSubTitle = newPanel (x, y2);
- theTime = newPanel (x, y3);
- thePerson = newPanel (x, y4);
- theComments = newPanel (x, y5);
-
- theTime.setColor (gray);
- thePerson.setColor (gray);
- theComments.setColor (gray);
- }
-
- private ScrollingPanel newPanel (int x, int y) {
- ScrollingPanel thePanel = new ScrollingPanel (id, statusText, app);
- add (thePanel);
- thePanel.reshape (x, y, size().width - x, scale (25));
- return thePanel;
- }
-
- public void setData (Manif theManif) {
- theTitle.setText (theManif.getTitle ());
- theSubTitle.setText (theManif.getGroupTitle ());
-
- setTime (theManif);
- setPerson (theManif);
- theComments.setText (theManif.getComments ());
- }
-
- private void setTime (Manif theManif) {
- String date = theManif.getDate ();
- String time = theManif.getTime ();
- String fac = theManif.getFaculte ();
- String where = theManif.getWhere ();
-
- String timeText = "";
-
- if (date != null)
- timeText += "le " + date;
- if (time != null) {
- if (timeText.length () > 0)
- timeText += " ";
- timeText += "α " + time;
- }
- if (fac != null) {
- if (timeText.length () > 0)
- timeText += ", ";
- timeText += fac;
- }
- if (where != null) {
- if (timeText.length () > 0)
- timeText += ", ";
- timeText += where;
- }
-
- theTime.setText (timeText);
- }
-
- private void setPerson (Manif theManif) {
- String person = theManif.getPerson ();
- String rattache = theManif.getRattache ();
-
- String personText = "";
-
- if (person != null)
- personText += person;
- if (rattache != null) {
- if (personText.length () > 0)
- personText += ", ";
- personText += "rattache a " + rattache;
- }
-
- thePerson.setText (personText);
- }
-
- }
-