[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Embedded Datasets in Beans  XML
Forum Index -> Development
Author Message
unger

Power User

Joined: 22/07/2008 05:19:28
Messages: 261
Offline

Hello Björn,

as I found Your bean server navigator (right side tree iew) looks for fields, not for getter methods .

But as java has no double inheritance I need embedded classes like "data" below.

The fields of data I would like to publicsh as getters in the DarstellerGridItem.

public class DarstellerGridItem
extends FIXGRIDItem
implements java.io.Serializable {

public DarstellerData data; // <= need to inherit form PFobjec

... getters ...
}

I didn't find a member in the bean view.

What's wrong,

Joachim
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5521
Offline

Hi,

what you say, is not 100% correct: the bean browser "in the editor, on the right" follows the set/get-methods - it does NOT follow the members/fields!

Embed your data class in the FIXGRIDItem, as member:

Code:
 public class GridItem extends FIXGRIDItem
 {
     private Darsteller m_darsteller;
     public Dartsteller getDarsteller() { return m_darsteller; }
 }
 


The data access within the grid item is ".{darsteller.name}". The bean browser will show the Darsteller-class within the grid item.

Björn

Björn Müller, CaptainCasa GmbH
unger

Power User

Joined: 22/07/2008 05:19:28
Messages: 261
Offline

Hello Björn,

I didn't find a solution.

Here is my dataset:

Code:
 package de.common.database;
 
 import org.eclnt.jsfserver.elements.impl.FIXGRIDItem;
 
 import de.degeto.common.data.DarstellerData;
 
 public class DarstellerGridItem extends FIXGRIDItem implements java.io.Serializable {
 	public DarstellerData data;
 	
 	public DarstellerData getData () {return data;	}
 
 	public String getDarsteller () { return data.darsteller;	}
 
 	public String getRolle_figur () {return data.rolle_figur;	}
 
 };
 
 


Rhe bean:

Code:
 package de.degeto.managedbeans.ui;
 
 import java.util.HashMap;
 
 import javax.faces.event.ActionEvent;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.eclnt.jsfserver.elements.impl.FIXGRIDListBinding;
 
 import de.common.database.DBZugriff;
 import de.common.database.DarstellerGridItem;
 
 public class Beispiel {
 	Dispatcher m_dispatcher;
 	String m_contentPage = "beispiel.jsp";
 	private Log log = LogFactory.getLog ("ALL");
 
 	public Beispiel (Dispatcher dispatcher) {
 		m_dispatcher = dispatcher;
 	}
 
 	public String getContentPage () {
 		return m_contentPage;
 	}
 
 	public void switchToPage (String nextContentPage) {
 		m_contentPage = nextContentPage;
 	}
 
 	protected FIXGRIDListBinding<DarstellerGridItem> m_grid = new FIXGRIDListBinding<DarstellerGridItem> ();
 
 	public FIXGRIDListBinding<DarstellerGridItem> getGrid () {
 		return m_grid;
 	}
 
 	public void setGrid (FIXGRIDListBinding<DarstellerGridItem> value) {
 		m_grid = value;
 	}
 
 	public void onFuellen (ActionEvent event) {
 		DBZugriff db = new DBZugriff ();
 		db.fuelleDarsteller (m_grid);
 	}
 
 }
 


The dataset class isn't embedded (inner class). Is this a problem?

Regards,

Joachim
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5521
Offline

In the bean browser:

(1) refresh the view (refresh Icon on the top right)
(2) open your class, open the gird, open the folder "Grid Items" and you (should) see the structure of the item bean

If not: pls. send a screen shot.

Björn

Björn Müller, CaptainCasa GmbH
unger

Power User

Joined: 22/07/2008 05:19:28
Messages: 261
Offline

Hi Björn,



Joachim
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5521
Offline

OK. Could you check the following:

The bean browser tool introspects the class DarstellerData. It seems that this introspection does not work. The introspection bases on the following:

(1) It assumes alle classes/libs to be available in WEB-INF/lib and WEB-INF/classes within the project directory.
(2) It creates a class instance of DarstellerData ("Class.forName()"). In case you have complex operations in the static construction phase, these may fail during introspection.

I.e. do you have things like...
Code:
 static
 {
 }
 
 or similar: complex constructions within the inctanciation of members:
 
 private Connection m_connection = XYZ.createConnection();
 

...these things are executed during introspection as well.

Björn

Björn Müller, CaptainCasa GmbH
unger

Power User

Joined: 22/07/2008 05:19:28
Messages: 261
Offline

Hi Björn,

I removed the PostgreSQL extension:

Code:
 public class DarstellerData
 // extends org.postgresql.util.PGobject 
 {
 


Now it's more to do, typing all the arrays and types ins SQL
But it EC works again.

Joachim

CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5521
Offline

Hi,

just to make sure: we are only talking about a design time issue here! - This introspection is done by the bean browser - in order to show the user at runtime all beans + simplify the input of expressions ("#{...}").

Of course you can do "what you want" in your bean - and it will perfectly work at runtime. You just do not see things in the design time, and have to input expressions manually.

Björn

PS: in your concrete case I guess that the PGobject's jar-file is not included in WEB-INF/lib within your project directory... (?)

Björn Müller, CaptainCasa GmbH
unger

Power User

Joined: 22/07/2008 05:19:28
Messages: 261
Offline

Hi Björn,

the Postgres JDBC JAR (including extension) is not inside WEB-INF.

That is the problem.

Thank You!

Joachim
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team