E
Elrod
Ok, here's the scenario:
I have a GUI application which uses a JTree for navigation. The nodes
on the tree have a parameter that stores a Class object, and when the
user clicks on the node, a new instance of a form represented by that
Class is instantiated. Up to this point, I have no problems.
The catch is that different users will see slightly different sets of
tree nodes, depending upon which permissions they have.
The way I was *hoping* to handle this was to declare an abstract class
like this:
public abstract UserForm extends javax.swing.JPanel
{
public abstract static long requiredRightsToView();
public abstract static long requiredRightsToEdit();
}
....and have all forms extend this class, and as such be forced to
declare their individual required access rights. I would then retrieve
those values as I build the tree to determine whether or not a
particular node should be shown. The methods (or potentially just
static constants) must be static so that I don't need to instantiate
each class to get its required rights.
I am quite open to any other methods, even if they bare no resemblance
to the train of thought I was on. Essentially, the core of what I need
is to be able to retrieve the requiredRights values from a form given
only the form's Class object and without instantiating the class.
thanks
I have a GUI application which uses a JTree for navigation. The nodes
on the tree have a parameter that stores a Class object, and when the
user clicks on the node, a new instance of a form represented by that
Class is instantiated. Up to this point, I have no problems.
The catch is that different users will see slightly different sets of
tree nodes, depending upon which permissions they have.
The way I was *hoping* to handle this was to declare an abstract class
like this:
public abstract UserForm extends javax.swing.JPanel
{
public abstract static long requiredRightsToView();
public abstract static long requiredRightsToEdit();
}
....and have all forms extend this class, and as such be forced to
declare their individual required access rights. I would then retrieve
those values as I build the tree to determine whether or not a
particular node should be shown. The methods (or potentially just
static constants) must be static so that I don't need to instantiate
each class to get its required rights.
I am quite open to any other methods, even if they bare no resemblance
to the train of thought I was on. Essentially, the core of what I need
is to be able to retrieve the requiredRights values from a form given
only the form's Class object and without instantiating the class.
thanks