diff --git a/client/src/org/adempiere/apps/graph/ViewPI.java b/client/src/org/adempiere/apps/graph/ViewPI.java new file mode 100644 index 0000000000..739760f80c --- /dev/null +++ b/client/src/org/adempiere/apps/graph/ViewPI.java @@ -0,0 +1,140 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.adempiere.apps.graph; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.logging.Level; + +import javax.swing.BoxLayout; + +import org.compiere.apps.ConfirmPanel; +import org.compiere.apps.form.FormFrame; +import org.compiere.apps.form.FormPanel; +import org.compiere.model.MGoal; +import org.compiere.swing.CPanel; +import org.compiere.swing.CScrollPane; +import org.compiere.util.CLogger; +import org.compiere.util.Env; + +/** + * View Performance Indicators + * + * @author Jorg Janke + * @version $Id: ViewPI.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $ + */ +public class ViewPI extends CPanel +implements FormPanel, ActionListener +{ + /** + * Init + * @param WindowNo + * @param frame + */ + public void init (int WindowNo, FormFrame frame) + { + log.fine(""); + m_WindowNo = WindowNo; + m_frame = frame; + try + { + // Top Selection Panel + // m_frame.getContentPane().add(selectionPanel, BorderLayout.NORTH); + // Center + initPanel(); + CScrollPane scroll = new CScrollPane (this); + m_frame.getContentPane().add(scroll, BorderLayout.CENTER); + // South + confirmPanel.addActionListener(this); + m_frame.getContentPane().add(confirmPanel, BorderLayout.SOUTH); + } + catch(Exception e) + { + log.log(Level.SEVERE, "", e); + } + sizeIt(); + } // init + + /** + * Size Window + */ + private void sizeIt() + { + // Frame + m_frame.pack(); + // Dimension size = m_frame.getPreferredSize(); + // size.width = WINDOW_WIDTH; + // m_frame.setSize(size); + } // size + + /** + * Dispose + */ + public void dispose() + { + if (m_frame != null) + m_frame.dispose(); + m_frame = null; + removeAll(); + } // dispose + + /** Window No */ + private int m_WindowNo = 0; + /** FormFrame */ + private FormFrame m_frame; + /** Logger */ + private static CLogger log = CLogger.getCLogger (ViewPI.class); + /** Confirmation Panel */ + private ConfirmPanel confirmPanel = new ConfirmPanel(); + + + /** + * Init Panel + */ + private void initPanel() + { + BoxLayout layout = new BoxLayout(this, BoxLayout.PAGE_AXIS); + MGoal[] goals = MGoal.getGoals(Env.getCtx()); + for (int i = 0; i < goals.length; i++) + { + PerformanceIndicator pi = new PerformanceIndicator(goals[i]); + pi.addActionListener(this); + add (pi); + } + } // initPanel + + + /** + * Action Listener for Drill Down + * @param e event + */ + public void actionPerformed (ActionEvent e) + { + if (e.getActionCommand().equals(ConfirmPanel.A_OK)) + dispose(); + else if (e.getSource() instanceof PerformanceIndicator) + { + PerformanceIndicator pi = (PerformanceIndicator)e.getSource(); + log.info(pi.getName()); + MGoal goal = pi.getGoal(); + if (goal.getMeasure() != null) + new PerformanceDetail(goal); + } + } // actionPerformed + +} // ViewPI diff --git a/migration/352a-trunk/268_BF2059012_ViewPI.sql b/migration/352a-trunk/268_BF2059012_ViewPI.sql new file mode 100644 index 0000000000..d2eec2197b --- /dev/null +++ b/migration/352a-trunk/268_BF2059012_ViewPI.sql @@ -0,0 +1,4 @@ +-- Aug 19, 2008 3:25:12 PM EST +-- BF2059012_ViewPI +UPDATE AD_Form SET Classname='org.adempiere.apps.graph.ViewPI',Updated=TO_DATE('2008-08-19 15:25:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Form_ID=119 +; diff --git a/migration/352a-trunk/postgresql/268_BF2059012_ViewPI.sql b/migration/352a-trunk/postgresql/268_BF2059012_ViewPI.sql new file mode 100644 index 0000000000..4fd25dbf02 --- /dev/null +++ b/migration/352a-trunk/postgresql/268_BF2059012_ViewPI.sql @@ -0,0 +1,4 @@ +-- Aug 19, 2008 3:25:12 PM EST +-- BF2059012_ViewPI +UPDATE AD_Form SET Classname='org.adempiere.apps.graph.ViewPI',Updated=TO_TIMESTAMP('2008-08-19 15:25:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Form_ID=119 +;