[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Set grids cell content non editable  XML
Forum Index -> Development
Author Message
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 744
Offline

Hi,

I try to make the cells of my dynamic grid non editable, but I didn't get this done.

This is my coding:
protected ROWComponent m_rowComponent = new ROWComponent();
public ROWComponent getRowComponent() { return m_rowComponent; }
public void setRowComponent(ROWComponent rowComponent)
{
if (m_rowComponent == rowComponent) return;
m_rowComponent = rowComponent;
// create fix grid
FIXGRIDComponentTag fgTag = new FIXGRIDComponentTag();
fgTag.setObjectbinding("#{d.ListUI.gridList}"); //$NON-NLS-1$
fgTag.setSbvisibleamount("25"); //$NON-NLS-1$
fgTag.setHeight("100%"); //$NON-NLS-1$
fgTag.setWidth("100%"); //$NON-NLS-1$
fgTag.setAvoidroundtrips("true"); //$NON-NLS-1$
BaseComponent fg = fgTag.createBaseComponent();
m_rowComponent.getChildren().add(fg);
// create columns


for (SGridMetaData meta : columns) {

GRIDCOLComponentTag gcTag = new GRIDCOLComponentTag();
gcTag.setText(meta.header);
gcTag.setWidth("100"); //$NON-NLS-1$
gcTag.setSortreference(".{data."+ meta.techname +"}");
gcTag.setSearchenabled("true"); //$NON-NLS-1$
BaseComponent gc = gcTag.createBaseComponent();
fg.getChildren().add(gc);

if (meta.type==SGridMetaData.CHECKBOX) {
CHECKBOXComponentTag cbtag = new CHECKBOXComponentTag();
cbtag.setSelected(".{data."+ meta.techname +"}"); //$NON-NLS-1$ //$NON-NLS-2$
cbtag.setAlign("center"); //$NON-NLS-1$
cbtag.setEditable("false");
BaseComponent cb = cbtag.createBaseComponent();
gc.getChildren().add(cb);
} else {
FIELDComponentTag fiTag = new FIELDComponentTag();
fiTag.setText(".{data." + meta.techname + "}"); //$NON-NLS-1$ //$NON-NLS-2$
fiTag.setEditable("false");
BaseComponent fi = fiTag.createBaseComponent();
gc.getChildren().add(fi);
}
}
}

I also set override the onRowSelect of the FixGridItem:
public class GridListItem extends FIXGRIDItem implements java.io.Serializable
{

public GridListItem(UserData data) {
this.data = data;
}

public UserData data;

public UserData getData() {
return data;
}

@Override
public void onRowSelect() {
}
@Override
public void onRowExecute() {
}

}

regards
Markus
[WWW]
CaptainCasa

Power User
[Avatar]

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

Please use setEnabled("false"), not setEditable("false").

Two remarks:

(1) the BaseComponentTag is the melting point of all attributes of all components. So you need to take care a bit which attribute to dynamically set... In the layout editor there is a menu item "documentation" (in the project's menu) which you can use as reference.

(2) You can do the dynamic building the way you do it: directly going into the JSF component tree. This is correct, but it typically is much simpler to use ROWDYNAMICCONTENT. THere you can assemble the dynamic part as XML string, which is tpyically much simpler.

Regards! Björn

Björn Müller, CaptainCasa GmbH
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 744
Offline

Thanx for your hints, but the column is still editable?!
I'll change my architecture to ROWDYNAMICCONTENT, maybe then my problems are gone ;-)

Markus
[WWW]
CaptainCasa

Power User
[Avatar]

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

...I cannot believe this

fiTag.setEnabled("false") will switch off the editing of the field... - I am 100% confident about this. Please triple-check. Restart your Tomcat, your PC, unplug it from the power supply, reinstall the OS. I must be right...

Björn

Björn Müller, CaptainCasa GmbH
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 744
Offline

I can't believe it too ;-)

I think I have an error in my project, because I still can't see my managed beans in the Dev. Tool. ( http://www.casabacdemo.com/forum/posts/list/524.page

I develop on two environements, so I think its not a OS or Capt.Casa Install. problem, I use the latest version from 20090323.

I added the property DrawOddEvenrows to the FixGrid, this property didn't work too?

Markus
[WWW]
CaptainCasa

Power User
[Avatar]

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

...no this works, as well (drawing of even and odd rows)

I am occupied this morning. in the later afternoon (>3pm) we could do some screen sharing session. Please directly contact me.

Björn

Of course I meant "reinstalling th OS" as joke... - always hoping that we are not the guilty ones at the end... ;-)

Björn Müller, CaptainCasa GmbH
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team