Nattable Cell with Multiple combination of images - nattable

We have a requirement to visualize a state of the cell.
Each cell represents user's DB CRUD access so each cell has four boolean flags for create, read, update and delete. To visualize, each cell should show four images with each image showing state of that flag.
We defined 8 labels (CREATE, NO_CREATE, READ, NO_READ etc) and adding these labels based on underlying model. So at any time, each cell will have 4 labels. We want to show 4 images in each cell with each image showing the state of corresponding flag.
Based on the research and from Dirk's suggestion, CellDecoratorPainter is the preferred approach. But each cell with a label is associated with one cell painter (in this case CellDecoratorPainter) so how do we use that to render combination of these images?
One approach I could think of is, instead of creating individual labels for READ, NO_READ etc., create 4x4x2 labels like READ_CREATE_UPDATE_DELETE, NO_READ_CREATE_UPDATE_DELETE and associate each of these labels with one cell painter decorator to paint series of images accordingly.
Not sure if that is the only possible approach. If any of you come across this type of situation, can you please share some thoughts?
PS: This is posted at Eclipse forums at https://www.eclipse.org/forums/index.php/m/1782700/#msg_1782700

It is suggested that we use custom image painter to achieve this as explained at https://www.eclipse.org/forums/index.php/m/1782739/#msg_1782739.
Snippet of response is
You could implement a custom ImagePainter that inspects the cell
labels and draws images based on the labels in the label stack. Or
stack CellPainterDecorators so that every decorator has an image as
decoration that is only painted in case of the cell label, and has
another decorator as base painter.
But honestly, writing a custom ImagePainter that inspects the labels and draws the images on occurence of a label seems to be more
intuitive.
We implemented CombinationImagePainter to achieve this and is available at https://gist.github.com/brsanthu/cd2f91da7777aa994e011f7acedd900a if you are interested.

We had a similar requirement wherein an image was to be displayed at the start and at the end. Almost the way you showed however we extended the AbstractTextPainter class and wrote the implementation according.

Related

Different cell appearance for a single collection view

I was asking here about the option to make a collectionView with multiple cells since our cells have a different appearance for different indexs.
The answer was not sufficient because other then just create multiple cells and pick one for every index, you have all sorts of problems such as :
How can you register multiple classes ? collectionView.register(FlowViewCell.self
Reusable cells system gets crazy because they are different
Every action you do on a cell must be identified with its class and it becomes a mess.
So, I am searching for another way to do so with a single cell.
What would be a good way to set different buttons in the same position of a cell, and show/enable a different button with different indexes ?
So for index 1 I have 2 circle buttons, and for index 2 I have one large wide button? if you just put them on the same spot and hide one you get a strange design.
The answer you linked is what you are looking for.
We use 4 different types of cell in our app and we don't have any problem with it.
You don't have to register multiple classes, you can all create them in your storyboard (inside the collectionview), the system will register the classes for you.
And then you call the cells like explain in the answer.
The hard part is having different sizes, we only have two (large cell and square cell, so two square cells fit on the same level), more than that would be tricky, especially different height.
But apart from that you can have different content on each cell without any problem.

Word Styles to get two elements to share same background/border

Within MS Word 2013 I am trying to create a text element plus a list underneath it, all wrapped inside a coloured border with background shading (see image). The attached image shows the text in plain form.
I would like to place a blue border around both the title and the list. I can achieve this by placing both objects within a 1x1 table and applying colouring rules to the cell, but semantically this seems bad (I'm from an HTML development background where it is very wrong!)
When I edit a Style rule to create the border/background, it works well until I create the list, then it goes badly wrong. Is it possible to achieve the output of the table cell approach by only using a style rule and no table?
After a day of experimentation, the closest I can get is by doing the following:
Create a style rule called Tips Heading based on Normal, then set it to be Bold with a blue background.
Create another style rule called Tips List based on List Paragraph, and set it to have a blue background.
Unfortunately the List cannot be indented because the background colour also indents. The border is also affected in this manner, so I ignored the border and indentation. It works really well and is semantically well structured.

Can you create a CellTable composed of CellTables?

This is a GWT question.
I need to create a hierarchical view of a data set. Let me describe what this hierarchical view is supposed to be:
Lay down a rectangle that is 640 by 480 pixels on your screen.
Now embed 4 rectangles inside the rectangle from the previous step.
The 4 rectangles shall evenly take up the space from the enclosing rectangle.
Continue recursively embedding 4 rectangles inside each 4 rectangle...
So on and so forth until a stop condition (like stop recursing at level N).
I plan on doing this with GWT's CellTable. I know how to make a CellTable out of the various out-of-the-box Cell's (what I mean to say is: all the classes that implement the Cell interface ).
But I can't figure out how to make a CellTable of Widgets... or a CellTable of CellTables. I guess my question boils down to... How would you make a new Cell type that is: WidgetCell or CellTableCell?
UPDATE:
I found an answer that describes how to make a Cell out of a Widget: how-can-i-put-a-widget-in-a-celltable-cell
Given the above answer, is my original idea of making a CellTable out of CellTables practically feasible? Is there a more elegant solution? Am I on the right-track?
CellTables do not support widgets. Grid or FlexTable might work better for you, since they do accept widgets - you could make a Grid of CellTables, for instance. Unfortunately, there is no built-in solution that accepts widgets and provides paging.

manual layout of a custom UITableViewCell for this approach?

Background - I have a custom UITableViewCell layout. Each cell will have a number of UILabels with a variable number of rows of UILabels. For the sake of argument conside 3 columns of UILabels (different widths), and a variable number of rows depending on the data.
To best allow for content view size changes (e.g. edit mode, change in orientation etc) I was going to manually layout each of the UILabels in the cell in the "layoutSubviews" method, effectively setting up their exact positions. I thought this way they will be laid out appropriately for events such as EDIT mode, orientation change etc.
Question - I'm wondering whether from a performance point this is the best approach? Or should I be looking at somehow predefine the UILabel rows, one predefined set for portrait mode and another set for landscape mode? (not exactly sure of how this would be done, but I'm trying to describe an approach where the layout would not have to be re-calculated when orientation changes etc)
thanks
suggestion by RickMaddy elsewhere was good:
"Why have a variable number of rows of labels in a single table row? Have one row of labels per table row. Then the problem is easier and performance won't be an issue."

Multiple UILabel(s) repositioning according to wordwrap

I have this interface with multiple UILabels.
On view loading i populate white labelled values with some data from a db.
The problem is, some of that fields are potentially too long for the interface, so i'd like to compute the total height of one label once the text is word wrapped and reposition the 2 labels below (shifting the Y coordinate) accordingly to the previous label's height.
All of this should go inside a UIScrollView to let the user scroll those labels vertically.
Any chance i can do this easily with some control i still don't know, or do i have to do it manually?
Thanks
You'll need to use the NSString UIKit Additions to compute the height you need to set on your UILabel, and then adjust the other controls appropriately.
Specifically, I think you want to use sizeWithFont:forWidth:lineBreakMode: to get the rect for your UILabel.
Alternatively, you could use a UIWebView and display the information as HTML. I don't know if it's necessarily less work, but you'll get a layout that automatically adjusts to the size of its contents.