IDEMPIERE-129 Restrictions on Toolbar and Menu
http://jira.idempiere.com/browse/IDEMPIERE-129
This commit is contained in:
parent
0af6267cc7
commit
3852377c43
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,219 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2007 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.compiere.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
|
||||
/** Generated Interface for AD_ToolBarButton
|
||||
* @author Adempiere (generated)
|
||||
* @version 360LTS.015
|
||||
*/
|
||||
public interface I_AD_ToolBarButton
|
||||
{
|
||||
|
||||
/** TableName=AD_ToolBarButton */
|
||||
public static final String Table_Name = "AD_ToolBarButton";
|
||||
|
||||
/** AD_Table_ID=200003 */
|
||||
public static final int Table_ID = MTable.getTable_ID(Table_Name);
|
||||
|
||||
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
/** AccessLevel = 4 - System
|
||||
*/
|
||||
BigDecimal accessLevel = BigDecimal.valueOf(4);
|
||||
|
||||
/** Load Meta Data */
|
||||
|
||||
/** Column name ActionClassName */
|
||||
public static final String COLUMNNAME_ActionClassName = "ActionClassName";
|
||||
|
||||
/** Set Action Class Name.
|
||||
* The class name that implements the interface for toolbar actions
|
||||
*/
|
||||
public void setActionClassName (String ActionClassName);
|
||||
|
||||
/** Get Action Class Name.
|
||||
* The class name that implements the interface for toolbar actions
|
||||
*/
|
||||
public String getActionClassName();
|
||||
|
||||
/** Column name ActionName */
|
||||
public static final String COLUMNNAME_ActionName = "ActionName";
|
||||
|
||||
/** Set Action Name.
|
||||
* Action name on the toolbar
|
||||
*/
|
||||
public void setActionName (String ActionName);
|
||||
|
||||
/** Get Action Name.
|
||||
* Action name on the toolbar
|
||||
*/
|
||||
public String getActionName();
|
||||
|
||||
/** Column name AD_Client_ID */
|
||||
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
|
||||
|
||||
/** Get Client.
|
||||
* Client/Tenant for this installation.
|
||||
*/
|
||||
public int getAD_Client_ID();
|
||||
|
||||
/** Column name AD_Org_ID */
|
||||
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
|
||||
|
||||
/** Set Organization.
|
||||
* Organizational entity within client
|
||||
*/
|
||||
public void setAD_Org_ID (int AD_Org_ID);
|
||||
|
||||
/** Get Organization.
|
||||
* Organizational entity within client
|
||||
*/
|
||||
public int getAD_Org_ID();
|
||||
|
||||
/** Column name AD_ToolBarButton_ID */
|
||||
public static final String COLUMNNAME_AD_ToolBarButton_ID = "AD_ToolBarButton_ID";
|
||||
|
||||
/** Set ToolBar Button */
|
||||
public void setAD_ToolBarButton_ID (int AD_ToolBarButton_ID);
|
||||
|
||||
/** Get ToolBar Button */
|
||||
public int getAD_ToolBarButton_ID();
|
||||
|
||||
/** Column name Classname */
|
||||
public static final String COLUMNNAME_Classname = "Classname";
|
||||
|
||||
/** Set Classname.
|
||||
* Java Classname
|
||||
*/
|
||||
public void setClassname (String Classname);
|
||||
|
||||
/** Get Classname.
|
||||
* Java Classname
|
||||
*/
|
||||
public String getClassname();
|
||||
|
||||
/** Column name ComponentName */
|
||||
public static final String COLUMNNAME_ComponentName = "ComponentName";
|
||||
|
||||
/** Set Component Name */
|
||||
public void setComponentName (String ComponentName);
|
||||
|
||||
/** Get Component Name */
|
||||
public String getComponentName();
|
||||
|
||||
/** Column name Created */
|
||||
public static final String COLUMNNAME_Created = "Created";
|
||||
|
||||
/** Get Created.
|
||||
* Date this record was created
|
||||
*/
|
||||
public Timestamp getCreated();
|
||||
|
||||
/** Column name CreatedBy */
|
||||
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
|
||||
|
||||
/** Get Created By.
|
||||
* User who created this records
|
||||
*/
|
||||
public int getCreatedBy();
|
||||
|
||||
/** Column name IsActive */
|
||||
public static final String COLUMNNAME_IsActive = "IsActive";
|
||||
|
||||
/** Set Active.
|
||||
* The record is active in the system
|
||||
*/
|
||||
public void setIsActive (boolean IsActive);
|
||||
|
||||
/** Get Active.
|
||||
* The record is active in the system
|
||||
*/
|
||||
public boolean isActive();
|
||||
|
||||
/** Column name IsCustomization */
|
||||
public static final String COLUMNNAME_IsCustomization = "IsCustomization";
|
||||
|
||||
/** Set Customization.
|
||||
* The change is a customization of the data dictionary and can be applied after Migration
|
||||
*/
|
||||
public void setIsCustomization (boolean IsCustomization);
|
||||
|
||||
/** Get Customization.
|
||||
* The change is a customization of the data dictionary and can be applied after Migration
|
||||
*/
|
||||
public boolean isCustomization();
|
||||
|
||||
/** Column name KeyStroke_KeyCode */
|
||||
public static final String COLUMNNAME_KeyStroke_KeyCode = "KeyStroke_KeyCode";
|
||||
|
||||
/** Set KeyCode.
|
||||
* KeyCode for shortcuts
|
||||
*/
|
||||
public void setKeyStroke_KeyCode (int KeyStroke_KeyCode);
|
||||
|
||||
/** Get KeyCode.
|
||||
* KeyCode for shortcuts
|
||||
*/
|
||||
public int getKeyStroke_KeyCode();
|
||||
|
||||
/** Column name KeyStroke_Modifiers */
|
||||
public static final String COLUMNNAME_KeyStroke_Modifiers = "KeyStroke_Modifiers";
|
||||
|
||||
/** Set Keystroke Modifiers.
|
||||
* Keystroke Modifiers for shortcuts
|
||||
*/
|
||||
public void setKeyStroke_Modifiers (int KeyStroke_Modifiers);
|
||||
|
||||
/** Get Keystroke Modifiers.
|
||||
* Keystroke Modifiers for shortcuts
|
||||
*/
|
||||
public int getKeyStroke_Modifiers();
|
||||
|
||||
/** Column name Name */
|
||||
public static final String COLUMNNAME_Name = "Name";
|
||||
|
||||
/** Set Name.
|
||||
* Alphanumeric identifier of the entity
|
||||
*/
|
||||
public void setName (String Name);
|
||||
|
||||
/** Get Name.
|
||||
* Alphanumeric identifier of the entity
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/** Column name Updated */
|
||||
public static final String COLUMNNAME_Updated = "Updated";
|
||||
|
||||
/** Get Updated.
|
||||
* Date this record was updated
|
||||
*/
|
||||
public Timestamp getUpdated();
|
||||
|
||||
/** Column name UpdatedBy */
|
||||
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
|
||||
|
||||
/** Get Updated By.
|
||||
* User who updated this records
|
||||
*/
|
||||
public int getUpdatedBy();
|
||||
}
|
|
@ -0,0 +1,173 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2007 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.compiere.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
|
||||
/** Generated Interface for AD_ToolBarButtonRestrict
|
||||
* @author Adempiere (generated)
|
||||
* @version 360LTS.015
|
||||
*/
|
||||
public interface I_AD_ToolBarButtonRestrict
|
||||
{
|
||||
|
||||
/** TableName=AD_ToolBarButtonRestrict */
|
||||
public static final String Table_Name = "AD_ToolBarButtonRestrict";
|
||||
|
||||
/** AD_Table_ID=200004 */
|
||||
public static final int Table_ID = MTable.getTable_ID(Table_Name);
|
||||
|
||||
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
/** AccessLevel = 6 - System - Client
|
||||
*/
|
||||
BigDecimal accessLevel = BigDecimal.valueOf(6);
|
||||
|
||||
/** Load Meta Data */
|
||||
|
||||
/** Column name Action */
|
||||
public static final String COLUMNNAME_Action = "Action";
|
||||
|
||||
/** Set Action.
|
||||
* Indicates the Action to be performed
|
||||
*/
|
||||
public void setAction (String Action);
|
||||
|
||||
/** Get Action.
|
||||
* Indicates the Action to be performed
|
||||
*/
|
||||
public String getAction();
|
||||
|
||||
/** Column name AD_Client_ID */
|
||||
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
|
||||
|
||||
/** Get Client.
|
||||
* Client/Tenant for this installation.
|
||||
*/
|
||||
public int getAD_Client_ID();
|
||||
|
||||
/** Column name AD_Org_ID */
|
||||
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
|
||||
|
||||
/** Set Organization.
|
||||
* Organizational entity within client
|
||||
*/
|
||||
public void setAD_Org_ID (int AD_Org_ID);
|
||||
|
||||
/** Get Organization.
|
||||
* Organizational entity within client
|
||||
*/
|
||||
public int getAD_Org_ID();
|
||||
|
||||
/** Column name AD_Role_ID */
|
||||
public static final String COLUMNNAME_AD_Role_ID = "AD_Role_ID";
|
||||
|
||||
/** Set Role.
|
||||
* Responsibility Role
|
||||
*/
|
||||
public void setAD_Role_ID (int AD_Role_ID);
|
||||
|
||||
/** Get Role.
|
||||
* Responsibility Role
|
||||
*/
|
||||
public int getAD_Role_ID();
|
||||
|
||||
public I_AD_Role getAD_Role() throws RuntimeException;
|
||||
|
||||
/** Column name AD_ToolBarButton_ID */
|
||||
public static final String COLUMNNAME_AD_ToolBarButton_ID = "AD_ToolBarButton_ID";
|
||||
|
||||
/** Set ToolBar Button */
|
||||
public void setAD_ToolBarButton_ID (int AD_ToolBarButton_ID);
|
||||
|
||||
/** Get ToolBar Button */
|
||||
public int getAD_ToolBarButton_ID();
|
||||
|
||||
public I_AD_ToolBarButton getAD_ToolBarButton() throws RuntimeException;
|
||||
|
||||
/** Column name AD_ToolBarButtonRestrict_ID */
|
||||
public static final String COLUMNNAME_AD_ToolBarButtonRestrict_ID = "AD_ToolBarButtonRestrict_ID";
|
||||
|
||||
/** Set ToolBar Button Restrict */
|
||||
public void setAD_ToolBarButtonRestrict_ID (int AD_ToolBarButtonRestrict_ID);
|
||||
|
||||
/** Get ToolBar Button Restrict */
|
||||
public int getAD_ToolBarButtonRestrict_ID();
|
||||
|
||||
/** Column name AD_Window_ID */
|
||||
public static final String COLUMNNAME_AD_Window_ID = "AD_Window_ID";
|
||||
|
||||
/** Set Window.
|
||||
* Data entry or display window
|
||||
*/
|
||||
public void setAD_Window_ID (int AD_Window_ID);
|
||||
|
||||
/** Get Window.
|
||||
* Data entry or display window
|
||||
*/
|
||||
public int getAD_Window_ID();
|
||||
|
||||
public I_AD_Window getAD_Window() throws RuntimeException;
|
||||
|
||||
/** Column name Created */
|
||||
public static final String COLUMNNAME_Created = "Created";
|
||||
|
||||
/** Get Created.
|
||||
* Date this record was created
|
||||
*/
|
||||
public Timestamp getCreated();
|
||||
|
||||
/** Column name CreatedBy */
|
||||
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
|
||||
|
||||
/** Get Created By.
|
||||
* User who created this records
|
||||
*/
|
||||
public int getCreatedBy();
|
||||
|
||||
/** Column name IsActive */
|
||||
public static final String COLUMNNAME_IsActive = "IsActive";
|
||||
|
||||
/** Set Active.
|
||||
* The record is active in the system
|
||||
*/
|
||||
public void setIsActive (boolean IsActive);
|
||||
|
||||
/** Get Active.
|
||||
* The record is active in the system
|
||||
*/
|
||||
public boolean isActive();
|
||||
|
||||
/** Column name Updated */
|
||||
public static final String COLUMNNAME_Updated = "Updated";
|
||||
|
||||
/** Get Updated.
|
||||
* Date this record was updated
|
||||
*/
|
||||
public Timestamp getUpdated();
|
||||
|
||||
/** Column name UpdatedBy */
|
||||
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
|
||||
|
||||
/** Get Updated By.
|
||||
* User who updated this records
|
||||
*/
|
||||
public int getUpdatedBy();
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
/******************************************************************************
|
||||
* 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.compiere.model;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
|
||||
/**
|
||||
* ToolBar & Button Restriction
|
||||
* @author Nicolas Micoud
|
||||
*/
|
||||
public class MToolBarButtonRestrict extends X_AD_ToolBarButtonRestrict
|
||||
{
|
||||
private static final long serialVersionUID = -422120961441035731L;
|
||||
private static CLogger s_log = CLogger.getCLogger(MToolBarButtonRestrict.class);
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
* @param ctx context
|
||||
* @param AD_Note_ID id
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MToolBarButtonRestrict (Properties ctx, int AD_ToolBarButtonRestrict_ID, String trxName)
|
||||
{
|
||||
super (ctx, AD_ToolBarButtonRestrict_ID, trxName);
|
||||
} // MToolBarButtonRestrict
|
||||
|
||||
/**
|
||||
* Load Constructor
|
||||
* @param ctx context
|
||||
* @param rs result set
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MToolBarButtonRestrict(Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super(ctx, rs, trxName);
|
||||
} // MToolBarButtonRestrict
|
||||
|
||||
/** Renvoie une liste des restrictions à appliquer en fonction du rôle, de la fenêtre, du formulaire, ... **/
|
||||
public static ArrayList<Integer> getOf (Properties ctx, int AD_Role_ID, String Action, int Action_ID, String trxName)
|
||||
{
|
||||
// Action : R-Report, W-Window, X-form
|
||||
ArrayList<Integer> list = new ArrayList<Integer>();
|
||||
|
||||
String sql = "SELECT AD_ToolBarButton_ID FROM AD_ToolBarButtonRestrict WHERE IsActive = 'Y'"
|
||||
+ " AND AD_Client_ID IN (0, " + Env.getAD_Client_ID(ctx) + ")"
|
||||
+ " AND (AD_Role_ID IS NULL OR AD_Role_ID = " + AD_Role_ID + ")"
|
||||
+ " AND (Action IS NULL "
|
||||
+ " OR Action='" + Action + "' AND (AD_Window_ID IS NULL OR AD_Window_ID = " + Action_ID + "))";
|
||||
s_log.warning("sql="+sql);
|
||||
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, trxName);
|
||||
ResultSet rs;
|
||||
try {
|
||||
rs = pstmt.executeQuery();
|
||||
|
||||
while (rs.next())
|
||||
{
|
||||
if (!list.contains(rs.getInt(1)))
|
||||
list.add (rs.getInt(1));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
|
||||
return list;
|
||||
} // getOf
|
||||
|
||||
/**
|
||||
* String Representation
|
||||
* @return info
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer ("MToolBarButtonRestrict[")
|
||||
.append(get_ID()).append(",AD_ToolBarButtonRestrict_ID=").append(getAD_ToolBarButtonRestrict_ID())
|
||||
.append("]");
|
||||
return sb.toString();
|
||||
} // toString
|
||||
|
||||
} // MToolBarButtonRestrict
|
|
@ -0,0 +1,252 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2007 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 *
|
||||
*****************************************************************************/
|
||||
/** Generated Model - DO NOT CHANGE */
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
|
||||
/** Generated Model for AD_ToolBarButton
|
||||
* @author Adempiere (generated)
|
||||
* @version 360LTS.015 - $Id$ */
|
||||
public class X_AD_ToolBarButton extends PO implements I_AD_ToolBarButton, I_Persistent
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20120329L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_AD_ToolBarButton (Properties ctx, int AD_ToolBarButton_ID, String trxName)
|
||||
{
|
||||
super (ctx, AD_ToolBarButton_ID, trxName);
|
||||
/** if (AD_ToolBarButton_ID == 0)
|
||||
{
|
||||
setAD_ToolBarButton_ID (0);
|
||||
setClassname (null);
|
||||
setComponentName (null);
|
||||
setIsCustomization (false);
|
||||
// N
|
||||
setName (null);
|
||||
} */
|
||||
}
|
||||
|
||||
/** Load Constructor */
|
||||
public X_AD_ToolBarButton (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
|
||||
/** AccessLevel
|
||||
* @return 4 - System
|
||||
*/
|
||||
protected int get_AccessLevel()
|
||||
{
|
||||
return accessLevel.intValue();
|
||||
}
|
||||
|
||||
/** Load Meta Data */
|
||||
protected POInfo initPO (Properties ctx)
|
||||
{
|
||||
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
|
||||
return poi;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer ("X_AD_ToolBarButton[")
|
||||
.append(get_ID()).append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/** Set Action Class Name.
|
||||
@param ActionClassName
|
||||
The class name that implements the interface for toolbar actions
|
||||
*/
|
||||
public void setActionClassName (String ActionClassName)
|
||||
{
|
||||
set_Value (COLUMNNAME_ActionClassName, ActionClassName);
|
||||
}
|
||||
|
||||
/** Get Action Class Name.
|
||||
@return The class name that implements the interface for toolbar actions
|
||||
*/
|
||||
public String getActionClassName ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_ActionClassName);
|
||||
}
|
||||
|
||||
/** Set Action Name.
|
||||
@param ActionName
|
||||
Action name on the toolbar
|
||||
*/
|
||||
public void setActionName (String ActionName)
|
||||
{
|
||||
set_Value (COLUMNNAME_ActionName, ActionName);
|
||||
}
|
||||
|
||||
/** Get Action Name.
|
||||
@return Action name on the toolbar
|
||||
*/
|
||||
public String getActionName ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_ActionName);
|
||||
}
|
||||
|
||||
/** Set ToolBar Button.
|
||||
@param AD_ToolBarButton_ID ToolBar Button */
|
||||
public void setAD_ToolBarButton_ID (int AD_ToolBarButton_ID)
|
||||
{
|
||||
if (AD_ToolBarButton_ID < 1)
|
||||
set_ValueNoCheck (COLUMNNAME_AD_ToolBarButton_ID, null);
|
||||
else
|
||||
set_ValueNoCheck (COLUMNNAME_AD_ToolBarButton_ID, Integer.valueOf(AD_ToolBarButton_ID));
|
||||
}
|
||||
|
||||
/** Get ToolBar Button.
|
||||
@return ToolBar Button */
|
||||
public int getAD_ToolBarButton_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_AD_ToolBarButton_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Classname.
|
||||
@param Classname
|
||||
Java Classname
|
||||
*/
|
||||
public void setClassname (String Classname)
|
||||
{
|
||||
set_Value (COLUMNNAME_Classname, Classname);
|
||||
}
|
||||
|
||||
/** Get Classname.
|
||||
@return Java Classname
|
||||
*/
|
||||
public String getClassname ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_Classname);
|
||||
}
|
||||
|
||||
/** Set Component Name.
|
||||
@param ComponentName Component Name */
|
||||
public void setComponentName (String ComponentName)
|
||||
{
|
||||
set_Value (COLUMNNAME_ComponentName, ComponentName);
|
||||
}
|
||||
|
||||
/** Get Component Name.
|
||||
@return Component Name */
|
||||
public String getComponentName ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_ComponentName);
|
||||
}
|
||||
|
||||
/** Set Customization.
|
||||
@param IsCustomization
|
||||
The change is a customization of the data dictionary and can be applied after Migration
|
||||
*/
|
||||
public void setIsCustomization (boolean IsCustomization)
|
||||
{
|
||||
set_Value (COLUMNNAME_IsCustomization, Boolean.valueOf(IsCustomization));
|
||||
}
|
||||
|
||||
/** Get Customization.
|
||||
@return The change is a customization of the data dictionary and can be applied after Migration
|
||||
*/
|
||||
public boolean isCustomization ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_IsCustomization);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set KeyCode.
|
||||
@param KeyStroke_KeyCode
|
||||
KeyCode for shortcuts
|
||||
*/
|
||||
public void setKeyStroke_KeyCode (int KeyStroke_KeyCode)
|
||||
{
|
||||
set_Value (COLUMNNAME_KeyStroke_KeyCode, Integer.valueOf(KeyStroke_KeyCode));
|
||||
}
|
||||
|
||||
/** Get KeyCode.
|
||||
@return KeyCode for shortcuts
|
||||
*/
|
||||
public int getKeyStroke_KeyCode ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_KeyStroke_KeyCode);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Keystroke Modifiers.
|
||||
@param KeyStroke_Modifiers
|
||||
Keystroke Modifiers for shortcuts
|
||||
*/
|
||||
public void setKeyStroke_Modifiers (int KeyStroke_Modifiers)
|
||||
{
|
||||
set_Value (COLUMNNAME_KeyStroke_Modifiers, Integer.valueOf(KeyStroke_Modifiers));
|
||||
}
|
||||
|
||||
/** Get Keystroke Modifiers.
|
||||
@return Keystroke Modifiers for shortcuts
|
||||
*/
|
||||
public int getKeyStroke_Modifiers ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_KeyStroke_Modifiers);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Name.
|
||||
@param Name
|
||||
Alphanumeric identifier of the entity
|
||||
*/
|
||||
public void setName (String Name)
|
||||
{
|
||||
set_Value (COLUMNNAME_Name, Name);
|
||||
}
|
||||
|
||||
/** Get Name.
|
||||
@return Alphanumeric identifier of the entity
|
||||
*/
|
||||
public String getName ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_Name);
|
||||
}
|
||||
|
||||
/** Get Record ID/ColumnName
|
||||
@return ID/ColumnName pair
|
||||
*/
|
||||
public KeyNamePair getKeyNamePair()
|
||||
{
|
||||
return new KeyNamePair(get_ID(), getName());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,209 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2007 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 *
|
||||
*****************************************************************************/
|
||||
/** Generated Model - DO NOT CHANGE */
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
import org.compiere.model.*;
|
||||
|
||||
/** Generated Model for AD_ToolBarButtonRestrict
|
||||
* @author Adempiere (generated)
|
||||
* @version 360LTS.015 - $Id$ */
|
||||
public class X_AD_ToolBarButtonRestrict extends PO implements I_AD_ToolBarButtonRestrict, I_Persistent
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20120329L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_AD_ToolBarButtonRestrict (Properties ctx, int AD_ToolBarButtonRestrict_ID, String trxName)
|
||||
{
|
||||
super (ctx, AD_ToolBarButtonRestrict_ID, trxName);
|
||||
/** if (AD_ToolBarButtonRestrict_ID == 0)
|
||||
{
|
||||
setAction (null);
|
||||
setAD_Role_ID (0);
|
||||
setAD_ToolBarButtonRestrict_ID (0);
|
||||
} */
|
||||
}
|
||||
|
||||
/** Load Constructor */
|
||||
public X_AD_ToolBarButtonRestrict (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
|
||||
/** AccessLevel
|
||||
* @return 6 - System - Client
|
||||
*/
|
||||
protected int get_AccessLevel()
|
||||
{
|
||||
return accessLevel.intValue();
|
||||
}
|
||||
|
||||
/** Load Meta Data */
|
||||
protected POInfo initPO (Properties ctx)
|
||||
{
|
||||
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
|
||||
return poi;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer ("X_AD_ToolBarButtonRestrict[")
|
||||
.append(get_ID()).append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/** Action AD_Reference_ID=104 */
|
||||
public static final int ACTION_AD_Reference_ID=104;
|
||||
/** Window = W */
|
||||
public static final String ACTION_Window = "W";
|
||||
/** Task = T */
|
||||
public static final String ACTION_Task = "T";
|
||||
/** WorkFlow = F */
|
||||
public static final String ACTION_WorkFlow = "F";
|
||||
/** Process = P */
|
||||
public static final String ACTION_Process = "P";
|
||||
/** Report = R */
|
||||
public static final String ACTION_Report = "R";
|
||||
/** Form = X */
|
||||
public static final String ACTION_Form = "X";
|
||||
/** Workbench = B */
|
||||
public static final String ACTION_Workbench = "B";
|
||||
/** Set Action.
|
||||
@param Action
|
||||
Indicates the Action to be performed
|
||||
*/
|
||||
public void setAction (String Action)
|
||||
{
|
||||
|
||||
set_Value (COLUMNNAME_Action, Action);
|
||||
}
|
||||
|
||||
/** Get Action.
|
||||
@return Indicates the Action to be performed
|
||||
*/
|
||||
public String getAction ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_Action);
|
||||
}
|
||||
|
||||
public I_AD_Role getAD_Role() throws RuntimeException
|
||||
{
|
||||
return (I_AD_Role)MTable.get(getCtx(), I_AD_Role.Table_Name)
|
||||
.getPO(getAD_Role_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Role.
|
||||
@param AD_Role_ID
|
||||
Responsibility Role
|
||||
*/
|
||||
public void setAD_Role_ID (int AD_Role_ID)
|
||||
{
|
||||
if (AD_Role_ID < 0)
|
||||
set_Value (COLUMNNAME_AD_Role_ID, null);
|
||||
else
|
||||
set_Value (COLUMNNAME_AD_Role_ID, Integer.valueOf(AD_Role_ID));
|
||||
}
|
||||
|
||||
/** Get Role.
|
||||
@return Responsibility Role
|
||||
*/
|
||||
public int getAD_Role_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
public I_AD_ToolBarButton getAD_ToolBarButton() throws RuntimeException
|
||||
{
|
||||
return (I_AD_ToolBarButton)MTable.get(getCtx(), I_AD_ToolBarButton.Table_Name)
|
||||
.getPO(getAD_ToolBarButton_ID(), get_TrxName()); }
|
||||
|
||||
/** Set ToolBar Button.
|
||||
@param AD_ToolBarButton_ID ToolBar Button */
|
||||
public void setAD_ToolBarButton_ID (int AD_ToolBarButton_ID)
|
||||
{
|
||||
if (AD_ToolBarButton_ID < 1)
|
||||
set_Value (COLUMNNAME_AD_ToolBarButton_ID, null);
|
||||
else
|
||||
set_Value (COLUMNNAME_AD_ToolBarButton_ID, Integer.valueOf(AD_ToolBarButton_ID));
|
||||
}
|
||||
|
||||
/** Get ToolBar Button.
|
||||
@return ToolBar Button */
|
||||
public int getAD_ToolBarButton_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_AD_ToolBarButton_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set ToolBar Button Restrict.
|
||||
@param AD_ToolBarButtonRestrict_ID ToolBar Button Restrict */
|
||||
public void setAD_ToolBarButtonRestrict_ID (int AD_ToolBarButtonRestrict_ID)
|
||||
{
|
||||
if (AD_ToolBarButtonRestrict_ID < 1)
|
||||
set_ValueNoCheck (COLUMNNAME_AD_ToolBarButtonRestrict_ID, null);
|
||||
else
|
||||
set_ValueNoCheck (COLUMNNAME_AD_ToolBarButtonRestrict_ID, Integer.valueOf(AD_ToolBarButtonRestrict_ID));
|
||||
}
|
||||
|
||||
/** Get ToolBar Button Restrict.
|
||||
@return ToolBar Button Restrict */
|
||||
public int getAD_ToolBarButtonRestrict_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_AD_ToolBarButtonRestrict_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
public I_AD_Window getAD_Window() throws RuntimeException
|
||||
{
|
||||
return (I_AD_Window)MTable.get(getCtx(), I_AD_Window.Table_Name)
|
||||
.getPO(getAD_Window_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Window.
|
||||
@param AD_Window_ID
|
||||
Data entry or display window
|
||||
*/
|
||||
public void setAD_Window_ID (int AD_Window_ID)
|
||||
{
|
||||
if (AD_Window_ID < 1)
|
||||
set_Value (COLUMNNAME_AD_Window_ID, null);
|
||||
else
|
||||
set_Value (COLUMNNAME_AD_Window_ID, Integer.valueOf(AD_Window_ID));
|
||||
}
|
||||
|
||||
/** Get Window.
|
||||
@return Data entry or display window
|
||||
*/
|
||||
public int getAD_Window_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Window_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
}
|
|
@ -87,8 +87,10 @@ import org.compiere.model.MLookupFactory;
|
|||
import org.compiere.model.MProcess;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MToolBarButtonRestrict;
|
||||
import org.compiere.model.MUser;
|
||||
import org.compiere.model.MWindow;
|
||||
import org.compiere.model.X_AD_ToolBarButton;
|
||||
import org.compiere.plaf.CompiereColor;
|
||||
import org.compiere.print.AReport;
|
||||
import org.compiere.process.DocAction;
|
||||
|
@ -149,6 +151,7 @@ public final class APanel extends CPanel
|
|||
private static final long serialVersionUID = 6066778919781303581L;
|
||||
|
||||
private boolean isNested = false;
|
||||
private boolean ToolBarMenuRestictionLoaded = false;
|
||||
|
||||
/**
|
||||
* Constructs a new instance.
|
||||
|
@ -1569,6 +1572,13 @@ public final class APanel extends CPanel
|
|||
//
|
||||
m_curWinTab.requestFocusInWindow();
|
||||
setBusy(false, true);
|
||||
|
||||
if (!ToolBarMenuRestictionLoaded)
|
||||
{
|
||||
updateToolBarAndMenuWithRestriction();
|
||||
ToolBarMenuRestictionLoaded = true;
|
||||
}
|
||||
|
||||
log.config( "fini");
|
||||
} // stateChanged
|
||||
|
||||
|
@ -2905,4 +2915,57 @@ public final class APanel extends CPanel
|
|||
if (frame instanceof AWindow)
|
||||
((AWindow)frame).setBusyMessage(message);
|
||||
}
|
||||
|
||||
private void updateToolBarAndMenuWithRestriction()
|
||||
{
|
||||
ArrayList<Integer> restrictionList = new ArrayList<Integer>();
|
||||
int ToolBarButton_ID = 0;
|
||||
|
||||
restrictionList = MToolBarButtonRestrict.getOf(m_ctx, MRole.getDefault().getAD_Role_ID(), "W", m_window.getAD_Window_ID(), null);
|
||||
log.warning("restrictionList="+restrictionList.toString());
|
||||
|
||||
for (int i = 0; i < restrictionList.size(); i++)
|
||||
{
|
||||
ToolBarButton_ID= restrictionList.get(i);
|
||||
|
||||
X_AD_ToolBarButton tbt = new X_AD_ToolBarButton(Env.getCtx(), ToolBarButton_ID, null);
|
||||
String restrictName = tbt.getComponentName();
|
||||
log.config("tbt="+tbt.getAD_ToolBarButton_ID() + " / " + restrictName);
|
||||
boolean found=false;
|
||||
|
||||
// remove from ToolBar
|
||||
for (int t = 0; t < toolBar.getComponentCount() && !found; t++)
|
||||
{
|
||||
if (toolBar.getComponent(t).getName()==null) // separator
|
||||
continue;
|
||||
|
||||
if (toolBar.getComponent(t).getName().equals(restrictName))
|
||||
{
|
||||
toolBar.remove(t);
|
||||
found=true;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove from Menu
|
||||
found=false;
|
||||
for (int m1 = 0; m1 < menuBar.getComponentCount() && !found; m1++)
|
||||
{
|
||||
JMenu menu = menuBar.getMenu(m1); // File, Edit, View...
|
||||
|
||||
for (int m2 = 0; m2 < menu.getItemCount() && !found; m2++) // New, Copy, Save...
|
||||
{
|
||||
if (menu.getItem(m2)==null) // separator
|
||||
continue;
|
||||
|
||||
if (menu.getItem(m2).getActionCommand().equals(restrictName))
|
||||
{
|
||||
menu.remove(m2);
|
||||
found=true;
|
||||
}
|
||||
} // menuItems
|
||||
} // Menu (File, Edit, View, ...)
|
||||
} // All restrictions
|
||||
|
||||
} // updateToolBarAndMenuWithRestriction
|
||||
|
||||
} // APanel
|
||||
|
|
Loading…
Reference in New Issue