How to listen to table item text changes? - swt

How can I listen to an SWT Table for any change to the texts of its items?
I don't find anything on Table or on TableItem that is similar to the addModifyListener methods that are avilaible on for example Text and Combo.

The user can't change the text of the items in a plain Table so there is no need for a listener.
To allow the user to change the text you need to set up a TableEditor. The editor will use a control such as Text which can have a modify listener.

Related

NatTable allow cell editing only when cell is selected

Working with a NatTable, I would like the following behavior:
Single click on an unselected, editable cell - cell is selected
Double-click on a cell (at any time), do custom open action
Single-click on a selected cell triggers an edit
Do I need to write a custom IEditableRule that checks selection? If there a way to check the selection from w/i this rule, or do I need to also create a rule that can listen to the entire table selection and unify these concepts?
You need to register custom bindings for editing. The default bindings are registered via DefaultEditBindings. You need to replace them with bindings for double click to open the editor and some customized actions that check the selection. For the key bindings NatTable uses the same approach. It is not the default to check the selection because of abstraction and it should be possible to edit even if you have no SelectionLayer in place.
To check if the cell is selected you either need a reference to SelectionLayer or check the DisplayMode of the cell. Never tried to use a IEditableRule for this.
Maybe these posts give you some more information:
https://www.eclipse.org/forums/index.php/t/452759/
Stop NatTable from going into edit mode when an editable cell is left-mouse-clicked

Custom Drop Down Menu in a Custom Word Content Control

I'm able to create a DropDown ContentControl in word such that a user can select an item from the drop down and that item becomes the text displayed in the ContentControl. However I've noticed that when you create a citation that drop down list contains command items that can launch dialogs. Is there any way to replicate this behaviour but with custom content controls that launch custom dialogs.
Apparently this is impossible as mentioned in the link below because:
This isn't a "standard" content control. This is something Word puts around a Citation field (and around Date fields and some other kinds). But the functionality is Word-internal and proprietary. It's not something that's exposed in the API. IOW, you can't do that, I'm afraid...
http://social.msdn.microsoft.com/Forums/vstudio/en-US/40542235-1a32-45e6-9aef-55709021ce53/how-do-i-create-a-contentcontrol-with-a-menu-like-when-inserting-a-placeholder?forum=worddev

SmartGWT : ListGrid Dragging customizing

I need to put an HTML code on dragging event. Like there is some HTML text that gets dragged with Cursor.
By default first column of ListGrid goes with Cursor. But I want to generate separate Text for it.
So, is it possible to do that?
Or Is there any other option to do that?
Please help me in this.
Thanks.
Whats displayed (by default) during a drag event in ListGrid is defined by ListGrid.dragTrackerMode and ListGrid.titleField.
ListGrid will default to first field to obtain the description to be shown during a drag, based on titleField.
If you already have another field in the grid from which you can obtain the text, use listGrid.setTitleField("other-field-name");
A custom title can be defined by overriding ListGrid.getDragTrackerTitle
If multiple records are selected, and dragged, drag tracker/title/etc. will be based on first selected record.
Check other ListGrid methods that allow drag tracker customizations as well.

GWT CellTable Sort Column With Custom Header

I have a sortable column in a CellTable. The problem is that I have a custom Header, in the header there is a text box. When the user clicks the text box, the column is sorted and the text box looses focus. What I need is for the sort to happen if there is a click anywhere in the header except in the text box. I have tried listening to the "click" event on the textbox cell and do stopPropagation, but the event is fired after the sort happens so it does not stop the event. Any ideas would be helpful.
Cell widgets use event delegation: the event that triggers and gets passed to your Cell's onBrowserEvent is the same, caught at the same place, as the one that triggers sorting, so stopPropagation won't be of any help.
Also, have a look at the code for CellTable (or AbstractCellTable in trunk): there's no way to prevent sorting. I'd suggest you file a request for enhancement on the issue tracker.

jquery hide show

I have a table generated from database ( basically in MVC view). I want to make it editable. I want to use jquery to hide the row when edit button infront of row is clicked and show the row in edit format which is by default hidden. how can I do this using jquery?
Please suggest solution
Thanks
I was able to accomplish this by tagging the table row with a fake class name, then in the button click events I used jquery's Hide/Show. Like this:
In your edit button click event call this:
$('.trMyRowIWantToHide').hide();
And tag your table row with a fake class like this:
<tr class="trMyRowIWantToHide">
JQuery Show
http://api.jquery.com/show/
JQuery Hide
http://api.jquery.com/hide/
You also may want to make use of div tables for this project instead of actual tables. You selectors such as $("#idofcolumn").toggle(); to hide and show the div or in your case you would probably want to show a text field. You could even .html() to replace the text in a column with a text box. There are several ways to go about this. Check out the JQuery documentation.
http://docs.jquery.com/Main_Page
How exactly is the HTML set up for your rows? Normally you could do $('SELECTOR').toggle() on each of them.