Protect DesignTime Object In GP

Hai All ,
I Developing objects in Gp at Designtime . By creating the Folder under that callable Objects , Actions,Blocks,Process.
I want Protect my Objects.
No other user  will not able to modify.
How to Do this !
if any one know tell me..

Hi there,
Maybe you should take a look at which portal roles to assign to the user that is procssing a task, or executing a process. For example, some roles permit users to only view a DO without editing it, other roles permit users to see only runtime tab, etc.
Take a look at this doc for NW 7.0:
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/ff/1b3a4209a6ae04e10000000a1550b0/content.htm
Cheers,
Petra

Similar Messages

  • Protect object from accidental deletion

    When I first tested this, I noticed that protect object from accidental deletion adds and explicit deny for everyone to delete and delete subtree for that object only. However, after testing a bit further, I noticed that if you create a protected OU inside
    another protected OU, the parent OU will also gain the ACE deny Delete All Child Objects for the everyone group.
    Now, why on earth would that be a good thing?? I know most of you will answer "because of accidental deletion" but if that's the case then the child OU should also have the same rights (and all the problems that are inherited with the having of
    these rights).
    A move of an object is a create on the target OU and a delete on the parent OU. This basically means that if you have:
    An OU named "Groups" that is protected from deletion, with a child OU called "Specific Groups" also protected from deletion, with a Group called "My Test Group" under "Groups" OU and another group called "My Specific
    Test Group" under "Specific Groups" OU then "My Test Group" cannot be moved, deleted, etc whilst "My Specific Test Group" can, despite the fact that both OUs are protected from deletion. Even if you then delegate rights to
    Create, Move and Delete groups because the deny takes precedence the delegation would be useless...
    Unless you are an organization where you never have an OU inside an OU containing other objects, how would you possibly benefit from this, and is there a way (without doing it manually) protect ONLY OU's from deletion without protecting child objects?
    Johh

    Hi Marcin,
    It does facilitate OU protection, but by default in 2008 R2 when you create an OU it is set to be protected. Ensuring people untick the box and then manually protect that OU (by assigning rights directly to it rather than ticking the box) every time an OU
    is created for something as futile as preventing an OU from being deleted is almost a complete waste of time and the effort vs utility almost dictates that we'd be better off not having the prevent accidental deletions there at all. After all, we've survived
    Windows 2000 and 2003 without this functionality...
    As for the scenario, I'll give you a very simple example:
    You have Workstations under Workstations>Department Name>Desktops. You obviously have several GPOs linked at either one of those 3 places. All of a sudden, as part of testing a new deployment, you are required to add another GPO to the existing ones.
    As part of the testing phase, you create a Dev OU under Desktops and link the new GPO to the new Dev OU. At the same time that you do this, do you really go and create a new OU under Desktops to hold all the already existing objects under desktops and therefore
    prevent having any leaf-level objects and an child OU under the same parent OU? You could claim that a better way of doing it would be to create a Test OU at the top level of Workstations, but then you'd have to work out the effective permissions and GPOs
    at the other OU level and replicate it on the newly created one...

  • Smartview Problem with Protected Sheets

    Hello,
    We use Hyperion Smart View in our company and discovered a problem while using protected excel sheets while the addin is active. Excel asks for the password but doesnt accept it even if it is the right password. If we disable the addin the problem disappears. Has somebody else such a problem ?
    Has somebody a solution or a workaround ?
    Thanks for the help

    This issue was logged under Bug 6591401 - When Smart View is active and the worksheet is protected, the following error message is encountered ''Drawing Objects in one or more sheet(s) in the workbook are protected. Please unprotect them and try to save again.'' However, Bug 6591401 has been closed as not a defect.
    The following is an explanation of how Smart View handles protected cells and a workaround for this issue:
    Smart View needs some place to store it's own metadata within the Excel spreadsheet and it has been using a certain non-obtrusive object for the same. In versions 9.2 and prior, Smart View attempted to unprotect the Excel worksheets to be able to write it's metadata. That led to unexpected behavior when there were passwords used with the protection. This was fixed in 9.3.1.1.2 to make Smart View elegantly honor the spreadsheet protection and not touch objects which are specified as out of bounds by the user. However, when a spreadsheet is protected, this object can become inaccessible to Smart View, after which even a simple save operation cannot go through. In that sense, the current behavior is indeed the correct behavior, where the user placed restriction is honored correctly. The next question will be how can customers then work with protected sheets.
    While protecting a worksheet, the following dialog appears which is where the user will have to establish what kind of operations will be allowed on this worksheet. By default the top two options are the only ones that come pre-selected. Just allowing these two options is not sufficient for Smart View to be able to work with the worksheet.
    What also needs to be enabled is the option for "Edit Objects" which appears towards the end of the list. It is this option that helps Smart View to be able to persist it's own metadata within the worksheet in a non-obtrusive fashion. The guidance to all Smart View users should be to start enabling this option too, if they choose to apply worksheet protection.
    Noel

  • Grant privilage to access diff database objects

    How can we grant access to user1 from db1 to access user2 schema objects in db2 database ? Well, the user1 needs to perfrom insert, update and delete on db2's user2 schema.
    hare krishna
    Alok

    You may create a new schema on DB1 and create all synonyms with appropriate privileges for all the tables which need access.
    Create a database link from DB2 to access this new schema.
    This way you will be protecting other objects from getting modified from DB2.

  • Copying an unknown Object

    I have an Object that I pull from a Hashtable. I don't know what type of Object it is, nor do I care. But I need to make a copy of it and .clone() is protected on Object.
    eg.
    Object obj1 = hashtable.get(key);
    Object obj2 = obj1.clone(); // WILL NOT COMPILE (even in a try block)
    Any ideas?

    If these objects were created by your code, then they each need to implement Cloneable and also implement a public clone() method. If you call the clone() method of Object via super.clone(), then it is a shallow copy and you'll need to copy any embedded objects yourself.
    Assuming that all the classes in your Hashtable implement a public clone() method, then you'll need to either cast the reference to the appropriate class , or else use reflection to invoke the clone method.
    e.gimport java.lang.reflect.*;
    Object obj = yourHashtable.get("key");
    try {
        Method meth = obj.getClass().getMethod("clone", null);
        try {
            Object x = meth.invoke(obj, null);
            ...do something with cloned object x...
        } catch (Exception ex) {
            System.out.println("cannot call clone method: " + ex);
    } catch (NoSuchMethodException nsmex) {
        System.out.println("No public clone method exists: " + nsmex);
    }

  • Object Listener

    I would like to create a listener for java.util.LinkedList, so that when ever something is added or removed an event is fired.
    Does any one have a good way about tackling this problem???

    If you don't care about using Swing classes then you can use EventListenerList wich is the most generic class extended by all the swing listeners. In fact if you are not using Swing then the best way is to copy this class to your application so you don't depend on Swing just to use a list of listeners (this class does not depend on any other swing class so you will not have any problem doing this).
    The following is the source code of this class
    package yourPackage;
    import java.io.*;
    import java.util.*;
    import java.lang.reflect.Array;
    * A class that holds a list of EventListeners.  A single instance
    * can be used to hold all listeners (of all types) for the instance
    * using the list.  It is the responsiblity of the class using the
    * EventListenerList to provide type-safe API (preferably conforming
    * to the JavaBeans spec) and methods which dispatch event notification
    * methods to appropriate Event Listeners on the list.
    * The main benefits that this class provides are that it is relatively
    * cheap in the case of no listeners, and it provides serialization for
    * event-listener lists in a single place, as well as a degree of MT safety
    * (when used correctly).
    * Usage example:
    *    Say one is defining a class that sends out FooEvents, and one wants
    * to allow users of the class to register FooListeners and receive
    * notification when FooEvents occur.  The following should be added
    * to the class definition:
    * <pre>
    * EventListenerList listenerList = new EventListenerList();
    * FooEvent fooEvent = null;
    * public void addFooListener(FooListener l) {
    *     listenerList.add(FooListener.class, l);
    * public void removeFooListener(FooListener l) {
    *     listenerList.remove(FooListener.class, l);
    * // Notify all listeners that have registered interest for
    * // notification on this event type.  The event instance
    * // is lazily created using the parameters passed into
    * // the fire method.
    * protected void fireFooXXX() {
    *     // Guaranteed to return a non-null array
    *     Object[] listeners = listenerList.getListenerList();
    *     // Process the listeners last to first, notifying
    *     // those that are interested in this event
    *     for (int i = listeners.length-2; i>=0; i-=2) {
    *         if (listeners==FooListener.class) {
    * // Lazily create the event:
    * if (fooEvent == null)
    * fooEvent = new FooEvent(this);
    * ((FooListener)listeners[i+1]).fooXXX(fooEvent);
    * </pre>
    * foo should be changed to the appropriate name, and fireFooXxx to the
    * appropriate method name. One fire method should exist for each
    * notification method in the FooListener interface.
    * <p>
    * <strong>Warning:</strong>
    * Serialized objects of this class will not be compatible with
    * future Swing releases. The current serialization support is appropriate
    * for short term storage or RMI between applications running the same
    * version of Swing. A future release of Swing will provide support for
    * long term persistence.
    * @version 1.27 02/02/00
    * @author Georges Saab
    * @author Hans Muller
    * @author James Gosling
    public class EventListenerList implements Serializable {
    /* A null array to be shared by all empty listener lists*/
    private final static Object[] NULL_ARRAY = new Object[0];
    /* The list of ListenerType - Listener pairs */
    protected transient Object[] listenerList = NULL_ARRAY;
    * Passes back the event listener list as an array
    * of ListenerType-listener pairs. Note that for
    * performance reasons, this implementation passes back
    * the actual data structure in which the listener data
    * is stored internally!
    * This method is guaranteed to pass back a non-null
    * array, so that no null-checking is required in
    * fire methods. A zero-length array of Object should
    * be returned if there are currently no listeners.
    * WARNING!!! Absolutely NO modification of
    * the data contained in this array should be made -- if
    * any such manipulation is necessary, it should be done
    * on a copy of the array returned rather than the array
    * itself.
    public Object[] getListenerList() {
         return listenerList;
    * Return an array of all the listeners of the given type.
    * @returns all of the listeners of the specified type.
    * @since 1.3
    public EventListener[] getListeners(Class t) {
         Object[] lList = listenerList;
         int n = getListenerCount(t);
    EventListener[] result = (EventListener[])Array.newInstance(t, n);
         int j = 0;
         for (int i = lList.length-2; i>=0; i-=2) {
         if (lList[i] == t) {
              result[j++] = (EventListener)lList[i+1];
         return result;
    * Returns the total number of listeners for this listener list.
    public int getListenerCount() {
         return listenerList.length/2;
    * Returns the total number of listeners of the supplied type
    * for this listener list.
    public int getListenerCount(Class t) {
         int count = 0;
         Object[] lList = listenerList;
         for (int i = 0; i < lList.length; i+=2) {
         if (t == (Class)lList[i])
              count++;
         return count;
    * Adds the listener as a listener of the specified type.
    * @param t the type of the listener to be added
    * @param l the listener to be added
    public synchronized void add(Class t, EventListener l) {
         if (l==null) {
         // In an ideal world, we would do an assertion here
         // to help developers know they are probably doing
         // something wrong
         return;
         if (!t.isInstance(l)) {
         throw new IllegalArgumentException("Listener " + l +
                             " is not of type " + t);
         if (listenerList == NULL_ARRAY) {
         // if this is the first listener added,
         // initialize the lists
         listenerList = new Object[] { t, l };
         } else {
         // Otherwise copy the array and add the new listener
         int i = listenerList.length;
         Object[] tmp = new Object[i+2];
         System.arraycopy(listenerList, 0, tmp, 0, i);
         tmp[i] = t;
         tmp[i+1] = l;
         listenerList = tmp;
    * Removes the listener as a listener of the specified type.
    * @param t the type of the listener to be removed
    * @param l the listener to be removed
    public synchronized void remove(Class t, EventListener l) {
         if (l ==null) {
         // In an ideal world, we would do an assertion here
         // to help developers know they are probably doing
         // something wrong
         return;
         if (!t.isInstance(l)) {
         throw new IllegalArgumentException("Listener " + l +
                             " is not of type " + t);
         // Is l on the list?
         int index = -1;
         for (int i = listenerList.length-2; i>=0; i-=2) {
         if ((listenerList[i]==t) && (listenerList[i+1].equals(l) == true)) {
              index = i;
              break;
         // If so, remove it
         if (index != -1) {
         Object[] tmp = new Object[listenerList.length-2];
         // Copy the list up to index
         System.arraycopy(listenerList, 0, tmp, 0, index);
         // Copy from two past the index, up to
         // the end of tmp (which is two elements
         // shorter than the old list)
         if (index < tmp.length)
              System.arraycopy(listenerList, index+2, tmp, index,
                        tmp.length - index);
         // set the listener array to the new array or null
         listenerList = (tmp.length == 0) ? NULL_ARRAY : tmp;
    // Serialization support.
    private void writeObject(ObjectOutputStream s) throws IOException {
         Object[] lList = listenerList;
         s.defaultWriteObject();
         // Save the non-null event listeners:
         for (int i = 0; i < lList.length; i+=2) {
         Class t = (Class)lList[i];
         EventListener l = (EventListener)lList[i+1];
         if ((l!=null) && (l instanceof Serializable)) {
              s.writeObject(t.getName());
              s.writeObject(l);
         s.writeObject(null);
    private void readObject(ObjectInputStream s)
         throws IOException, ClassNotFoundException {
    listenerList = NULL_ARRAY;
         s.defaultReadObject();
         Object listenerTypeOrNull;
         while (null != (listenerTypeOrNull = s.readObject())) {
         EventListener l = (EventListener)s.readObject();
         add(Class.forName((String)listenerTypeOrNull), l);
    * Returns a string representation of the EventListenerList.
    public String toString() {
         Object[] lList = listenerList;
         String s = "EventListenerList: ";
         s += lList.length/2 + " listeners: ";
         for (int i = 0 ; i <= lList.length-2 ; i+=2) {
         s += " type " + ((Class)lList[i]).getName();
         s += " listener " + lList[i+1];
         return s;
    bye

  • Any way to protect changes to our code?

    Hi All.
    There are 2 implementors for the SAP Implementation that we are currently involved in.
    For ease of use of client, both are supposed to follow the same naming convention.
    Now, is there any way we can protect our objects from being changed by other party? For eg, I could think of an authorization group which gives access to only those SAP ID's we want. We can attach such an auth group to programs.
    But is there any way to protect all possible changes - programs, dict objects etc?
    Hope my query is clear.
    Any clues?
    Thanks in adv.

    Hi
    If your developers use own users (and nobody else can use those users), you can insert the flag to protect the editor.
    This flag (is in the attributes of the report) can be removed only by the user setted it.
    Max

  • Exchange 2003 - bulk create smtp contacts from user objects, bulk forward to smtp contacts, bulk turn off forwarding

    Exchange 2003 running on Windows server 2003.  ~50 Users all in same OU on same domain with primary email address [email protected]  objective is to create smtp contacts from each of the user objects imported back into the same domain in
    a different OU with mail, targetAddress, proxyAddresses/SMTP on the contacts being [email protected] and the options 'automatically update email addresses based on recipient policy' disabled and hidden from GAL for all.   At a later time will require
    a method to bulk forward all of the user objects to their corresponding  [email protected] contact object and a way to to bulk disable the forwarding at a later time.   
    ldifde created the contacts via export/import but Exchange seems to like rewriting the mail & proxyaddresses  or replacing domain2.com with one of the internal recipient policy domains requiring manual change in AD.
    ldifde -f export-01.ldf -s dc1.domain1.com -d "OU=Users,OU=people,DC=domain1,DC=com" -r "(&(objectCategory=person)(objectClass=user)(givenname=*))" -l "cn,givenName,objectclass,samAccountName,mail,physicalDeliveryOfficeName,displayName,name,description,sn,targetAddress"
    ldifde -i -f import-test-01.ldf -s dc1.domain1.com
    I'm then using ADModify.net to bulk modify hide from address lists attribute and correct the mail, targetaddress, proxyaddress attributes, possibly forwarding as well.  The process is clunky compared to something like powershell on Exchange 2010. 
    Am I going about this the wrong way?

    users will remain on the domain.  decommissioning or altering access to the old mailboxes until some point post-migration would be unwanted so there's a fallback method in case anything goes wrong.  until testing reveals a better method, the strategy
    for Exchange 2003 / Server 2003 environment will remain as is for now using ldifde export of select user object attributes followed by ldifde import of select attributes to contact objects, followed by admodify.net / admodcmd updating of the necessary mail/exchange
    attributes via %’mailNickName’% similar to what's described below to forward internal mail to the external host.
    Using ADModify to Change Exchange Specific AD User Attributes in Bulk
    Using ADModify – A real world example

  • Audio/Instrument objects "locked" in place??

    Hello on this rainy Sunday, at least for me in Canada! Perfect day to stay in and work on music.
    While building a new template for myself in Logic, all of a sudden I was unable to move my audio and instrument faders in the audio view of the enviroment. It was as if they were suddenly "locked" in place. Have I hit a key command that does this by accident?
    Any ideas as to why this is happening, and how to reverse it?

    Turn off protect environment objects, it's in one of the environment local menus. When this is on, no environment objects can be moved or deleted.

  • Why are these protected- finalize() & clone()

    Why are the methods finalize() and clone() declared as protected in Object class when any class that we write extends java.lang.Object? I mean what design considerations made them being declared as protected?

    Object.clone() is protected so that it cannot be called unless the person writing the code intends it to be cloned.
    In other words to make a class cloneable one must over-ride Object.clone() with a public method that does the cloning. In this way the method can only be called if an implementation of the mehtod has been coded.
    Convinced this is poorly explained so reply if you don't get it!
    Cheers,

  • Calling stored procedures from entity object and application module

    Hello
    I've put in place an EntiyImpl base class containg helper methods to call stored procedures.
    I now need to call stored procedures from the application module.
    Apart from creating an application module base class and duplicating the helper method code is there a way
    to share the helper methods for calling stored procedures between the entity impl and application module impl ?
    Regards
    Paul

    Does the helper code depend on features of a particular entity object instance, beyond its database transaction?
    If so, I'm not sure I see how it could be used from an application module class.
    If not, here's what you do:
    Step 1:
    Parametrize the database transaction--you might even want to. So instead of
    protected myHelperMethod(Object someParam) {
    DBTransaction trans = getDBTransaction();
    change this to
    protected myHelperMethod(DBTransaction trans, Object someParam) {
    Step 2: make the method public and static--once you parameterize the DBTransaction, you should be able to do this.
    public static myHelperMethod(DBTransaction trans, Object someParam) {
    Step 3: Remove the method from your EntityImpl base class into a utility class:
    public abstract class PlSqlUtils {
    private PlSqlUtils() {}
    public static myHelperMethod(DBTransaction trans, Object someParam) {
    When you want to call the method from an application module, entity object, or even view object class, call
    PlSqlUtils.myHelperMethod(getDBTransaction(), paramValue);
    Unlike Transaction.executeCommand(), this lets you provide functionality like setting procedure parameter values, retrieving OUT parameter values, etc.
    Hope this helps,
    Avrom

  • Is Object serialization secured?

    Hi,
    I wonder how secure is a serialized object being transported using TCP/IP Socket programming? Can someone sniff at my either server side or client side 's port to tap the object and then recover the information i send? Thank you very much.

    Serialized objects, by themselves, are NOT secure. You can protect the transport by using SSLSockets, or you can use SealedObject to protect the object over open transport.

  • Composite control - change text property of textbox from .cs file

    Hi All,
    I have created a composite control with dropdowns and hiddenfield for datepicker. Now when I change the value of dropdown from browser - client side then its value is retained on postback. But when I change value programmatically its not reflected on
    screen.
    using System;
    using System.Text;
    using System.Collections;
    using System.Collections.Generic;
    using System.Globalization;
    using System.ComponentModel;
    using System.Drawing;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.Design;
    using System.Web.UI.WebControls;
    using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
    namespace GOV.Framework.Portal.Controls
    /// <summary>
    /// Simple DateTimePicker control that uses jQuery UI DatePicker to pop up
    /// a date, time or both picker.
    /// </summary>
    [ToolboxBitmap(typeof(System.Web.UI.WebControls.Calendar)), DefaultProperty("SelectedValue"),
    ToolboxData("<{0}:DateTimePicker runat=\"server\"></{0}:DateTimePicker>"), PersistenceMode(PersistenceMode.InnerProperty)]
    public class DateTimePicker : WebControl
    #region "Global Variables"
    public enum DisplayControls
    TextBox,
    Dropdown
    public enum DisplayModes
    Button,
    ImageButton,
    AutoPopup,
    Inline,
    public enum DisplayTypes
    Time,
    Date,
    DateTime
    public enum DisplayMonthTypes
    Full,
    Short
    private enum DisplayYearTypes
    Full,
    Short
    private DropDownList ddlDay = new DropDownList();
    private DropDownList ddlMonth = new DropDownList();
    private DropDownList ddlYear = new DropDownList();
    private TextBox txtDate = new TextBox();
    private Label lblMsg = new Label();
    private System.Web.UI.WebControls.Image imgCal = new System.Web.UI.WebControls.Image();
    private HiddenField hdnDate = new HiddenField();
    private DisplayModes _DisplayMode = DisplayModes.ImageButton;
    private DisplayControls _DisplayControl = DisplayControls.TextBox;
    private DisplayTypes _DisplayType = DisplayTypes.DateTime;
    private int _StepMinutes = 1;
    private int _StepHours = 1;
    private DateTime? _MinDate = null;
    private DateTime? _MaxDate = null;
    private string _OnClientSelect = "";
    private string _ButtonImage = "../Images/calendar.png";
    private string _CalendarCss = "WebResource";
    private string _CalendarJs = "../scripts/timepicker.js";
    private DisplayMonthTypes _DisplayMonthType = DisplayMonthTypes.Full;
    private DisplayYearTypes _DisplayYearType = DisplayYearTypes.Full;
    private int _minYear = DateTime.Now.Year - 25;
    private int _maxYear = DateTime.Now.Year;
    private int _minMonth = 1;
    private int _maxMonth = 31;
    private int _minDay = 1;
    private int _maxDay = 28;
    private string _dateControlClientId = string.Empty;
    DateTime? _SelectedDate = null;
    private bool _DisplayMessageLabel = true;
    private short _tabIndex;
    private const string vwst_SelectedDate = "_SelectedDate";
    #region "ErrorMessages"
    private const string SelectedDate_GreaterThan_MaxDate = "SelectedDate can not be greater than MaxDate";
    private const string MaxDate_LessThan_SelectedDate = "MaxDate can not be less than SelectedDate";
    private const string SelectedDate_LessThan_MinDate = "SelectedDate can not be less than MinDate";
    private const string MinDate_GreaterThan_SelectedDate = "MinDate can not be greater than SelectedDate";
    #endregion
    #endregion
    #region "Properties"
    #region "Private Properties"
    [Description("Determines display full or short(yy) year")]
    [Category("DateTime Selection"), DefaultValue(typeof(DisplayTypes), "string")]
    private DisplayYearTypes DisplayYearType
    get
    return _DisplayYearType;
    set
    _DisplayYearType = value;
    [Description("Determines minimum year to be displayed in dropdown : Default currentyear - 25")]
    [Category("DateTime Selection"), DefaultValue(typeof(DisplayTypes), "int")]
    private int MinYear
    get
    if (MinDate != null)
    _minYear = MinDate.Value.Year;
    else
    _minYear = DateTime.Now.Year - 25;
    return _minYear;
    //set
    // _minDisplayYear = value;
    [Description("Determines maximum year to be displayed in dropdown : Default currentyear")]
    [Category("DateTime Selection"), DefaultValue(typeof(DisplayTypes), "int")]
    private int MaxYear
    get
    if (MaxDate != null)
    _maxYear = MaxDate.Value.Year;
    else
    _maxYear = DateTime.Now.Year;
    return _maxYear;
    //set
    // _maxDisplayYear = value;
    private string DateControlClientId
    get
    if (DisplayControl == DisplayControls.Dropdown)
    _dateControlClientId = hdnDate.ClientID;
    else
    _dateControlClientId = txtDate.ClientID;
    return _dateControlClientId;
    [Description("Determines minimum month of min date : default 1")]
    [Category("DateTime Selection"), DefaultValue(1)]
    private int minMonth
    get
    if (MinDate != null)
    _minMonth = MinDate.Value.Month;
    else
    _minMonth = 1;
    return _minMonth;
    [Description("Determines max months of max date: Default 12")]
    [Category("DateTime Selection"), DefaultValue(12)]
    private int maxMonth
    get
    if (MaxDate != null)
    _maxMonth = MaxDate.Value.Month;
    else
    _maxMonth = 1;
    return _maxMonth;
    [Description("Determines minimum day : Defualt 1")]
    [Category("DateTime Selection"), DefaultValue(1)]
    private int minDay
    get
    if (MinDate != null)
    _minDay = MinDate.Value.Day;
    else
    _minDay = 1;
    return _minDay;
    [Description("Determines max day: Defualt last day of max month")]
    [Category("DateTime Selection"), DefaultValue(30)]
    private int maxDay
    get
    if (MaxDate != null)
    _maxDay = MaxDate.Value.Day;
    else
    _maxDay = DateTime.DaysInMonth(MaxYear, maxMonth);
    return _maxDay;
    #endregion
    #region "Public Properties"
    /// <summary>
    /// The currently selected datetime
    /// </summary>
    [Category("DateTime Selection")]
    public DateTime? SelectedValue
    get
    DateTime dt = new DateTime();
    if (DisplayControl == DisplayControls.TextBox && txtDate.Text != "")
    DateTime.TryParse(txtDate.Text, out dt);
    else if (DisplayControl == DisplayControls.Dropdown && hdnDate.Value != "")
    DateTime.TryParse(hdnDate.Value, out dt);
    if (dt != null && dt != new DateTime())
    _SelectedDate = dt;
    else
    _SelectedDate = null;
    return _SelectedDate;
    set
    if (!value.HasValue)
    txtDate.Text = "";
    hdnDate.Value = "";
    else
    if (value != null && MinDate != null && value < MinDate)
    throw new ArgumentOutOfRangeException("SelectedValue", SelectedDate_LessThan_MinDate);
    if (value != null && MaxDate != null && value > MaxDate)
    throw new ArgumentOutOfRangeException("SelectedValue", SelectedDate_GreaterThan_MaxDate);
    string dateFormat = this.DateTimeFormat;
    //if ( dateFormat == "Auto")
    // dateFormat = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;
    if (DisplayControl == DisplayControls.TextBox)
    txtDate.Text = value.Value.ToString(dateFormat);
    else if (DisplayControl == DisplayControls.Dropdown)
    hdnDate.Value = value.Value.ToString(dateFormat);
    _SelectedDate = value;
    if (DisplayControl == DisplayControls.Dropdown)
    setDropDownValue(value);
    [Description("Determines display textbox or dropdowns")]
    [Category("DateTime Selection"), DefaultValue(typeof(DisplayModes), "TextBox")]
    public DisplayControls DisplayControl
    get { return _DisplayControl; }
    set { _DisplayControl = value; }
    [Description("Determines how the datepicking option is activated")]
    [Category("DateTime Selection"), DefaultValue(typeof(DisplayModes), "ImageButton")]
    public DisplayModes DisplayMode
    get { return _DisplayMode; }
    set { _DisplayMode = value; }
    [Description("Determines what datetimepicker should return")]
    [Category("DateTime Selection"), DefaultValue(typeof(DisplayTypes), "DateTime")]
    public DisplayTypes DisplayType
    get
    return _DisplayType;
    set
    _DisplayType = value;
    [Description("Increment minute factor when using the time picker.")]
    [Category("DateTime Selection"), DefaultValue(1)]
    public int StepMinutes
    get
    return _StepMinutes;
    set
    _StepMinutes = value;
    [Description("Increment hour factor when using the time picker.")]
    [Category("DateTime Selection"), DefaultValue(1)]
    public int StepHours
    get
    return _StepHours;
    set
    _StepHours = value;
    private string _DateTimeFormat = CultureInfo.CurrentCulture != null ? CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern : "dd/MM/yyyy";
    [Description("Determines the Date Format used. Auto uses CurrentCulture.DateTimeFormat.ShortDatePattern. Format: MM month, dd date, yyyy year symbol")]
    [Category("DateTime Selection"), DefaultValue("dd/MM/yyyy")]
    public string DateTimeFormat
    get
    return _DateTimeFormat;
    set
    _DateTimeFormat = value;
    [Description("Minumum allowable date. Leave blank to allow any date")]
    [Category("DateTime Selection"), DefaultValue(typeof(DateTime?), null)]
    public DateTime? MinDate
    get
    return _MinDate;
    set
    if (value != null && SelectedValue != null && value > SelectedValue)
    throw new ArgumentOutOfRangeException("MinDate", MinDate_GreaterThan_SelectedDate);
    _MinDate = value;
    [Description("Maximum allowable date. Leave blank to allow any date.")]
    [Category("DateTime Selection"), DefaultValue(typeof(DateTime?), null)]
    public DateTime? MaxDate
    get
    return _MaxDate;
    set
    if (value != null && SelectedValue != null && value < SelectedValue)
    throw new ArgumentOutOfRangeException("MaxDate", MaxDate_LessThan_SelectedDate);
    _MaxDate = value;
    [Description("Client event handler fired when a date is selected")]
    [Category("DateTime Selection"), DefaultValue("")]
    public string OnClientSelect
    get
    return _OnClientSelect;
    set
    _OnClientSelect = value;
    [Description("Url to a Calendar Image. Applies only if the DisplayMode = ImageButton")]
    [Category("DateTime Resource"), DefaultValue("../Images/calendar.png")]
    public string ButtonImage
    get { return _ButtonImage; }
    set { _ButtonImage = value; }
    [Category("DateTime Resource"), Description("The CSS that is used for the calendar or empty for default."), DefaultValue("WebResource")]
    public string CalendarCss
    get { return _CalendarCss; }
    set { _CalendarCss = value; }
    [Description("Location for the calendar JavaScript or empty for default.")]
    [Category("DateTime Resource"), DefaultValue("../scripts/timepicker.js")]
    public string CalendarJs
    get { return _CalendarJs; }
    set { _CalendarJs = value; }
    [Description("Determines what to Display full Month name or short month name")]
    [Category("DateTime Selection"), DefaultValue(typeof(DisplayTypes), "string")]
    public DisplayMonthTypes DisplayMonthType
    get
    return _DisplayMonthType;
    set
    _DisplayMonthType = value;
    [Description("Display static label for msg below date control")]
    [Category("DateTime Selection"), DefaultValue(true)]
    public bool DisplayMessageLable
    get { return _DisplayMessageLabel; }
    set { _DisplayMessageLabel = value; }
    [Bindable(true)]
    [DefaultValue("false")]
    public override short TabIndex
    get
    return _tabIndex;
    set
    _tabIndex = value;
    ddlDay.TabIndex = value;
    ddlMonth.TabIndex = value;
    ddlYear.TabIndex = value;
    imgCal.TabIndex = value;
    #endregion
    #endregion
    #region "Events"
    public DateTimePicker()
    this.Width = Unit.Pixel(80);
    /// <summary>
    /// Load all controls
    /// </summary>
    /// <param name="e"></param>
    protected override void OnInit(EventArgs e)
    base.OnInit(e);
    //Controls.Clear();
    //CreateAndAddControls();
    /// <summary>
    /// Add Child controls - Dropdowns and textbox;
    /// </summary>
    protected override void CreateChildControls()
    base.CreateChildControls();
    Controls.Clear();
    CreateAndAddControls();
    /// <summary>
    /// Load all controls
    /// </summary>
    /// <param name="e"></param>
    protected override void OnLoad(EventArgs e)
    base.OnLoad(e);
    if (DisplayControl == DisplayControls.Dropdown)
    if (ddlDay.Items.Count == 0 || ddlMonth.Items.Count == 0 || ddlYear.Items.Count == 0 || !Page.IsPostBack)
    FillDropdowns();
    generateDisplayMessage();
    protected override void LoadViewState(object savedState)
    base.LoadViewState(savedState);
    protected override void LoadControlState(object savedState)
    base.LoadControlState(savedState);
    protected override object SaveViewState()
    if (HasControls() && Page.IsPostBack)
    ddlDay.SelectedValue = "11";
    object obj = base.SaveViewState();
    return obj;
    protected override void TrackViewState()
    base.TrackViewState();
    /// <summary>
    /// Most of the work happens here for generating the hook up script code
    /// </summary>
    /// <param name="e"></param>
    protected override void OnPreRender(EventArgs e)
    base.OnPreRender(e);
    // Register resources
    this.RegisterResources();
    string script = GenerateScript();
    Page.ClientScript.RegisterStartupScript(this.GetType(), "_cal" + this.ID, script, true);
    /// <summary>
    /// Render Control
    /// </summary>
    /// <param name="writer"></param>
    public override void RenderControl(HtmlTextWriter writer)
    if (this.DisplayMode != DisplayModes.Inline)
    base.RenderControl(writer);
    else
    writer.Write("<div id='" + this.ClientID + "Div'></div>");
    if (HttpContext.Current == null)
    if (this.DisplayMode == DisplayModes.Button)
    writer.Write(" <input type='button' value='...' style='width: 20px; height: 20px;' />");
    else if ((this.DisplayMode == DisplayModes.ImageButton))
    string img;
    if (this.ButtonImage == "WebResource")
    img = this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "jQueryDatePicker.Resources.calendar.png");
    else
    img = this.ResolveUrl(this.ButtonImage);
    writer.AddAttribute(HtmlTextWriterAttribute.Src, img);
    writer.AddAttribute("hspace", "2");
    writer.RenderBeginTag(HtmlTextWriterTag.Img);
    writer.RenderEndTag();
    /// <summary>
    /// Render Control
    /// </summary>
    /// <param name="writer"></param>
    protected override void Render(HtmlTextWriter writer)
    RenderControls(writer);
    #endregion
    #region "Methods"
    /// <summary>
    /// Set properties of control
    /// </summary>
    private void CreateAndAddControls()
    txtDate.ID = "_txtDate";
    txtDate.CssClass = "dpDate";
    ddlDay.ID = "_ddlDay";
    ddlMonth.ID = "_ddlMonth";
    ddlYear.ID = "_ddlYear";
    imgCal.ID = "_imgCal";
    imgCal.CssClass = "trigger";
    imgCal.ImageUrl = this.ButtonImage;
    //imgCal.Visible = false;
    hdnDate.ID = "_hdnDate";
    lblMsg.ID = "_lblMsg";
    lblMsg.CssClass = "MsgLabel";
    if (DisplayControl == DisplayControls.Dropdown)
    txtDate.Visible = false;
    this.Controls.Add(ddlDay);
    this.Controls.Add(ddlMonth);
    this.Controls.Add(ddlYear);
    this.Controls.Add(hdnDate);
    else
    txtDate.Visible = true;
    this.Controls.Add(txtDate);
    this.Controls.Add(imgCal);
    this.Controls.Add(lblMsg);
    /// <summary>
    /// Add Controls to the control
    /// </summary>
    private void RenderControls(HtmlTextWriter writer)
    //if (ChildControlsCreated)
    // return;
    AddAttributesToRender(writer);
    writer.AddAttribute(HtmlTextWriterAttribute.Class, "datePickerTable", false);
    writer.RenderBeginTag(HtmlTextWriterTag.Table);//start of table
    writer.RenderBeginTag(HtmlTextWriterTag.Tr);//start of tr1
    if (DisplayControl == DisplayControls.Dropdown)
    writer.RenderBeginTag(HtmlTextWriterTag.Td);
    ddlDay.RenderControl(writer);
    writer.RenderEndTag();
    writer.RenderBeginTag(HtmlTextWriterTag.Td);
    ddlMonth.RenderControl(writer);
    writer.RenderEndTag();
    writer.RenderBeginTag(HtmlTextWriterTag.Td);
    ddlYear.RenderControl(writer);
    writer.RenderEndTag();
    writer.RenderBeginTag(HtmlTextWriterTag.Td);
    hdnDate.RenderControl(writer);
    writer.RenderEndTag();
    else
    writer.RenderBeginTag(HtmlTextWriterTag.Td);
    txtDate.RenderControl(writer);
    writer.RenderEndTag();
    writer.RenderBeginTag(HtmlTextWriterTag.Td);
    //Control ltrl1 = new LiteralControl();
    //writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "None");
    //writer.RenderBeginTag(HtmlTextWriterTag.Div);
    ////ltrl1.RenderControl(writer);
    //imgCal.RenderControl(writer);
    //writer.RenderEndTag();//end of div
    writer.Write("<div style=\"display:none\">");
    imgCal.RenderControl(writer);
    writer.Write("</div>");
    writer.RenderEndTag();
    writer.RenderEndTag();//end of tr1
    writer.RenderBeginTag(HtmlTextWriterTag.Tr);//start of tr
    writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "4", false);
    writer.RenderBeginTag(HtmlTextWriterTag.Td);
    lblMsg.RenderControl(writer);
    writer.RenderEndTag();
    writer.RenderEndTag();// end of tr2
    writer.RenderEndTag();// end of table
    //string newTable = "<table class='datePickerTable'";
    //string endTable = "</table>";
    //string newTr = "<tr>";
    //string endTr = "</tr>";
    //string newTd = "<td>";
    //string endTd = "</td>";
    ////Controls.Clear();
    //InitControls();
    //Controls.Add(new LiteralControl(newTable + newTr + newTd));
    //if (DisplayControl == DisplayControls.Dropdown)
    // Controls.Add(ddlDay);
    // Controls.Add(new LiteralControl(endTd + newTd));
    // Controls.Add(ddlMonth);
    // Controls.Add(new LiteralControl(endTd + newTd));
    // Controls.Add(ddlYear);
    // Controls.Add(new LiteralControl(endTd + newTd));
    //Controls.Add(txtDate);
    //Controls.Add(hdnDate);
    //Controls.Add(new LiteralControl(endTd + newTd));
    //Controls.Add(new LiteralControl("<div style=\"display:none\">"));
    //Controls.Add(imgCal);
    //Controls.Add(new LiteralControl("</div>"));
    //Controls.Add(new LiteralControl(endTd + endTr));
    //Controls.Add(new LiteralControl(newTr + "<td colspan=4>"));
    //Controls.Add(lblMsg);
    //Controls.Add(new LiteralControl(endTd + endTr + endTable));
    /// <summary>
    /// Code that embeds related resources (.js and css)
    /// </summary>
    /// <param name="scriptProxy"></param>
    protected void RegisterResources()
    // Load the calandar script
    string script = this.CalendarJs;
    // Load jQuery Calendar Scripts
    if (script == "WebResource")
    Page.ClientScript.RegisterClientScriptResource(this.GetType(), "jQueryDatePicker.Resources.ui.datepicker.js");
    else if (!string.IsNullOrEmpty(script))
    Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "__jqueryCalendar", this.ResolveUrl(script));
    // Load the related CSS reference into the page
    script = this.CalendarCss;
    if (script == "WebResource")
    script = Page.ClientScript.GetWebResourceUrl(this.GetType(), "jQueryDatePicker.Resources.ui.datepicker.css");
    else if (!string.IsNullOrEmpty(script))
    script = this.ResolveUrl(this.CalendarCss);
    // Register Calendar CSS 'manually'
    string css = @"<link href=""" + script + @""" type=""text/css"" rel=""stylesheet"" />";
    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "_calcss", css, false);
    /// <summary>
    /// Converts a date to a JavaScript date string in UTC format
    /// </summary>
    /// <param name="date"></param>
    /// <returns></returns>
    private static string EncodeJsDate(DateTime date)
    return "new Date(\"" + date.ToString("U") + " UTC" + "\")";
    /// <summary>
    /// Generate Javascript for Datepicker plugin
    /// </summary>
    /// <returns></returns>
    private string GenerateScript()
    // To capture and map the various option parameters
    StringBuilder sbOptions = new StringBuilder(512);
    sbOptions.Append("{");
    //jQuey Script
    StringBuilder sbStartupScript = new StringBuilder(400);
    sbStartupScript.AppendLine("jQuery(document).ready( function() {");
    string dateFormat = this.DateTimeFormat;
    if (!string.IsNullOrEmpty(dateFormat))
    dateFormat = this.DateTimeFormat.Replace("MMM", "M").Replace("MM", "mm");
    sbOptions.Append("dateFormat: '" + dateFormat + "'");
    //string onSelect = this.OnClientSelect;
    if (this.DisplayMode == DisplayModes.Button)
    sbOptions.Append(",showOnFocus: false, showTrigger: '<button type=\"button\" class=\"trigger\">...</button>'");
    else if (this.DisplayMode == DisplayModes.ImageButton)
    string img = this.ButtonImage;
    if (img == "WebResource")
    img = Page.ClientScript.GetWebResourceUrl(this.GetType(), "jQueryDatePicker.Resources.calendar.png");
    else
    img = this.ResolveUrl(this.ButtonImage);
    sbOptions.Append(",showOnFocus: false, showTrigger: '#" + imgCal.ClientID + "'");
    sbOptions.Append(", onSelect: DateSelectedFromCalendar ");
    if (this.MinDate.HasValue)
    sbOptions.Append(",minDate: new Date(" + MinDate.Value.Year.ToString() + "," + (MinDate.Value.Month - 1).ToString() + "," + MinDate.Value.Day.ToString() + ")");
    if (this.MaxDate.HasValue)
    sbOptions.Append(",maxDate: new Date(" + MaxDate.Value.Year.ToString() + "," + (MaxDate.Value.Month - 1).ToString() + "," + MaxDate.Value.Day.ToString() + ")");
    sbOptions.Append(",yearRange:' " + this.MinYear.ToString() + ":" + this.MaxYear.ToString() + "'");
    //end of options
    sbOptions.Append("}");
    // Write out initilization code for calendar
    if (this.DisplayMode != DisplayModes.Inline)
    sbStartupScript.AppendLine("var cal = jQuery('#" + this.DateControlClientId + "').datepick(" + sbOptions.ToString() + ");");
    else
    sbStartupScript.AppendLine("var cal = jQuery('#" + this.ClientID + "Div').datepick(" + sbOptions.ToString() + ");");
    sbStartupScript.AppendLine("var dp = jQuery.datepicker;");
    if (this.SelectedValue.HasValue && this.SelectedValue.Value > new DateTime(1900, 1, 1, 0, 0, 0, DateTimeKind.Utc))
    sbStartupScript.AppendLine("dp.setDateFor(cal[0],new Date('" + txtDate.Text + "'));");
    sbStartupScript.AppendLine("dp.reconfigureFor(cal[0]);");
    //******************* When dropdown changes then reflect it in calendar
    if (DisplayControl == DisplayControls.Dropdown)
    sbStartupScript.AppendLine("\r\n\r");
    sbStartupScript.Append("$('#" + ddlDay.ClientID);
    sbStartupScript.Append(",#" + ddlMonth.ClientID);
    sbStartupScript.Append(",#" + ddlYear.ClientID + "').change(function() {");
    // disable months and days when they are less then day months of minimum date
    sbStartupScript.Append("$ddlDay=$('#" + ddlDay.ClientID + "');");
    sbStartupScript.Append("$ddlMonth=$('#" + ddlMonth.ClientID + "');");
    sbStartupScript.Append("$ddlYear=$('#" + ddlYear.ClientID + "');");
    sbStartupScript.AppendLine("var minYear=" + this.MinYear.ToString() + ";");
    ///disable months of minimum year which are less then minumum date month
    sbStartupScript.AppendLine("if($ddlYear.val()<=minYear && $('#" + this.DateControlClientId + "').val!=''){ alert('true');");
    sbStartupScript.AppendLine("var minMonth=" + this.minMonth.ToString() + ";");
    sbStartupScript.AppendLine("if($ddlMonth.val()<=minMonth){");//start of if of minMonth
    sbStartupScript.AppendLine("$ddlMonth.val(minMonth);");
    sbStartupScript.AppendLine("var minDay=" + this.minDay.ToString() + ";");
    sbStartupScript.AppendLine("$ddlMonth.find('option:lt('+minMonth+')').hide();");
    sbStartupScript.AppendLine("if($ddlDay.val()<=minDay)");
    sbStartupScript.AppendLine("$ddlDay.val(minDay);");
    sbStartupScript.AppendLine("}");// end of if of minMonth
    sbStartupScript.AppendLine("else {");
    sbStartupScript.AppendLine("$ddlDay.find('option').show();");
    sbStartupScript.AppendLine("}");// end of else part of min month
    sbStartupScript.AppendLine("$ddlDay.find('option:lt('+minDay+')').hide();");
    sbStartupScript.AppendLine("}");// end of if part of min Year
    sbStartupScript.AppendLine("else {");
    sbStartupScript.AppendLine("$ddlMonth.find('option').show();");
    sbStartupScript.AppendLine("}");// end of else part of min Year
    ///set date in calendar
    sbStartupScript.AppendLine();
    sbStartupScript.Append("$('#" + this.DateControlClientId + "').datepick('setDate', new Date(\n\r\r ");
    sbStartupScript.Append("$('#" + ddlYear.ClientID + "').val(),");
    sbStartupScript.Append("$('#" + ddlMonth.ClientID + "').val()-1,");
    sbStartupScript.Append("$('#" + ddlDay.ClientID + "').val()));");
    sbStartupScript.AppendLine("} );");
    //******************* When calendar changes then reflect it in dropdown
    sbStartupScript.AppendLine("\r\n\r");
    sbStartupScript.AppendLine("function DateSelectedFromCalendar(dates) {");
    if (DisplayControl == DisplayControls.Dropdown)
    sbStartupScript.AppendLine("$('#" + ddlDay.ClientID + "').val(dates.length ? dates[0].getDate() : '');");
    sbStartupScript.AppendLine("$('#" + ddlMonth.ClientID + "').val(dates.length ? dates[0].getMonth() +1 : '');");
    sbStartupScript.AppendLine("$('#" + ddlYear.ClientID + "').val(dates.length ? dates[0].getFullYear() : '');");
    if (!string.IsNullOrEmpty(this.OnClientSelect))
    sbStartupScript.AppendLine(this.OnClientSelect + "();");
    sbStartupScript.AppendLine("}");
    //******************* Validation Script
    sbStartupScript.AppendLine("\r\n\r");
    sbStartupScript.AppendLine("$('form').validate({");
    sbStartupScript.AppendLine("errorPlacement: $.datepick.errorPlacement,");
    sbStartupScript.AppendLine("rules: {");
    sbStartupScript.AppendLine(this.DateControlClientId + ": {");//start of format picker
    sbStartupScript.AppendLine("required: true, dpDate: true}");//end of formate picker
    sbStartupScript.AppendLine("}, ");// end of rules
    sbStartupScript.AppendLine("messages: {");
    sbStartupScript.AppendLine(this.DateControlClientId + ": 'Please enter a valid date (" + this.DateTimeFormat + ")'");
    sbStartupScript.AppendLine("}");// end of messages
    sbStartupScript.AppendLine("});"); //end of validate function
    //******************* close document ready function
    sbStartupScript.AppendLine("} );");
    return sbStartupScript.ToString();
    /// <summary>
    /// Fill day month and year dropdown
    /// </summary>
    private void FillDropdowns()
    //Fill Day Dropdown
    ListItem liDay = new ListItem("Day", "0");
    ddlDay.Items.Add(liDay);
    for (int i = 1; i <= 31; i++)
    ListItem li = new ListItem(i.ToString(), i.ToString());
    ddlDay.Items.Add(li);
    //Fill Month Dropdown
    ListItem liMonth = new ListItem("Month", "0");
    ddlMonth.Items.Add(liMonth);
    string monthName = string.Empty;
    for (int i = 1; i <= 12; i++)
    switch (DisplayMonthType)
    case DisplayMonthTypes.Full:
    monthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i);
    break;
    case DisplayMonthTypes.Short:
    monthName = CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedMonthName(i);
    break;
    ListItem li = new ListItem(monthName, i.ToString());
    ddlMonth.Items.Add(li);
    //Fill Year Dropdown
    ListItem liYear = new ListItem("Year", "0");
    ddlYear.Items.Add(liYear);
    string yearDisplay = string.Empty;
    for (int i = MinYear; i <= MaxYear; i++)
    switch (DisplayYearType)
    case DisplayYearTypes.Full:
    yearDisplay = i.ToString();
    break;
    case DisplayYearTypes.Short:
    yearDisplay = i.ToString().Substring(2);
    break;
    ListItem li = new ListItem(yearDisplay, i.ToString());
    ddlYear.Items.Add(li);
    setDropDownValue(this.SelectedValue);
    private void generateDisplayMessage()
    if (this.DisplayMessageLable)
    if (this.DisplayControl == DisplayControls.TextBox)
    lblMsg.Text = this.DateTimeFormat;
    if (this.MinDate != null && this.MinDate.Value != new DateTime())
    lblMsg.Text += " From " + this.MinDate.Value.ToString(this.DateTimeFormat);
    if (this.MaxDate != null && this.MaxDate.Value != new DateTime())
    lblMsg.Text += " To " + this.MaxDate.Value.ToString(this.DateTimeFormat);
    private void setDropDownValue(DateTime? dt)
    if (ddlDay.Items.Count != 0 && ddlMonth.Items.Count != 0 && ddlYear.Items.Count != 0)
    if (dt != null && dt != new DateTime())
    ddlDay.SelectedValue = ddlDay.Items.FindByValue(dt.Value.Day.ToString()).Value;
    ddlMonth.SelectedValue = ddlMonth.Items.FindByValue(dt.Value.Month.ToString()).Value;
    ddlYear.SelectedValue = ddlYear.Items.FindByValue(dt.Value.Year.ToString()).Value;
    else
    ddlDay.SelectedValue = "0";
    ddlMonth.SelectedValue = "0";
    ddlYear.SelectedValue = "0";
    #endregion
    }Usage Of Code in .ascx<cc2:DateTimePicker ID="dtpDOB" DisplayType="Date" DisplayMode="ImageButton" ButtonImage="../Images/calendar.png" runat="server"Changing Value from .cs file dtpDOB.SelectedValue = DateTime.Parse("01/01/2001");It is not reflected in screen

    Hello,
    According to your code, it's an ASP.NET user control problem. Please post in
    ASP.NET forums where more web developers will give you help.
    Thanks for your understanding.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to allow users to run infopackage without giving access to Workbench

    Hi,
    I have certain infopackages which I want to give access to users to run. It mainly relates to loading of flat files which they want to be able to execute when they want and also loading the P&L  data from R/3.
    I am on 3.5..I don't want the users to have access to do anything else on the Admin workebench.
    what is the best way? Is there a program or tcode which I can give access to the users where they specify the infopackage name and run it.
    Thanks

    Hi,
    Create a role in transaction pfcg. Goto authorization tab-> change authorization data-> manual entry of authorization objects -> give the standard authorization object 's_rs_admwb'.
    This autho-object is for protecting DWWB objects.
    Inside this object , you will have option 'data warehouse workbench object' . Click change.. select 'infopackage'. In the activity you can give options display and execute. Save the authorization and generate profile. In the user tab, give the user ids of those who need to execute the infopackage. This should work exactly for your requirement..
    Regards,
    Krishna.

  • Useful Code of the Day:  Hideable Tree Nodes

    Someone posted about how they could selectively hide tree nodes, and I already had this AbstractTreeModel class (which does some things DefaultTreeModel does and some it doesn't) and a concrete subclass for TreeNode objects, so I was thinking how one could do hideable nodes. So I came up with this solution.
    There's 4 classes here:
    - AbstractTreeModel is the base for the concrete TreeNodeTreeModel
    - TreeNodeTreeModel extends AbstractTreeModel to support TreeNodes (DefautlMutableTreeNode, etc.)
    - HideableMutableTreeNode which is a DefautlMutableTreeNode subclass which has a visible field (with is/set methods, of course).
    - HideableTreeModel is the hideable model which is a subclass of TreeNodeTreeModel.
    A HideableMutableTreeNode can be set invisible directly, but the tree still needs to be notified to update. So it's best to use the methods in HideableTreeModel which set a node's visibility which notify the tree of changes accordingly. Methods are also provided to check a full path's visibility or ensure a node including all parent nodes are visible.
    A HideableTreeModel can take any TreeNode class, it doesn't have to be all HideableMutableTreeNodes, but only HideableMutableTreeNodes can be made invisible, of course. Any other TreeNode type would just be considered visible.
    Hiding nodes works basically by making the tree think there's less nodes then there are. And to do this, the node counts and child index search just works by looping thru the parent's children. This has potential perfomance drawbacks of course, since one has to loop thru the node's children to get nodes every time. This could be alleviated by not supporting non-hideable nodes changing the internal maintenance of HideableMutableTreeNode contents. But I'll leave that to whoever really needs it. It shouldn't be a problem if there are are a relatively small set of child nodes in any given parent.
    Also, note that the root node in the model cannot be made invisible, cuz it'd be redundant since JTree can be set to hide the root node.
    // *** HideableTreeModel ***
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.tree.*;
    * <code>HideableTreeModel</code> is an <code>TreeNodeTreeModel</code>
    * implementation for <code>HideableMutableTreeNode</code> objects.  The
    * model can also take any other <code>javax.swing.tree.TreeNode</code>
    * objects. 
    public class HideableTreeModel extends TreeNodeTreeModel {
          * Creates a new <code>HideableTreeModel</code> object.
          * @param  root  the root node
         public HideableTreeModel(TreeNode root) {
              super(root);
          * Checks if the specified node is visible.  A node can only be
          * hidden if the node is an instance of <code>HideableMutableTreeNode</code>.  <br />
          * <br />
          * Note that this only test the visibility of the specified node, not
          * whether a parent node is visible.  Use <code>isPathToNodeVisible(Object)</code>
          * to check if the full path is visible. 
          * @param  node  the node
          * @param  true if the node is visible, else false
         public boolean isNodeVisible(Object node) {
              if(node != getRoot()) {
                   if(node instanceof HideableMutableTreeNode) {
                        return ((HideableMutableTreeNode)node).isVisible();
              return true;
          * Sets the specified node to be hidden.  A node can only be made hidden
          * if the node is an instance of <code>HideableMutableTreeNode</code>.  <br />
          * <br />
          * Note that this method will notify the tree to reflect any changes to
          * node visibility.  <br />
          * <br />
          * Note that this will not alter the visibility of any nodes in the
          * specified node's path to the root node.  Use
          * <code>ensurePathToNodeVisible(Object)</code> instead to make sure the
          * full path down to that node is visible.  <br />
          * <br />
          * Note that this method will notify the tree to reflect any changes to
          * node visibility. 
          * @param  node  the node
          * @param  v     true for visible, false for hidden
          * @param  true if the node's visibility could actually change, else false
         public boolean setNodeVisible(Object node, boolean v) {
              // can't hide root
              if(node != getRoot()) {
                   if(node instanceof HideableMutableTreeNode) {
                        HideableMutableTreeNode n = (HideableMutableTreeNode)node;
                        // don't fix what ain't broke...
                        if(v != n.isVisible()) {
                             TreeNode parent = n.getParent();
                             if(v) {
                                  // need to get index after showing...
                                  n.setVisible(v);
                                  int index = getIndexOfChild(parent, n);
                                  super.nodeInserted(parent, n, index);
                             } else {
                                  // need to get index before hiding...
                                  int index = getIndexOfChild(parent, n);
                                  n.setVisible(v);
                                  super.nodeRemoved(parent, n, index);
                        return true;
              return false;
          * Checks if the specified node is visible and all nodes above it are
          * visible. 
          * @param  node  the node
          * @param  true if the path is visible, else false
         public boolean isPathToNodeVisible(Object node) {
              Object[] path = getPathToRoot(node);
              for(int i = 0; i < path.length; i++) {
                   if(!isNodeVisible(path)) {
                        return false;
              return true;
         * Sets the specified node and all nodes above it to be visible.
         * Note that this method will notify the tree to reflect any changes to
         * node visibility.
         * @param node the node
         public void ensurePathToNodeVisible(Object node) {
              Object[] path = getPathToRoot(node);
              for(int i = 0; i < path.length; i++) {
                   setNodeVisible(path[i], true);
         * Returns the child of parent at index index in the parent's child array.
         * @param parent the parent node
         * @param index the index
         * @return the child or null if no children
         public Object getChild(Object parent, int index) {
              if(parent instanceof TreeNode) {
                   TreeNode p = (TreeNode)parent;
                   for(int i = 0, j = -1; i < p.getChildCount(); i++) {
                        TreeNode pc = (TreeNode)p.getChildAt(i);
                        if(isNodeVisible(pc)) {
                             j++;
                        if(j == index) {
                             return pc;
              return null;
         * Returns the number of children of parent.
         * @param parent the parent node
         * @return the child count
         public int getChildCount(Object parent) {
              int count = 0;
              if(parent instanceof TreeNode) {
                   TreeNode p = (TreeNode)parent;
                   for(int i = 0; i < p.getChildCount(); i++) {
                        TreeNode pc = (TreeNode)p.getChildAt(i);
                        if(isNodeVisible(pc)) {
                             count++;
              return count;
         * Returns the index of child in parent.
         * @param parent the parent node
         * @param child the child node
         * @return the index of the child node in the parent
         public int getIndexOfChild(Object parent, Object child) {
              int index = -1;
              if(parent instanceof TreeNode && child instanceof TreeNode) {
                   TreeNode p = (TreeNode)parent;
                   TreeNode c = (TreeNode)child;
                   if(isNodeVisible(c)) {
                        index = 0;
                        for(int i = 0; i < p.getChildCount(); i++) {
                             TreeNode pc = (TreeNode)p.getChildAt(i);
                             if(pc.equals(c)) {
                                  return index;
                             if(isNodeVisible(pc)) {
                                  index++;
              return index;
         * Main method for testing.
         * @param args the command-line arguments
         public static void main(String[] args) {
              JFrame f = new JFrame();
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              HideableMutableTreeNode root = new HideableMutableTreeNode("root");
              root.add(new HideableMutableTreeNode("child_1"));
              final HideableMutableTreeNode c2 = new HideableMutableTreeNode("child_2");
              c2.setVisible(false);
              final HideableMutableTreeNode c2a = new HideableMutableTreeNode("child_2_A");
              c2.add(c2a);
              c2.add(new HideableMutableTreeNode("child_2_B"));
              root.add(c2);
              HideableMutableTreeNode c3 = new HideableMutableTreeNode("child_3");
              HideableMutableTreeNode cC = new HideableMutableTreeNode("child_3_C");
              cC.setVisible(false);
              c3.add(cC);
              c3.add(new HideableMutableTreeNode("child_3_D"));
              root.add(c3);
              root.add(new HideableMutableTreeNode("child_4"));
              root.add(new HideableMutableTreeNode("child_5"));
              DefaultMutableTreeNode c6 = new DefaultMutableTreeNode("child_6");
              c6.add(new DefaultMutableTreeNode("child_6_A"));
              c6.add(new DefaultMutableTreeNode("child_6_B"));
              root.add(c6);
              final HideableTreeModel model = new HideableTreeModel(root);
              JTree tree = new JTree(model);
              f.getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER);
              JButton b = new JButton("toggle");
              b.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        model.setNodeVisible(c2, !model.isNodeVisible(c2));
                        //model.ensurePathToNodeVisible(c2a);
              f.getContentPane().add(b, BorderLayout.SOUTH);
              f.pack();
              f.setSize(300, 500);
              f.show();
    // *** HideableMutableTreeNode ***
    import javax.swing.*;
    import javax.swing.tree.*;
    * <code>HideableMutableTreeNode</code> is a <code>DefaultMutableTreeNode</code>
    * implementation that works with <code>HideableTreeModel</code>.
    public class HideableMutableTreeNode extends DefaultMutableTreeNode {
         * The node is visible flag.
         public boolean visible = true;
         * Creates a tree node that has no parent and no children, but which
         * allows children.
         public HideableMutableTreeNode() {
              super();
         * Creates a tree node with no parent, no children, but which allows
         * children, and initializes it with the specified user object.
         * @param userObject - an Object provided by the user that
         * constitutes the node's data
         public HideableMutableTreeNode(Object userObject) {
              super(userObject);
         * Creates a tree node with no parent, no children, initialized with the
         * specified user object, and that allows children only if specified.
         * @param userObject - an Object provided by the user that
         * constitutes the node's data
         * @param allowsChildren - if true, the node is allowed to have child
         * nodes -- otherwise, it is always a leaf node
         public HideableMutableTreeNode(Object userObject, boolean allowsChildren) {
              super(userObject, allowsChildren);
         * Checks if the node is visible.
         * @return true if the node is visible, else false
         public boolean isVisible() {
              return this.visible;
         * Sets if the node is visible.
         * @param v true if the node is visible, else false
         public void setVisible(boolean v) {
              this.visible = v;
    // *** TreeNodeTreeModel ***
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.tree.*;
    * <code>TreeNodeTreeModel</code> is an <code>AbstractTreeModel</code>
    * implementation for <code>javax.swing.tree.TreeNode</code> objects.
    public class TreeNodeTreeModel extends AbstractTreeModel {
         * Creates a new <code>TreeNodeTreeModel</code> object.
         * @param root the root node
         public TreeNodeTreeModel(TreeNode root) {
              super();
              setRoot(root);
         * Returns the parent of the child node.
         * @param node the child node
         * @return the parent or null if root
         public Object getParent(Object node) {
              if(node != getRoot() && (node instanceof TreeNode)) {
                   return ((TreeNode)node).getParent();
              return null;
         * Returns the child of parent at index index in the parent's child array.
         * @param parent the parent node
         * @param index the index
         * @return the child or null if no children
         public Object getChild(Object parent, int index) {
              if(parent instanceof TreeNode) {
                   return ((TreeNode)parent).getChildAt(index);
              return null;
         * Returns the number of children of parent.
         * @param parent the parent node
         * @return the child count
         public int getChildCount(Object parent) {
              if(parent instanceof TreeNode) {
                   return ((TreeNode)parent).getChildCount();
              return 0;
         * Returns the index of child in parent.
         * @param parent the parent node
         * @param child the child node
         * @return the index of the child node in the parent
         public int getIndexOfChild(Object parent, Object child) {
              if(parent instanceof TreeNode && child instanceof TreeNode) {
                   return ((TreeNode)parent).getIndex((TreeNode)child);
              return -1;
         * Returns true if node is a leaf.
         * @param node the node
         * @return true if the node is a leaf
         public boolean isLeaf(Object node) {
              if(node instanceof TreeNode) {
                   return ((TreeNode)node).isLeaf();
              return true;
         * Main method for testing.
         * @param args the command-line arguments
         public static void main(String[] args) {
              JFrame f = new JFrame();
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
              root.add(new DefaultMutableTreeNode("child_1"));
              DefaultMutableTreeNode c2 = new DefaultMutableTreeNode("child_2");
              c2.add(new DefaultMutableTreeNode("child_2_A"));
              c2.add(new DefaultMutableTreeNode("child_2_B"));
              root.add(c2);
              root.add(new DefaultMutableTreeNode("child_3"));
              root.add(new DefaultMutableTreeNode("child_4"));
              JTree tree = new JTree(new TreeNodeTreeModel(root));
              f.getContentPane().add(new JScrollPane(tree));
              f.pack();
              f.setSize(300, 500);
              f.show();
    // *** AbstractTreeModel ***
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import java.text.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.tree.*;
    public abstract class AbstractTreeModel implements TreeModel {
         * The list of tree model listeners.
         private Vector modelListeners = new Vector();
         * The root object of the tree.
         private Object root = null;
         * Basic no-op constructor.
         public AbstractTreeModel() {
         * Gets the root object of the tree.
         * @return the root object
         public Object getRoot() {
              return this.root;
         * Sets the root object of the tree.
         * @param r the root object
         protected void setRoot(Object r) {
              this.root = r;
         * Gets the path to the root node for the specified object.
         * @param node the root node
         * @return the path to the object or <CODE>null</CODE>
         public Object[] getPathToRoot(Object node) {
              return getPathToRoot(node, 0);
         * Gets the path to the root node for the specified object.
         * @param node the root node
         * @param i the current index
         * @return the path to the object or <CODE>null</CODE>
         private Object[] getPathToRoot(Object node, int i) {
              Object anode[];
              if(node == null) {
                   if(i == 0) {
                        return null;
                   anode = new Object[i];
              } else {
                   i++;
                   if(node == getRoot()) {
                        anode = new Object[i];
                   } else {
                        anode = getPathToRoot(getParent(node), i);
                   anode[anode.length - i] = node;
              return anode;
         * Gets the parent object of the specified object. This method is not
         * part of the <code>javax.swing.tree.TreeModel</code> interface, but is
         * required to support the <code>getPathToRoot(Object)</code> method,
         * which is widely used in this class. Therefore, it is important to
         * correctly implement this method.
         * @param obj the object
         * @parma the parent object or null if no parent or invalid object
         protected abstract Object getParent(Object obj);
         * Adds a listener for the <CODE>TreeModelEvent</CODE> posted after the
         * tree changes.
         * @param l the tree model listener
         public void addTreeModelListener(TreeModelListener l) {
              modelListeners.addElement(l);
         * Removes a listener previously added with addTreeModelListener().
         * @param l the tree model listener
         public void removeTreeModelListener(TreeModelListener l) {
              modelListeners.removeElement(l);
         * Forces the tree to reload. This is useful when many changes occur
         * under the root node in the tree structure.
         * <b>NOTE:</b> This will cause the tree to be collapsed. To maintain
         * the expanded nodes, see the <code>getExpandedPaths(JTree)</code>
         * and <code>expandPaths(JTree, ArrayList)</code> methods.
         * @see #getExpandedPaths(JTree)
         * @see #expandPaths(JTree, ArrayList)
         public void reload() {
              reload(getRoot());
         * Forces the tree to repaint. This is useful when many changes occur
         * under a specific node in the tree structure.
         * <b>NOTE:</b> This will cause the tree to be collapsed below the
         * updated node.
         * @param node the node that changed
         public void reload(Object node) {
              if(node != null) {
                   TreePath tp = new TreePath(getPathToRoot(node));
                   fireTreeStructureChanged(new TreeModelEvent(this, tp));
         * Messaged when the user has altered the value for the item identified
         * by <CODE>path</CODE> to <CODE>newValue</CODE>.
         * @param path the path to the changed object
         * @param newValue the new value
         public void valueForPathChanged(TreePath path, Object newValue) {
              nodeChanged(path.getLastPathComponent());
         * Notifies the tree that nodes were inserted. The index is looked up
         * automatically.
         * @param node the parent node
         * @param child the inserted child node
         public void nodeInserted(Object node, Object child) {
              nodeInserted(node, child, -1);
         * Notifies the tree that nodes were inserted.
         * @param node the parent node
         * @param child the inserted child node
         * @param index the index of the child
         public void nodeInserted(Object node, Object child, int index) {
              if(index < 0) {
                   index = getIndexOfChild(node, child);
              if(node != null && child != null && index >= 0) {
                   TreePath tp = new TreePath(getPathToRoot(node));
                   int[] ai = { index };
                   Object[] ac = { child };
                   fireTreeNodesInserted(new TreeModelEvent(this, tp, ai, ac));
         * Notifies the tree that nodes were removed. The index is required
         * since by this point, the object will no longer be in the tree.
         * @param node the parent node
         * @param child the removed child node
         * @param index the index of the child
         public void nodeRemoved(Object node, Object child, int index) {
              if(node != null && child != null && index >= 0) {
                   TreePath tp = new TreePath(getPathToRoot(node));
                   int[] ai = { index };
                   Object[] ac = { child };
                   fireTreeNodesRemoved(new TreeModelEvent(this, tp, ai, ac));
         * Notifies the tree that a node was changed.
         * @param node the changed node
         public void nodeChanged(Object node) {
              if(node != null) {
                   TreePath tp = new TreePath(getPathToRoot(node));
                   fireTreeNodesChanged(new TreeModelEvent(this, tp, null, null));
         * Fires "tree nodes changed" events to all listeners.
         * @param event the tree model event
         protected void fireTreeNodesChanged(TreeModelEvent event) {
              for(int i = 0; i < modelListeners.size(); i++) {
                   ((TreeModelListener)modelListeners.elementAt(i)).treeNodesChanged(event);
         * Fires "tree nodes inserted" events to all listeners.
         * @param event the tree model event
         protected void fireTreeNodesInserted(TreeModelEvent event) {
              for(int i = 0; i < modelListeners.size(); i++) {
                   ((TreeModelListener)modelListeners.elementAt(i)).treeNodesInserted(event);
         * Fires "tree nodes removed" events to all listeners.
         * @param event the tree model event
         protected void fireTreeNodesRemoved(TreeModelEvent event) {
              for(int i = 0; i < modelListeners.size(); i++) {
                   ((TreeModelListener)modelListeners.elementAt(i)).treeNodesRemoved(event);
         * Fires "tree structure changed" events to all listeners.
         * @param event the tree model event
         protected void fireTreeStructureChanged(TreeModelEvent event) {
              for(int i = 0; i < modelListeners.size(); i++) {
                   ((TreeModelListener)modelListeners.elementAt(i)).treeStructureChanged(event);
         * Records the list of currently expanded paths in the specified tree.
         * This method is meant to be called before calling the
         * <code>reload()</code> methods to allow the tree to store the paths.
         * @param tree the tree
         * @param pathlist the list of expanded paths
         public ArrayList getExpandedPaths(JTree tree) {
              ArrayList expandedPaths = new ArrayList();
              addExpandedPaths(tree, tree.getPathForRow(0), expandedPaths);
              return expandedPaths;
         * Adds the expanded descendants of the specifed path in the specified
         * tree to the internal expanded list.
         * @param tree the tree
         * @param path the path
         * @param pathlist the list of expanded paths
         private void addExpandedPaths(JTree tree, TreePath path, ArrayList pathlist) {
              Enumeration enum = tree.getExpandedDescendants(path);
              while(enum.hasMoreElements()) {
                   TreePath tp = (TreePath)enum.nextElement();
                   pathlist.add(tp);
                   addExpandedPaths(tree, tp, pathlist);
         * Re-expands the expanded paths in the specified tree. This method is
         * meant to be called before calling the <code>reload()</code> methods
         * to allow the tree to store the paths.
         * @param tree the tree
         * @param pathlist the list of expanded paths
         public void expandPaths(JTree tree, ArrayList pathlist) {
              for(int i = 0; i < pathlist.size(); i++) {
                   tree.expandPath((TreePath)pathlist.get(i));

    Hey
    I'm not trying to show anyone up here, but having just built a tree model for displaying an XML document in a tree, I thought this seemed like a neat exercise.
    I implemented this very differently from the @OP. I only have one class, HiddenNodeTreeModel. All the hidden node data is stored in the model itself in my class. The advantage of what I've created is it will work with any TreeModel. The disadvantage is that I think it's not going to be very scalable - the additional computing to get the number of child nodes and to adjust indexes is heavy. So if you need a scalable solution definitely don't use this.
    Anyway here you go
    HiddenNodeTreeModel.java
    ======================
    package tjacobs.ui.tree;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.Collections;
    import java.util.Iterator;
    import javax.swing.JFrame;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.JTree;
    import javax.swing.event.TreeModelListener;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.TreeModel;
    import javax.swing.tree.TreePath;
    import tjacobs.ui.WindowUtilities;
    public class HiddenNodeTreeModel implements TreeModel {
         TreeModel mModel;
         ArrayList<Object> mHidden = new ArrayList<Object>();
         public HiddenNodeTreeModel (TreeModel model) {
              mModel = model;
         public void addTreeModelListener(TreeModelListener arg0) {
              mModel.addTreeModelListener(arg0);
         private ArrayList<Integer> getHiddenChildren(Object parent) {
              ArrayList<Integer> spots = new ArrayList<Integer>();
              Iterator _i = mHidden.iterator();
              while (_i.hasNext()) {
                   Object hidden = _i.next();
                   int idx = mModel.getIndexOfChild(parent, hidden);
                   if (idx != -1) {
                        spots.add(idx);
              return spots;
         public Object getChild(Object arg0, int index) {
              ArrayList<Integer> spots = getHiddenChildren(arg0);
              Collections.sort(spots);
              Iterator<Integer> _i = spots.iterator();
              while (_i.hasNext()) {
                   int num = _i.next();
                   if (num <= index) {
                        index++;
              return mModel.getChild(arg0, index);
         public int getChildCount(Object arg0) {
              ArrayList list = getHiddenChildren(arg0);
              System.out.println("size = " + list.size());
              return mModel.getChildCount(arg0) - list.size();
         public int getIndexOfChild(Object arg0, Object arg1) {
              int index = mModel.getIndexOfChild(arg0, arg1);
              ArrayList<Integer> spots = getHiddenChildren(arg0);
              Collections.sort(spots);
              Iterator<Integer> _i = spots.iterator();
              int toSub = 0;
              while (_i.hasNext()) {
                   int num = _i.next();
                   if (num <= index) {
                        toSub++;
              return index - toSub;
         public Object getRoot() {
              // TODO Auto-generated method stub
              return mModel.getRoot();
         public boolean isLeaf(Object arg0) {
              // TODO Auto-generated method stub
              return mModel.isLeaf(arg0);
         public void removeTreeModelListener(TreeModelListener arg0) {
              mModel.removeTreeModelListener(arg0);
         public void valueForPathChanged(TreePath arg0, Object arg1) {
              mModel.valueForPathChanged(arg0, arg1);
         public void hideNode(Object node) {
              if (node instanceof TreePath) {
                   node = ((TreePath)node).getLastPathComponent();
              mHidden.add(node);
         public void showNode(Object node) {
              mHidden.remove(node);
         public void showAll() {
              mHidden.clear();
          * @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              DefaultMutableTreeNode A = new DefaultMutableTreeNode("A");
              DefaultMutableTreeNode B = new DefaultMutableTreeNode("B");
              DefaultMutableTreeNode C = new DefaultMutableTreeNode("C");
              DefaultMutableTreeNode D = new DefaultMutableTreeNode("D");
              DefaultMutableTreeNode E = new DefaultMutableTreeNode("E");
              DefaultMutableTreeNode F = new DefaultMutableTreeNode("F");
              A.add(B);
              B.add(C);
              B.add(D);
              B.add(E);
              E.add(F);
              DefaultTreeModel model = new DefaultTreeModel(A);
              final HiddenNodeTreeModel hmodel = new HiddenNodeTreeModel(model);
              final JTree tree = new JTree(hmodel);
              JFrame jf = new JFrame("HiddenNodeTreeModel Test");
              jf.add(tree);
              JMenuBar bar = new JMenuBar();
              jf.setJMenuBar(bar);
              JMenu menu = new JMenu("Options");
              bar.add(menu);
              final JMenuItem hide = new JMenuItem("Hide");
              final JMenuItem show = new JMenuItem("ShowAll");
              menu.add(hide);
              menu.add(show);
              ActionListener al = new ActionListener() {
                   public void actionPerformed(ActionEvent ae) {
                        if (ae.getSource() == hide) {
                             hmodel.hideNode(tree.getSelectionPath());
                             tree.updateUI();
                        else {
                             hmodel.showAll();
                             tree.updateUI();
              hide.addActionListener(al);
              show.addActionListener(al);
              jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              jf.setBounds(100,100,100,100);
              jf.setVisible(true);
    }

Maybe you are looking for

  • ITunes store will not connect

    Hi, My iTunes store has been fine up until now with the web downloaded version. I recently bought an iPod Nano 2gb and I decided I would uninstall my current version of iTunes and install the version on the CD provided with my iPod. Since then my iTu

  • 10.1.3.4 - How to access custom java methods in worklist ?

    We want to invoke a custom java method inside of worklist, when the file attachments are added to the worklist. We are planning to modify the auto-generated jsp page to do the same. We have created the custom jar files, but am not sure where to deplo

  • How to debug a procedure in an attached library?

    Hi everybody, I am working with Developer Suite 10g on a 9iR2 database.I am 'playing' with F90UTIL pl/sql library which comes with the Forms Demos (downloaded from otn). I created a form to which I attached the F90UTIL library. On a WHEN-BUTTON-PRESS

  • How do I install my printer to an I pad

    Anyone know how to install a cannon mg3220 printer on an I pad

  • Acrobat Pro 11.0.0

    Acrobat Pro is not well installed, so it tells me I have to re-install it. I don't have the program to de-install it and in the apps store it says it' s not possible to remove... it. Anyone an idea or a link to a download the uninstaller of acrobat p