How to merge table cells in Eclipse RCP Table control? - eclipse

My question is: I've an Eclipse RCP table in my view. The table has gridlines Visible and everything is fine. But I want all the cells of first row of the table to be merged as a single row in run-time GUI. How can I achieve this functionality ? Please, I don't expect something like adding a text over the first row obstructing it. If any API level functionality or any clues to do this are welcome.

The swt table is a native widget and does not allow you any span, neither in columns nor in rows. Even OwnerDraw (custom cell rendering) does not support this. The only way I see that could allow you to achieve this kind of hack is the swt table editor which allows you to place controls above cells:
http://www.eclipse.org/swt/snippets/#tableeditor
The table editor tracks the position of single cells and positions controls above them. It hides controls when a cell is not in edit mode, show's them when the cell is in edit mode. You'd have to deactivate this default behavior and make sure the controls are always shown - this should be fairly easy.
The more challenging part would be that you'd have to find out how to place the controls above 2 or more (and not a single) cells.
The only swt control I know to support span is the nebula grid. Grid is a custom control (no native widget) and therefore offers far more possibilites.
http://eclipse.org/nebula/widgets/grid/grid.php
http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.swt.nebula/org.eclipse.swt.nebula.snippets/src/org/eclipse/swt/nebula/snippets/grid/GridSnippet2.java?root=Technology_Project&view=co

u can use GC api to do the needs in table. u can span between two columns.
http://www.java2s.com/Tutorial/Java/0280__SWT/Maketextspanmultiplecolumns.htm

Related

How to create an expandable and collapsable menu WITHOUT a tableviewcontroller

I have a question. I am trying to create an expandable FAQ menu without using a tableviewcontroller. The reason I don't want to use a tableview is because I don't want expandable cells, rather, I want a buttonclick to reveal a label while also sliding down any other buttons on this page.
I'm using Swift in Xcode 7.3
If anyone has any suggestions/knows of a tutorial/a forum post, it would be greatly appreciated.
Thank You.
Sure,nyou could use buttons, and either change constraints on label heights or dynamically add labels. That's a lot of effort and code.
Or, you could use a table view and one of the myriad guides. Remember that table views don't have to be selectable on ever row, and they don't have to display row separator lines (UI).
Indeed you could disable selection on all rows and add buttons to some rows, though I'd personally say that's overkill and why require the user to be 100% accurate with the tap on a button which in your sample image doesn't even look like a button.

SWT Tree with columns - resizing columns by dragging line

I have a multi-column tree that I really don't want to show column headers (they provide no valuable information in my case and make the layout unnecessarily busy). Unfortunately, I really need to have resizable columns.
How can I make the columns resizable by dragging lines between them?
SWT uses native widgets and this isn't native behavior (at least on platforms that I am familiar with), so there is no built-in mechanism in SWT for doing what you are after. You should be able to simulate this yourself by tracking mouse events, managing the mouse cursor and calling TreeColumn.setWidth() when appropriate.

eclipse rcp : more powerful table widget?

It seems swt table does't allow us to operate on multiple cells ?My application need a feature like this "select a range of cells, then copy cell text to excel, or paste text into cells".I think this will be a handy feature.
Any solution on this ?
best regards
Take a look at the nat table component, see http://www.nattable.org/drupal/
This component has many features that are not covered by the basic SWT table widget
For people reaching this, NatTable has been moved to Eclipse Nebula.
https://eclipse.org/nebula
It also contains Grid and XViewer as table alternatives.

how to add a disclosure panel to a cellTable column in GWT

I have a cellTable with 5-6 columns. I want to put a plus icon in each row on clicking of which will display the details maybe in a disclosure panel. I have been looking around for a while now and I cannot find any information on how to achieve this. Could someone point me in the right direction?
i suspect i probably have to add a cellTree to the column? how do i go about this?
Thank you for your response in advance.
There is work in progress to allow expandable rows in CellTable among other features (maybe GWT 2.3). You can see more details here:
http://groups.google.com/group/google-web-toolkit-contributors/browse_thread/thread/b4a8a6e3c98ac061#
If that is not enough or you can not wait untill it is released I can think of two ways to achieve it:
As you said, using a CellTree.
Creating a custom cell that stores
state (open/close). Depending on the
state the cell will render
differently. In same way it is
similar to how EditTextCell works, in
"edit" state it renders an input
field while in "normal" state it renders
simple text.
I'm trying to do that too ... I managed to mimic that functionality toying with the html and a custom cell class that allows clickable pictures.
It is working for normal content such as text but if you'd like to get an asynchronous data to show in the expended line, I don't know how to do it ... (I'm trying to do exactly that).
Also, it doesn't look good because the columns don't align well ...
So what I've done is:
- create a custom cell class to display a picture (right pointing triangle, looking like the triangle in the disclosure panel)
In the click event get the HTML code of the selected row and copy it. Replace the content of the row (all cells) in the table with only one cell with its colspan set to number of columns. In the cell, add a table with first line the copied row and second line the content to display as expanded.
Get the image to sink an event for closing. In event, reset the original row that we copied.
I hope it helps.

What are some SWT datagrids/tables?

I need to be able to display some data in Eclipse in a grid/table control... I need things like paging, multiple column sorting, column choosing, etc. There is an SWT Table and the Nebula project has a grid in alpha.
Does what I need exist? 3rd party maybe? Doesn't have to be free, we can pay for the functionality.
I haven't seen those features implemented in a reusable widget that I can think of, they are more application-level features.
Paging:
If you were to use the JFace-type viewers (SWT Table or Nebula Grid both support this style of MVC architecture, as do some others mentioned in this question), it should be possible to implement paging in the content provider, just by setting some custom offset into your dataset and then refreshing the grid.
Multiple Column Sorting:
You can do this, it just needs an implementation of the correct table sorting interface. You get passed two rows to compare, and you can compare whichever columns you like in the sorting algorithm. Again though, the interface for actually choosing which columns to sort is down to you.
Column Choosing:
This requires a grid control with cell selection. Nebula is one, SWT Table isn't. If cell selection is available, this is just a matter of catching the correct selection event (clicking on a header probably) and iterating over your rows to select the correct cells.
There is also a new "rising star" on the widget sky called "nattable 2.0". It is an opensource project and the development team is very responsive. You should take a look at nattable.org ...
You could use the facilities of table presentation offered by the BIRT plugin, that is if you are really advance table layout needs.
(source: theserverside.com)
(otherwise the classic SWT TableViewer offers already some of the feature you are after
(source: richclient2.eu) )