KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > calipso > reportgenerator > userinterface > UPPanel


1 package com.calipso.reportgenerator.userinterface;
2
3 import com.calipso.reportgenerator.common.LanguageTraslator;
4
5 import javax.swing.*;
6 import java.util.Date JavaDoc;
7 import java.util.Map JavaDoc;
8 import java.util.TreeMap JavaDoc;
9 import java.text.DateFormat JavaDoc;
10 import java.text.SimpleDateFormat JavaDoc;
11 import java.text.ParseException JavaDoc;
12 import java.awt.*;
13
14 /**
15  * Representa un subpanel de la instancia <code>UPsPanel</code>.
16  */

17
18 public abstract class UPPanel extends JPanel {
19
20   private TreeMap JavaDoc upTextFieldCollection;
21   protected UPCollectionElement owner;
22
23   protected void addUPTextField(Object JavaDoc key, UPComponent upTextField) {
24     getUpTextFieldCollection().put(key, upTextField);
25   }
26
27   public TreeMap JavaDoc getUpTextFieldCollection() {
28     if(upTextFieldCollection == null) {
29       upTextFieldCollection = new TreeMap JavaDoc();
30     }
31     return upTextFieldCollection;
32   }
33
34   protected String JavaDoc getDateFormatFrom(String JavaDoc dateString) {
35     String JavaDoc returnVal = null;
36     try {
37       DateFormat JavaDoc dateFormat = new SimpleDateFormat JavaDoc("yyyyMMdd");
38       Date JavaDoc date = dateFormat.parse(dateString);
39       DateFormat JavaDoc second = SimpleDateFormat.getDateInstance(DateFormat.SHORT, LanguageTraslator.getLocale());
40       returnVal = second.format(date);
41     } catch (ParseException JavaDoc e) {
42       e.printStackTrace();
43     }
44     return returnVal;
45   }
46
47   protected JPanel getWestPanel() {
48     JPanel pnlWest = new JPanel(new BorderLayout());
49     String JavaDoc dimensioName = owner.getFilterDefinition().getDimensionName();
50     JLabel label;
51     if(dimensioName!=null && !dimensioName.equalsIgnoreCase("")){
52       String JavaDoc dimensionCaption = owner.getReportSpec().getDimensionFromName(dimensioName).getCaption();
53       label = new JLabel(dimensionCaption);
54     }else{
55       label = new JLabel(owner.getFilterDefinition().getName());
56     }
57     pnlWest.add(label, BorderLayout.CENTER);
58     return pnlWest;
59   }
60
61
62   public abstract boolean fillParamsMap(Map JavaDoc params);
63 }
64
Popular Tags