⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vonlycurrentdays.java

📁 Java写的ERP系统
💻 JAVA
字号:
/******************************************************************************
 * The contents of this file are subject to the   Compiere License  Version 1.1
 * ("License"); You may not use this file except in compliance with the License
 * You may obtain a copy of the License at http://www.compiere.org/license.html
 * Software distributed under the License is distributed on an  "AS IS"  basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 * The Original Code is                  Compiere  ERP & CRM  Business Solution
 * The Initial Developer of the Original Code is Jorg Janke  and ComPiere, Inc.
 * Portions created by Jorg Janke are Copyright (C) 1999-2002 Jorg Janke, parts
 * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
 * Contributor(s): ______________________________________.
 *****************************************************************************/
package org.compiere.grid;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

import org.compiere.util.*;
import org.compiere.apps.*;
import org.compiere.swing.*;

/**
 *	Queries how many days back cistory is displayed as current
 *
 * 	@author 	Jorg Janke
 * 	@version 	$Id: VOnlyCurrentDays.java,v 1.2 2002/09/15 01:05:40 jjanke Exp $
 */
public class VOnlyCurrentDays extends JDialog implements ActionListener
{
	/**
	 *	Constructor
	 *  @param parent parent frame
	 *  @param buttonLocation lower left corner of the button
	 */
	public VOnlyCurrentDays(Frame parent, Point buttonLocation)
	{
		//	How long back in History?
		super (parent, Msg.getMsg(Env.getCtx(), "VOnlyCurrentDays", true), true);
		try
		{
			jbInit();
		}
		catch(Exception e)
		{
			Log.error("VOnlyCurrentDays", e);
		}
		this.pack();
		buttonLocation.x -= (int)getPreferredSize().getWidth()/2;
		this.setLocation(buttonLocation);
		this.setVisible(true);
	}	//	VOnlyCurrentDays

	private CPanel mainPanel = new CPanel();
	private CButton bShowAll = new CButton();
	private CButton bShowMonth = new CButton();
	private CButton bShowWeek = new CButton();
	private CButton bShowDay = new CButton();
	private CButton bShowYear = new CButton();

	/**	Days					*/
	private int 	m_days = 1;
	/**	Margin					*/
	private static Insets	s_margin = new Insets (2, 2, 2, 2);

	/**
	 * 	Static Initializer
	 * 	@throws Exception
	 */
	private void jbInit() throws Exception
	{
		this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		bShowAll.setText(Msg.getMsg(Env.getCtx(), "All"));
		bShowAll.addActionListener(this);
		bShowAll.setMargin(s_margin);
		bShowYear.setText(Msg.getMsg(Env.getCtx(), "Year"));
		bShowYear.addActionListener(this);
		bShowYear.setMargin(s_margin);
		bShowMonth.setText(Msg.getMsg(Env.getCtx(), "Month"));
		bShowMonth.addActionListener(this);
		bShowMonth.setMargin(s_margin);
		bShowWeek.setText(Msg.getMsg(Env.getCtx(), "Week"));
		bShowWeek.addActionListener(this);
		bShowWeek.setMargin(s_margin);
		bShowDay.setText(Msg.getMsg(Env.getCtx(), "Day"));
		bShowDay.addActionListener(this);
		bShowDay.setMargin(s_margin);
		bShowDay.setDefaultCapable(true);
		//
		mainPanel.add(bShowDay, null);
		mainPanel.add(bShowWeek, null);
		mainPanel.add(bShowMonth, null);
		mainPanel.add(bShowYear, null);
		mainPanel.add(bShowAll, null);
		//
		mainPanel.setToolTipText(Msg.getMsg(Env.getCtx(), "VOnlyCurrentDays", false));
		this.getContentPane().add(mainPanel, BorderLayout.CENTER);
		this.getRootPane().setDefaultButton(bShowDay);
	}	//	jbInit

	/**
	 * 	Action Listener
	 * 	@param e evant
	 */
	public void actionPerformed(ActionEvent e)
	{
		if (e.getSource() == bShowDay)
			m_days = 1;
		else if (e.getSource() == bShowWeek)
			m_days = 7;
		else if (e.getSource() == bShowMonth)
			m_days = 31;
		else if (e.getSource() == bShowYear)
			m_days = 356;
		else
			m_days = -1;
		dispose();
	}	//	actionPerformed

	/**
	 * 	Get selected number of days
	 * 	@return days or -1 for all
	 */
	public int getCurrentDays()
	{
		return m_days;
	}	//	getCurrentDays

}	//	VOnlyCurrentDays

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -