cancel
Showing results for 
Search instead for 
Did you mean: 

model table + individual column

Former Member
0 Kudos

Hi Experts,

I have a table based on a model which contains two columns (material + mat-description). Now I want to put another column into this table which shall contain a certain status information. This status information has to be "calculated" via a Java method and should be a green, yellow, orange, red or grey sign.

So my question: is it possible to add a individual column to this table based on a model? If so, how can I get acces to the individual cell to fill it with my status sign?

The result should look like this:

material | description | status

01 | foo | green

02 | bar | red

any ideas on that?

Many thanks & best regards

Tobias

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Say you have a context structure like


Items (model node)
+ material (string)
+ description (string)

If you cannot add additional attributes directly under the "Items" node, add a value node first:


Items (model node)
+ material (string)
+ description (string)
+ MoreInfo (value node, c=1:1, s=1:1, singleton=false)
   + statusIcon (string)

By setting singleton=false you ensure that each element of the "Items" node has its own instance of a "MoreInfo" node.

Add an additional TableColumn to your table, use an Image as cell editor and bind the "source" property of the image to the "statusIcon" attribute.

To calculate the "statusIcon" attribute value you can extend your supply function for the "Items" node:


void supplyItems(IItemsNode node, ...)
{
  for (...)
  {
    IItemsElement item = node.createAndAddItemsElement();
    item.currentMoreInfoElement().setStatusIcon( calculateStatusIcon(item) );
  }
}

The calculateStatusIcon() method should return the file name of the icon (e.g. "red.gif") and the icon files should be stored in the predefined folder src/mimes/components/<component name>.

Another possibility would be to define the "statusIcon" as calculated attribute, but the method above is more efficient.

Armin

Former Member
0 Kudos

Hi Armin!

Thanks for your detailed solution!

In the meanwhile I changed my requirement and so I would like to implement a progress indicator since this is part of UIElements.

So I did nearly the same like described:

added a value node + attribute (integer, c 1:1, s 1:1, singleton=false) to the controller context and than this node also mapped to the view. Within the view I created a new table column in the "model table" which contains a progress indicator. This progress indicator refers with the parameter "percentValue" to the integer attribute of the value node.

To make it more clear please see my structure:

materialnrlist (model node)
+ materialstatusinfo (value node)
++ statusImage (integer value attribute)
+ material (model attribute)
+ material description (model attribute)

So after having all this done I implemented a simple value setter into my for loop over the material list just to check whether everything works. The value is set and I can get it again through a dummy message (see also the coding below) but the progress indicator doesn't show this value (it's on the default 0% value). What's wrong about my implementation so far? Has it something to do with the supplyXXX method? I never used something like that. Any tips?

This is part of my current coding:

for(int c = wdContext.nodeMatnrlist().size() - 1 ; c >= 0 ; --c){

wdContext.nodeMatnrlist().moveTo(c);

if(!getMaterialCreator(wdContext.currentMatnrlistElement().getMaterial()).equals(wdContext.currentUserDetailsElement().getUsername())){
	wdContext.nodeMatnrlist().removeElement(wdContext.nodeMatnrlist().getCurrentElement());
	} else{
		wdContext.currentMaterialStatusInfoElement().setStatusImage(30);			
		Object[] argEmptyMatResult = {new Integer(wdContext.currentMaterialStatusInfoElement().getStatusImage())};
		manager.reportMessage(IMessageBaivcontrol.EMPTY_MATERIAL_RESULT, argEmptyMatResult, false);			
		}
	  }

many thanks in advance!

Former Member
0 Kudos

forget about my question concerning the supplier function. Solved exactly by using such a function:

public void supplyMaterialStatusInfo(IPrivateBaivcontrol.IMaterialStatusInfoNode node, IPrivateBaivcontrol.IMatnrlistElement parentElement)
  {
    //@@begin supplyMaterialStatusInfo(IWDNode,IWDNodeElement)
	IPrivateBaivcontrol.IMaterialStatusInfoElement element = node.createMaterialStatusInfoElement();
	element.setStatusImage(30);
	wdContext.nodeMaterialStatusInfo().bind(element);
    //@@end
  }

Many thanks!

Answers (1)

Answers (1)

former_member197348
Active Contributor
0 Kudos

Hi Tobias,

Create a node with an attribute "status" in the model node. If you want to show the different colors for different status create one more attribute of the type SemanticTextColor and bind this attribute to the table cell editor of the status column.

Change the node properties:

Cardinality 1....1

Singleton false

Create supply function for this node.
Set the status attribute 
set the color.

Feel free to revert in case of any issues.

Regards,

Siva