Bob,
>I don't think you're helping yourself or anybody else
here with your
>variable naming, c, p, pp??? Use descriptive variable
names.
I have re-used existing ArgoUML classes to develop my
classes, so that's the reason why some variables are
naming c, p, pp. All the methods that I have used
looks the same at ArgoUML's classes that I have used.
I didn't change them.
* TabDepthsProps is the same as TabProps (all methods
and variables are the same). It has the same
getPanels(Class c), addPanel(Class c, PropPanel),
Hashtable<Class, TabModelTarget> panels...
It is added from my module to the DetailsPane as
follows:
tab=new TabDepthsProps();
((DetailsPane)
ProjectBrowser.getInstance().getDetailsPane()).addTab(tab,
true);
The only difference between TabDepthsProps and
org.argouml.uml.ui.TabProps is the class name and the
way I instantiate panel from method
createPropPanel(Object modelElement). Here I want only
to have the panel that describes the model, so I have
make it as follows:
private TabModelTarget createPropPanel(Object
modelElement) {
if (Model.getFacade().isAModel(modelElement)) {
propPanel = new DepthsPropPanelModel();
}
*class DepthsPropPanelModel extends
DepthsPropPanelPackage
*class DepthsPropPanelPackage extends PropPanel
Those two classes corresponds to the
org.argouml.uml.ui.model_management.PropPanelModel and
PropPanelPackage classes but has different GUI, i.e.
it provides few text areas for user input.
The only think that I did not reused from ArgoUML is
the method that try to access those fields:
public void setProjectValues(){
Collection root=Model.getFacade().getRootElements();
String projectN=null;
if (!root.isEmpty()) {
Iterator it = root.iterator();
Object child=null;
while (it.hasNext()) {
child = it.next();
projectN=Model.getFacade().getName(child);
}
setProjectName(projectN);
//some other class should be added here as
an arguement of getTab()
TabDepthsProps
solutionTab=(TabDepthsProps)((DetailsPane)
ProjectBrowser.getInstance().getDetailsPane()).getTab(TabDepthsProps.class);
if (Model.getFacade().isAModel(child)){
LOG.info(" isAModel");
DepthsPropPanelModel
dppm=(DepthsPropPanelModel)
solutionTab.getPanel(DepthsPropPanelModel.class);
if (dppm==null){
LOG.info("dppm is null");
}
String desc=dppm.getDescription();
}
The first part of code in this method access the model
name and the second one that should access the Panel
does not find this panel, because it does not find it
in Hashtable panels as TabDepthsProps. Rather it adds
my class TabDepthsPros with Model$Impl as the key
when calls method panels.put() which is called from
findPanelFor(Object trgt). This happens when I selects
"untitledModel" from navigation tree.
I hope that my explanation is not confusing now
Zoran
--- Bob Tarling <[EMAIL PROTECTED]> wrote:
> So you have some panels map (where is that defined)
> that is keyed by Class
>
> You put the Model class in there but when trying to
> get an item out
> your looking DepthsPropPanelModel
>
> So it doesn't find it and you get null.
>
> I don't think you're helping yourself or anybody
> else here with your
> variable naming, c, p, pp??? Use descriptive
> variable names.
>
> Bob.
>
>
> 2008/4/24 Zoran Jeremic <[EMAIL PROTECTED]>:
> > Hi,
> > I'm still trying to resolve this error.
> >
> >
> > >Obviously the panels instance doesn't contain the
> value your looking
> > >for so returns null.
> >
> > I found that panels does not have an instance
> with key called
> > DepthsPropPanelModel, but rather Model$Impl. I
> don't know how to access it
> > in solution solutionTab.getPanel?
> >
> > ...
> >
> > TabDepthsProps
> solutionTab=(TabDepthsProps)((DetailsPane)
> >
>
ProjectBrowser.getInstance().getDetailsPane()).getTab(TabDepthsProps.class);
> >
> > if
> (Model.getFacade().isAModel(child)){
> > DepthsPropPanelModel
> dppm=(DepthsPropPanelModel)
> > solutionTab.getPanel(DepthsPropPanelModel.class);
> >
> >
> > My panel is instatiated by:
> >
> > private TabModelTarget createPropPanel(Object
> modelElement) {
> > ...
> > } else if
> (Model.getFacade().isAModel(modelElement)) {
> > propPanel = new
> DepthsPropPanelModel();
> >
> > ...
> > return propPanel;
> > }
> >
> >
> > This method is called by:
> >
> > private TabModelTarget findPanelFor(Object
> trgt) {
> > ...
> > p = createPropPanel(trgt);
> > if (p != null) {
> > LOG.debug("Factory created " +
> p.getClass().getName()
> > + " for " +
> trgt.getClass().getName());
> > panels.put(trgt.getClass(), p);
> > if (p instanceof PropPanel) {
> > ((PropPanel) p).buildToolbar();
> > }
> > return p;
> > }
> > Console output:
> >
> > Factory created
> depths.uml.ui.model_management.DepthsPropPanelModel
> > for org.omg.uml.modelmanagement.Model$Impl
> >
> >
> >
> >
> >
> > Bob Tarling <[EMAIL PROTECTED]> wrote:
> > Obviously the panels instance doesn't contain the
> value your looking
> > for so returns null.
> >
> > Use the debugger again to see what's there.
> >
> > Unrelated but your code breaks the encapsulation
> of the model
> > implementation.
> >
> > org.omg.uml.modelmanagement.Model child=null;
> > while (it.hasNext()) {
> > child = (org.omg.uml.modelmanagement.Model)
> it.next();
> > projectN=Model.getFacade().getName(child);
> > }
> >
> > to this
> >
> > Object child=null;
> > while (it.hasNext()) {
> > child = it.next();
> > projectN=Model.getFacade().getName(child);
> > }
> >
> > This will set projectN to the name of the last
> root element.
> >
> > You may prefer to use Java 5 style for loops
> rather than a while loop.
> >
> > Bob.
> >
> >
> >
> > 2008/4/23 Zoran Jeremic :
> >
> > > Tom,
> > >
> > > Sorry, I didn't see the remaining of your
> previous email. I have tried
> > with
> > > the debugger to locate the problem.
> > >
> > > The problem is in method getPanel in class
> TabDepthsProps, which accepts
> > > DepthsPropPanelModel as c and pp cannot be
> resolved as debugger shows.
> > >
> > > public TabModelTarget getPanel(Class c){
> > > TabModelTarget pp=panels.get(c);
> > > return pp;
> > > }
> > >
> > > I hope you can get some idea from this.
> > >
> > > Zoran
> > >
> > >
> > >
> >
> > > Zoran Jeremic wrote:
> > >
> > > Hi,
> > >
> > > What I want here is to get some information
> about
> > > software solution presented with tab that I have
> > > created. The same panel DepthsPropPanelModel is
> used
> > > in the case of each type of UML diagrams, as
> well as
> > > for a model itself. I want to pick information
> > > presented in UMLTextArea2 fields for a model
> from
> > > DepthsPropPanelPackage which is extended by
> > > DepthsPropPanelModel, as well as model name (the
> > > second one I have just resolved).
> > > Here is what have I done so far:
> > >
> > > setProjectValues(){
> > > Collection
> root=Model.getFacade().getRootElements();
> > > String projectN=null;
> > > if (!root.isEmpty()) {
> > > Iterator it = root.iterator();
> > > org.omg.uml.modelmanagement.Model
> > > child=null;
> > > while (it.hasNext()) {
> > > child = (org.omg.uml.modelmanagement.Model)
> > > it.next();
> > > projectN=Model.getFacade().getName(child);
> > >
> > > }
> > > setProjectName(projectN);
> > > TabDepthsProps
> > > solutionTab=(TabDepthsProps)((DetailsPane)
> > >
> >
>
ProjectBrowser.getInstance().getDetailsPane()).getTab(TabDepthsProps.class);
> > > LOG.info(" solutionTab test
> > > "+solutionTab.getTest());
> > > if (Model.getFacade().isAModel(child)){
> > > DepthsPropPanelModel
> > > dppModel=(DepthsPropPanelModel)
> > >
> solutionTab.getPanel(DepthsPropPanelModel.class);
> > > if (dppModel==null){
> > > LOG.info("tmt is null");
> > > }
> > > String desc=dppModel.getDescription();
> > > }
>
=== message truncated ===
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]