Add simple table with text to screen - blackberry

How do I add a simple plain table with data to existing screen?
The data is already parsed text from DOM. Can I do it with TableModel? Here's what I have now:
TableModel tm = new TableModel();
tm.addRow(doc.getElementsByTagName("id").item(0).getChildNodes().item(0).getNodeValue());
tm.addRow(doc.getElementsByTagName("id").item(1).getChildNodes().item(0).getNodeValue());
final MyScreen screen = new MyScreen();
Can I use something like:
screen.add(...)
Or it should I use something other than the TableModel container?

TableModel is merely a data model. To display the data, you'll need to use a Field that uses the data contained in the TableModel. I'd suggest making a custom field that accepts this TableModel object. You could also use a GridFieldManager and add LabelFields to it for each cell of the TableModel object.

Related

ASP.NET MVC Razor Chart within View rendered with Model

This seems like something so easy, and i am sure it is, but i cant figure out how to do it.
On my view i want a table and a chart, both sourced from the model.
The only options i have found is to create the chart inline (which then is the only thing displayed), use inside an img, or an Action or trying to write the bytes direct as a stream, all of which doesn't seem to support passing a model object.
How can i insert a chart in a view using the views model object so it coexists, either coding directly into the View or via some other method?
I discovered a way to do it from the view using
System.Web.UI.DataVisualization.Charting.Chart chart;
/* populate chart from Model here */
HtmlTextWriter writer = new HtmlTextWriter(Html.ViewContext.Writer);
chart.RenderControl(writer);

How to create pass with custom design?

Have a pass with Store Card style. How can I add 2nd row with data and change the label position (label should be below the value)? When I add second item in secondaryFields array it inserts the item in the 2nd column, the same row. Thanks.
Image as example:
If you have a look here "Pass Style Sets the Overall Visual Appearance":
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/PassKit_PG/Chapters/Creating.html#//apple_ref/doc/uid/TP40012195-CH4-SW45
It gives an overview of what fields are allowed on the different pass types.
To achieve what you describe you want to make the pass a generic pass and specify both secondary and auxiliary fields.
To switch the label to be below the data, you need to flip the values when specifying them, so set label ="Gold" and the value="Level". However it will still have the same formatting (the top one will still be smaller text)

Blackberry list field without canvas

Is it possible to create a customized list field in BB, where each row will have 4 different labels, and a bitmap field, without implementing the drawListRow method?
Since drawListRow uses canvas I want to avoid it. Because, I need to display a browser field in list row. Or is it possible to add label fields in list row?
You probably aren't going to be able to implement this the way you want - try putting more than one BrowserField on a screen at once and you'll soon run into multiple issues. I'd suggest creating a custom Field to act as a row instead, or try and get the desired look n feel using Field Managers.

dynamically set smart gwt list grid header

I have created a smartgwt list grid. The grid headers are static and the content is filled with server side data.
The code looks something like this
ListGrid grid = new ListGrid();
grid.setFields();//set columns names..
grid.setData();//pass datasource..
On page load, it first initialize the grid object, set field names (columns) and when the server side data is available, it populates the grid.
This approach is fine when the columns/headers are static. However, I am trying to modifying the grid so that headers are set dynamically. To be more specific, server data will include information about grid header (number of columns of the grid, column names etc). One way to do this, put the header information in a grid content cell and design that cell to look like header.
I want to know if there is any better approach to do this ?
did you see this:
http://www.smartclient.com/smartgwt/showcase/#grid_top_header

Add dynamically an FormItem to a DynamicForm with SmartGWT

I would like to add a FormItem to a DynamicForm in a SmartGWT form, but all I can find is the setItems method, which adds all FormItem of the form, so it can only be used to initialize the form. Am I missing something?
My form contains a TextItem, and each time the user enters a new string and validate, a new CheckButton is added.
Best approach depends on what you want to do:
Dynamically shown item? Add it to the form at initialization, but hidden, then show() it later
repeating form, like the built-in FilterBuilder component? Just add a series of DynamicForms to a Layout, consider tying them together with a ValuesManager
something else? Consider either #2 above, or, setItems() can be used as a means of providing just one new item to the form, just provide a new Array of FormItems including the items you already have. The form will automatically preserve the item's current values.

Resources