From: Johannes Z. <jza...@us...> - 2006-02-28 11:23:24
|
Update of /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/gui/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23808/src/net/sf/magicmap/client/gui/dialogs Added Files: InfoObjectDialog.java RFIDAntennaDialog.java Log Message: added support for info objects and rfid antennas and tags --- NEW FILE: RFIDAntennaDialog.java --- /** * */ package net.sf.magicmap.client.gui.dialogs; import java.awt.Dialog; import java.awt.Frame; import java.awt.GraphicsConfiguration; import java.awt.HeadlessException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JTextField; import com.brunchboy.util.swing.relativelayout.RelativeLayout; import net.sf.magicmap.client.gui.utils.GUIConstants; import net.sf.magicmap.client.gui.utils.GUIUtils; import net.sf.magicmap.client.gui.utils.RelativePanelBuilder; import net.sf.magicmap.client.model.node.InfoObject; import net.sf.magicmap.client.model.node.RFIDAntenna; /** * @author Johannes Zapotoczky (joh...@za...) * */ public class RFIDAntennaDialog extends JDialog implements ActionListener { private RFIDAntenna antenna; private JTextField id; public static RFIDAntenna showDialog(JFrame owner) { RFIDAntennaDialog dialog = new RFIDAntennaDialog(owner); GUIUtils.locateOnScreen(dialog); dialog.setModal(true); dialog.setVisible(true); return dialog.getValues(); } private RFIDAntenna getValues() { return antenna; } /** * @param owner * @throws HeadlessException */ public RFIDAntennaDialog(Frame owner) { super(owner, GUIUtils.i18n("geopos")); this.setSize(300, 300); this.setResizable(false); RelativeLayout layout = new RelativeLayout(); RelativePanelBuilder builder = new RelativePanelBuilder(layout); JButton okButton = builder.createButton(GUIUtils.i18n("set"), "OK", this); JButton cancelButton = builder.createButton(GUIUtils.i18n("cancel"), "CANCEL", this); // ok/cancel area builder.addOKCancelButtonBar(okButton, cancelButton, "okcancel"); builder.setLeftLeftDistance("okcancel", null, 10); builder.setRightRightDistance("okcancel", null, -10); builder.setBottomBottomDistance("okcancel", null, -10); // Kopf builder.addDialogHeader("<html><b>" + GUIUtils.i18n("setgeopos") + "</b><br>" + GUIUtils.i18n("setgeoposhint") + "</html>", GUIConstants.ICON_GEOPOS_BIG, "header"); builder.setTop("header", 0); builder.setLeft("header", 0); builder.setRightRightDistance("header", null, 0); setContentPane(builder.getPanel()); getRootPane().setDefaultButton(okButton); //id id = builder.addTextField("longitude"); builder.addLabel("Longitude", "longitudelabel", id); builder.setLeft("longitudelabel", 20); builder.setRightRightDistance("longitude", null, -20); builder.setTopBottomDistance("longitudelabel", "header", 20); builder.setTopBottomDistance("longitude", "header", 20); } /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { if ("OK".equals(e.getActionCommand())) { this.antenna = new RFIDAntenna(id.getText(), -1, -1, ""); this.setVisible(false); } else if ("CANCEL".equals(e.getActionCommand())){ this.setVisible(false); } } } --- NEW FILE: InfoObjectDialog.java --- /** * */ package net.sf.magicmap.client.gui.dialogs; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JTextField; import net.sf.magicmap.client.gui.utils.GUIConstants; import net.sf.magicmap.client.gui.utils.GUIUtils; import net.sf.magicmap.client.gui.utils.RelativePanelBuilder; import net.sf.magicmap.client.model.node.InfoObject; import com.brunchboy.util.swing.relativelayout.RelativeLayout; /** * @author Johannes Zapotoczky (joh...@za...) * */ public class InfoObjectDialog extends JDialog implements ActionListener { /** * serial version id */ private static final long serialVersionUID = 2254415271972084477L; /** * the currently set geopos */ private InfoObject infoObject; /** * simple parameters */ private JTextField url; public static InfoObject showDialog(JFrame owner) { InfoObjectDialog dialog = new InfoObjectDialog(owner); GUIUtils.locateOnScreen(dialog); dialog.setModal(true); dialog.setVisible(true); return dialog.getValues(); } /** * @return */ private InfoObject getValues() { return infoObject; } public InfoObjectDialog(JFrame owner) { super(owner, GUIUtils.i18n("geopos")); this.setSize(300, 300); this.setResizable(false); RelativeLayout layout = new RelativeLayout(); RelativePanelBuilder builder = new RelativePanelBuilder(layout); JButton okButton = builder.createButton(GUIUtils.i18n("set"), "OK", this); JButton cancelButton = builder.createButton(GUIUtils.i18n("cancel"), "CANCEL", this); // ok/cancel area builder.addOKCancelButtonBar(okButton, cancelButton, "okcancel"); builder.setLeftLeftDistance("okcancel", null, 10); builder.setRightRightDistance("okcancel", null, -10); builder.setBottomBottomDistance("okcancel", null, -10); // Kopf builder.addDialogHeader("<html><b>" + GUIUtils.i18n("setgeopos") + "</b><br>" + GUIUtils.i18n("setgeoposhint") + "</html>", GUIConstants.ICON_GEOPOS_BIG, "header"); builder.setTop("header", 0); builder.setLeft("header", 0); builder.setRightRightDistance("header", null, 0); setContentPane(builder.getPanel()); getRootPane().setDefaultButton(okButton); //url url = builder.addTextField("longitude"); builder.addLabel("Longitude", "longitudelabel", url); builder.setLeft("longitudelabel", 20); builder.setRightRightDistance("longitude", null, -20); builder.setTopBottomDistance("longitudelabel", "header", 20); builder.setTopBottomDistance("longitude", "header", 20); } /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { if ("OK".equals(e.getActionCommand())) { this.infoObject = new InfoObject(url.getText(), InfoObject.TYPE_INFO); this.setVisible(false); } else if ("CANCEL".equals(e.getActionCommand())){ this.setVisible(false); } } } |