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

Power User

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

Hi,

is it possible to format combobox items' text like smart labels?

Joachim
CaptainCasa

Power User
[Avatar]

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

...you can use "<html>whatever text</html>"...

Regards, Björn

Björn Müller, CaptainCasa GmbH
unger

Power User

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

Hi Björn,

does it work in ROWDYNAMICCONTENT with <t:gridcol text='<html>whatever</html>'>...?

Regards,

Joachim
CaptainCasa

Power User
[Avatar]

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

...should work, too.
We more and more "find out" that simple HTML is consistently supported everywhere where text is defined.
If we had known this before, then maybe we would not have created the SMARTLABEL component at all...

Björn

Björn Müller, CaptainCasa GmbH
unger

Power User

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

Hi Björn,

it's a nice feature of Swing, I used years ago.

May be we have a problem using it in rowdynamiccontent.

Must a special encode be used?

Regards,

Joachim

Example:
<t:fixgrid objectbinding='#{d.CombSpreadsheetMBean.combSpreadsheet4ComponentQty}' width='100%' height='100%' sbvisibleamount='100'>
<t:gridcol text='<html>Si2O3</html>' width='75'>
<t:pane width='100%'>
<t:row rendered='#{d.CombSpreadsheetMBean.weightShowing}'>
<t:label text='.{quantityMap.Si2O3[0]}'/>
</t:row>
<t:row rendered='#{d.CombSpreadsheetMBean.molShowing}'>
<t:label text='.{quantityMap.Si2O3[1]}'/>
</t:row>
</t:pane>
</t:gridcol>
<t:gridcol text='<html>SiO_2</html>' width='75'>
<t:pane width='100%'>
<t:row rendered='#{d.CombSpreadsheetMBean.weightShowing}'>
<t:label text='.{quantityMap.SiO_2[0]}'/>
</t:row>
<t:row rendered='#{d.CombSpreadsheetMBean.molShowing}'>
<t:label text='.{quantityMap.SiO_2[1]}'/>
</t:row>
</t:pane>
</t:gridcol>
<t:gridcol text='<html>ZrO2</html>' width='75'>
<t:pane width='100%'>
<t:row rendered='#{d.CombSpreadsheetMBean.weightShowing}'>
<t:label text='.{quantityMap.ZrO2[0]}'/>
</t:row>
<t:row rendered='#{d.CombSpreadsheetMBean.molShowing}'>
<t:label text='.{quantityMap.ZrO2[1]}'/>
</t:row>
</t:pane>
</t:gridcol></t:fixgrid>
CaptainCasa

Power User
[Avatar]

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

???
I just tested in our example - no problems.

Regards, Björn

Code:
 ...
             PANENode pane = new PANENode();
             pane.setRowdistance("5");
             {
                 ROWNode row = new ROWNode();
                 pane.addSubNode(row);
                 {
                     LABELNode label = new LABELNode();
                     row.addSubNode(label);
                     label.setText("<html><b><font color='#800000'>First</font></b> Name</html>");
                     label.setWidth("120");
                     FIELDNode field = new FIELDNode();
                     row.addSubNode(field);
                     field.setText("#{wp.DemoRowDynamicContent.firstName}");
                     field.setWidth("120");
                 }
             }
 ...
 

Björn Müller, CaptainCasa GmbH
unger

Power User

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

Hi,

here is a test case. Would You check this?

When I use plain text. It worked.
Changing to HTML variant: EC does not show any grid, any log info.

Regards,

Joachim
 Filename Test2MBean.java [Disk] Download
 Description Another Bean with HTML
 Filesize 2 Kbytes
 Downloaded:  355 time(s)

 Filename TestMBean.java [Disk] Download
 Description MBean
 Filesize 2 Kbytes
 Downloaded:  395 time(s)

 Filename test.jsp [Disk] Download
 Description Layout
 Filesize 632 bytes
 Downloaded:  393 time(s)

unger

Power User

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

Hello again,

Tick, tick, tick and: It works, when using <TAG>Node - model instead of Strings!

But why?


Code:
 public void prepare() {
   FIXGRIDNode fgn = new FIXGRIDNode();
   fgn.setObjectbinding("#{d.Test.grid}");
   fgn.setWidth("100%");
   fgn.setHeight("100%");
   fgn.setSbvisibleamount("100");
   
   GRIDCOLNode gcn = new GRIDCOLNode();
   gcn.setText("<html><b>CO</b>LUMN</html>");
   gcn.setWidth("75");
 
   PANENode pn = new PANENode();
   pn.setWidth("100%");
 
   ROWNode rn = new ROWNode();
 
   LABELNode ln = new LABELNode();
   ln.setText("TEXT");
 
   fgn.addSubNode(gcn);
   gcn.addSubNode(pn);
   pn.addSubNode(rn);
   rn.addSubNode(ln);
 
   gridXML.setContentNode(fgn);
 
 // ===BAD ===
 // String xml = "<t:fixgrid objectbinding='#{d.Test.grid}' " //
 //  + " width='100%' height='100%' sbvisibleamount='100'>" // 
 //  + "<t:gridcol text='COLUMN' width='75'>" //
 //  + "<t:pane width='100%'>" //
 //  + "<t:row>" // 
 //  + "<t:label text='<html><b>T</b>EST</HTML>'/>" //
 //				+ "</t:row>" //
 //				+ "</t:pane>" //
 //				+ "</t:gridcol>" //
 //				+ "</t:fixgrid>";
 //  gridXML.setContentXML(xml);
   
 }
CaptainCasa

Power User
[Avatar]

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

Hi,

well it also works with plain Strings, but you have to build proper XML:

And...:
Code:
 <aaa  bbb="<html>...</html>"/>
 

...is not proper XML! You have to convert "<", ">", "'", etc.

This is done automatically when using ComponentNode-instances.

Regards, Björn

Björn Müller, CaptainCasa GmbH
unger

Power User

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

I did it ...
private static final String HTMLStart = "<HTML>";
private static final String HTMLEnd = "</HTML>";

but forgot a few items.

Through Your advice I checked my code.

Thank You!

BTW: is ... ln1.setRendered("#{d.CombSpreadsheetMBean.weightShowing}'"); .. allowed?




Code:
private void buildGrid4CompQtyN() {
 		FIXGRIDNode fgn = new FIXGRIDNode();
 		fgn.setObjectbinding("#{d.CombSpreadsheetMBean.combSpreadsheet4ComponentQty}");
 		fgn.setWidth("100%");
 		fgn.setHeight("100%");
 		fgn.setSbvisibleamount("100");
 
 		int size = columnTitleList4ComponentQty.size();
 		if (size > 0) {
 			for (int i = 0; i < size; i++) {
 				String column = columnTitleList4ComponentQty.get(i);
 				String display = columnTitleDisplayList4ComponentQty.get(i);
 				String key = DataHolderExt.keyEncode(column);
 
 				GRIDCOLNode gcn = new GRIDCOLNode();
 				gcn.setText(HTMLStart + display + HTMLEnd);
 				gcn.setWidth("" + widthCompQty);
 
 				PANENode pn = new PANENode();
 				pn.setWidth("100%");
 
 				ROWNode rn1 = new ROWNode();
 				rn1.setRendered("#{d.CombSpreadsheetMBean.weightShowing}'");
 
 				LABELNode ln1 = new LABELNode();
 				ln1.setText(".{quantityMap." + key + "[0]}");
 				ln1.setRendered("#{d.CombSpreadsheetMBean.weightShowing}'");
 
 				rn1.addSubNode(ln1);
 
 				ROWNode rn2 = new ROWNode();
 				rn2.setRendered("#{d.CombSpreadsheetMBean.molShowing}'");
 
 				LABELNode ln2 = new LABELNode();
 				ln2.setText(".{quantityMap." + key + "[1]}");
 				ln2.setRendered("#{d.CombSpreadsheetMBean.molShowing}'");
 
 				rn2.addSubNode(ln2);
 
 				pn.addSubNode(rn1);
 				pn.addSubNode(rn2);
 
 				gcn.addSubNode(pn);
 
 				fgn.addSubNode(gcn);
 			}
 		}
 
 		gridXML4CompQty.setContentNode(fgn);
 	}
CaptainCasa

Power User
[Avatar]

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

ln1.setRendered("#{d.CombSpreadsheetMBean.weightShowing}'");

Why a " ' " at the end? Without this - perfect!

Björn

Björn Müller, CaptainCasa GmbH
unger

Power User

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

Ah! I slap myself.

I was a little bit to fast.

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