summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/lifecycle/chooser/ActivityChooser.java
diff options
context:
space:
mode:
Diffstat (limited to 'source/com/c2kernel/lifecycle/chooser/ActivityChooser.java')
-rwxr-xr-xsource/com/c2kernel/lifecycle/chooser/ActivityChooser.java200
1 files changed, 200 insertions, 0 deletions
diff --git a/source/com/c2kernel/lifecycle/chooser/ActivityChooser.java b/source/com/c2kernel/lifecycle/chooser/ActivityChooser.java
new file mode 100755
index 0000000..f79dedf
--- /dev/null
+++ b/source/com/c2kernel/lifecycle/chooser/ActivityChooser.java
@@ -0,0 +1,200 @@
+/*
+ * Created on 1 sept. 2003
+ *
+ * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package com.c2kernel.lifecycle.chooser;
+
+import java.awt.Container;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.HashMap;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import com.c2kernel.lifecycle.ActivityDef;
+import com.c2kernel.utils.Language;
+import com.c2kernel.utils.LocalObjectLoader;
+import com.c2kernel.utils.Logger;
+import com.c2kernel.utils.Resource;
+
+/**
+ * @author Developpement
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class ActivityChooser extends JFrame
+{
+ private LDAPFileChooser mLDAPFileChooserActivity = null;
+
+ private JButton mButtonOK = null;
+
+ private JButton mButtonCancel = null;
+
+ private JPanel mJPanelVertical = null;
+
+ private JPanel mJPanelHorizontal = null;
+
+ private String mMessage = "Choose or modify";
+
+ private WorkflowDialogue mParent = null;
+
+ private JLabel label = null;
+
+ HashMap mhashmap = null;
+
+ public ActivityChooser(String message, String title, Image img, WorkflowDialogue parent, HashMap hashmap)
+ {
+ super(title);
+ mMessage = message;
+ img = Resource.getImageResource("graph/newvertex_large.png").getImage();
+ setIconImage(img);
+ mParent = parent;
+ mhashmap = hashmap;
+ initialize();
+ }
+
+ private JButton getJButtonOK()
+ {
+ if (mButtonOK == null)
+ mButtonOK = new JButton(Language.translate("OK"));
+ return mButtonOK;
+ }
+
+ private JButton getJButtonCancel()
+ {
+ if (mButtonCancel == null)
+ mButtonCancel = new JButton(Language.translate("Cancel"));
+ return mButtonCancel;
+ }
+
+ private LDAPFileChooser getLDAPFileChooserActivity()
+ {
+ if (mLDAPFileChooserActivity == null)
+ {
+ try
+ {
+ mLDAPFileChooserActivity = new LDAPFileChooser(LDAPFileChooser.ACTIVITY_CHOOSER);
+ mLDAPFileChooserActivity.setName("LDAPFileChooserRouting");
+ mLDAPFileChooserActivity.setEditable(false);
+ //mLDAPFileChooserActivity.setBounds(125, 13, 400, 19);
+ } catch (Exception mExc)
+ {
+ Logger.error(mExc);
+ }
+ }
+ return mLDAPFileChooserActivity;
+ }
+
+ private void initialize()
+ {
+ getJButtonOK().addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ ActivityDef act = LocalObjectLoader.getActDef(mLDAPFileChooserActivity.getEntryName(), "last");
+ } catch (Exception ex)
+ {
+ }
+ Logger.debug(5, "mLDAPFileChooserActivity.getEntryName()" + mLDAPFileChooserActivity.getEntryName());
+ setCursor(new Cursor(Cursor.WAIT_CURSOR));
+ mParent.loadThisWorkflow(mLDAPFileChooserActivity.getEntryName(), mhashmap);
+ setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
+ close();
+ }
+ });
+ getJButtonCancel().addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ close();
+ }
+ });
+ //getContentPane().add(getJPanelVertical());
+ Container contentPane = getContentPane();
+ contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
+ contentPane.add(getJPanelVertical());
+ contentPane.add(getJPanelHorizontal());
+ contentPane.add(Box.createGlue());
+ Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
+ setLocation((d.width - getWidth()) / 2, (d.height - getHeight()) / 2);
+ setResizable(true);
+ pack();
+ setSize(new Dimension(getWidth(), getJButtonCancel().getHeight() + getLDAPFileChooserActivity().getHeight() + label.getHeight() + 100));
+ setVisible(true);
+ setVisible(true);
+ }
+
+ private void close()
+ {
+ mParent = null;
+ this.setEnabled(false);
+ this.setVisible(false);
+ }
+
+ private JPanel getJPanelVertical()
+ {
+ if (mJPanelVertical == null)
+ {
+ try
+ {
+ Logger.debug(8, "Panel button");
+ mJPanelVertical = new JPanel();
+ mJPanelVertical.setName("JPanelV");
+ mJPanelVertical.setLayout(new BoxLayout(mJPanelVertical, BoxLayout.Y_AXIS));
+ label = new JLabel(mMessage);
+ JPanel labelP = new JPanel();
+ labelP.setLayout(new BoxLayout(labelP, BoxLayout.X_AXIS));
+ labelP.add(label);
+ labelP.add(Box.createGlue());
+ mJPanelVertical.add(labelP);
+ mJPanelVertical.add(Box.createRigidArea(new Dimension(0, 5)));
+ mJPanelVertical.add(getLDAPFileChooserActivity(), getLDAPFileChooserActivity().getName());
+ //mJPanelVertical.add(Box.createRigidArea(new Dimension(0,
+ // 10)));
+ mJPanelVertical.add(Box.createGlue());
+ mJPanelVertical.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+ mJPanelVertical.setVisible(true);
+ } catch (java.lang.Throwable mExc)
+ {
+ //handleException(mExc);
+ }
+ }
+ return mJPanelVertical;
+ }
+
+ private JPanel getJPanelHorizontal()
+ {
+ if (mJPanelHorizontal == null)
+ {
+ try
+ {
+ Logger.debug(8, "Panel button");
+ mJPanelHorizontal = new JPanel();
+ mJPanelHorizontal.setName("JPanelH");
+ mJPanelHorizontal.setLayout(new BoxLayout(mJPanelHorizontal, BoxLayout.X_AXIS));
+ mJPanelHorizontal.add(getJButtonOK(), getJButtonOK().getName());
+ mJPanelHorizontal.add(Box.createRigidArea(new Dimension(10, 0)));
+ mJPanelHorizontal.add(getJButtonCancel(), getJButtonCancel().getName());
+ mJPanelHorizontal.setVisible(true);
+ } catch (java.lang.Throwable mExc)
+ {
+ //handleException(mExc);
+ }
+ }
+ return mJPanelHorizontal;
+ }
+} \ No newline at end of file