TextCell and TextInputCell in GWT CellTable Header - gwt

I need a search box on the header of the GWT celltable.
I want both the Name of the header as well as the textbox in the header of the cell table.
|Header 1 | Header 2 |
|SEARCHBOX | SEARCHBOX|
| ROW 1
| ROW 2
I can have any one textCell or TextInputCell in the header. But i'm not able to have both in the header.
can you help me plssss?
Thanks in advance.
Gnik.

I have implemented something like that however I run into a refresh problem.
But if you don't refresh the CellTable after each keystroke there shouldn't be an issue.
For implementation details check out this thread
Basically you have to implement a custom AbstractCell (alternatively you could extend the TextinputCell and override the render method to output the header).

Related

Disable JFace TableViwer single row

Does anyone know how to disable a single row of a JFace TableViwer? I have a TableViwer constructed as follows:
TableViwer tv = new TableViwer(composite, SWT.NONE| SWT.FULL_SELECTION | SWT.BORDER);
tv can have many rows, but I am adding a particular unique row to the table dynamically(when an external button is clicked) and I need to make only that row disabled (grayed out and not selectable. Not selectable can also be achieved through existing handler, if there is no other option).
I searched in google but did not get much information. I am new to SWT/JFace, so any help would be appreciated.
You would have to do something in the selection listener to reject selection of the row.
To make the row gray you can make your Label Provider implement IColorProvider which lets you define the two methods:
public Color getForeground(Object element);
public Color getBackground(Object element);
which can color the row.
You could also use a label provider derived from StyledCellLabelProvider which lets you define more complex coloring.

Not able add combobox as edittor for a combobox cell GXT 3.1.2

I want to add a combobox in my grid, which would populate its store(of grid) as user provide the word.
If i am adding a custom abstract cell in to grid, I can able to add combobox as edittor to it. But when i am trying to use combobox cell (need to display text in a input tag/ Editable), Combobox is not adding to Grid.
Mean to say when I click on that column, it's not converting to combobox.
Tried with adding keyuphandler to addHandler method. But It's not coming to that handler.

Whole row editable on click of a row in GWT editable grid

I need to implement a functionality like onclick of a row, whole row must become editable.
For eg: Currently I have 4 columns, each column have edittext cell as the datatype (element). Onclick of a row, each edittext cells must be in edit mode (input mode). Can this implementation be done??
Currently when we click on each component it opens in input mode, but i need to have input mode for all cells on click of a row.
Please suggest and give some ideas.
I think you could do the job with some things in the "databinding" part of GWT :
com.google.gwt.editor.client.Editor

Android UI requirement

I have UI requirement shown below:
|------------------------|
|Header-1 |
| Checkbox1[] |
| Checkbox2[] |
| Checkbox3[] |
|------------------------|
|Header-2 |
| Checkbox1 [] |
| Checkbox2 [] |
| Checkbox3 [] |
and so on clicking below button.
BUTTON -> clicking on this button on bottom will create header and 3 checkbox everytime. How can i achieve this? This is very urgent. I can not take these in XML laypout as these need to be added dynamically on runtime.
If possible, Please provide any sample code and guide me.
Thanks,
Rachana
You should create a listView containing rows defined by a layout having :
a linear layout containing a textView with Header-1 (and so on) as text
another linearLayout containing three checkboxes.
You will create an arrayAdapter with a list of strings representing different values for Header-1 (I guess checkboxes will have same values all the time).
Adding a click listener (onClickListener) on your button. This listener will add an item to the arrayList used by the adapter to add new items in /remove items from your listview when your arrayList is modified (calling notifyDataSetChanged()) to refresh the listView.

How do you change the mouse over highlighting?

In GWT, I am using CellTable.
When you mouse over the CellTable it highlights each row.
How do change the behavior of the highlighting from the mouse over? Specifically:
change the color of highlighting
disable/enable
make it highlight only the specific grid item at your cursor (instead of the entire row)
( The current hack I have is to create a bunch of 1 column wide CellTables and add them to a VerticalPanel layout... creating the illusion that there is one CellTable and it highlights each grid according to your cursor. Is this bad? Why? performance? )
You will notice the CellTable uses a ResourceBundle, which means all the css styles get obfuscated ... this makes it more difficult to override styles.
The CellTable constructor will actually allow you to override the default ResourceBundle. So first, you need to create your own resource bundle like this:
public interface CellTableResources extends Resources {
public CellTableResources INSTANCE =
GWT.create(CellTableResources.class);
/**
* The styles used in this widget.
*/
#Source("CellTable.css")
CellTable.Style cellTableStyle();
}
Then you need to create your own CSS file. I recommend copying the CellTable style directly into your project and use that as a starting point. You can find it here:
http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/user/cellview/client/CellTable.css
Make sure the style is injected first, and then you just feed it into the CellTable's constructor like this:
CellTableResources.INSTANCE.cellTableStyle().ensureInjected();
myCellTable = new CellTable<T>(Integer.MAX_VALUE,CellTableResources.INSTANCE);
Specifically, you'll want to tweak these styles:
cellTableKeyboardSelectedRow
cellTableKeyboardSelectedRowCell
cellTableSelectedRow
cellTableSelectedRowCell
cellTableKeyboardSelectedCell
It is important to note that the cell table differentiates between the 'selected row' and the 'keyboard selected row'. The selected row is the actual row selected (ie via SelectionModel). The keyboard selected row refers to what is highlighted when the user is pressing the up / down key, but does not mean the row is actually selected (if that makes sense).
I'll just add for number 2) on your list, you can simply do
cellList.setSkipRowHoverStyleUpdate(true)
That completely disables highlighting. There are also two more setSkip-functions on CellList related to hovering.
CellTable can be styled via CSS: How do I style a gwt 2.1 CellTables headers?
To disable highlighting just set the hover CSS property to nothing.
Possibly - try tweaking the .cellTableSelectedRow and .cellTableSelectedRowCell.
Here is the original CellTable.css: http://www.google.com/codesearch/p?hl=en#A1edwVHBClQ/user/src/com/google/gwt/user/cellview/client/CellTable.css&q=cellTableLastColumn&d=8