I'm using a Jface CheckboxTreeViewer and wondering if it's possible to provide only specific nodes with checkboxes. I'm afraid that there is no native support and won't be easy to implement. Maybe someone cann help me with this.
Cheers,
Phil
You can't do this with CheckboxTreeViewer.
You can use org.eclipse.jface.viewers.OwnerDrawLabelProvider to draw anything you like in a TreeViewer, so you could use that see http://www.vogella.com/articles/EclipseJFaceTableAdvanced/article.html
For just check boxes you could just use the images returned by a normal label provider to show nothing / checked / unchecked.
Related
I'm developing an eclipse RCP/RAP application. I have several GUI-classes that use the JFace TableViewer (internal org.eclipse.swt.widgets.Table).
Some of my clients mentioned that it is a little confusing wether the "database-select failed" or there are just no elements.
So here's my question. Is there any way to display a "greyed out" text saying "No elements". There is something similar for the org.eclipse.swt.widgets.Text:
edtTest.setMessage("Please enter something");
Couldn't find anything like that.
Thank you in advance.
There isn't any simple support for this.
You could simulate this by adding a dummy row to the table and making your label provider implement IColorProvider so you can set the color of the row (or use one of the label providers based on StyledCellLabelProvider.
Alternatively use a separate label control and use StackLayout to make either the table of the label the visible control.
So. The ideas have been a few.. no good ones.. So here is the problem i have incountered and can not figure out a solution for.
I need to have a txt file containing a hierarchical list of things to do, looking something like this:
Ask a question
Before question asked, check similar questions
Formulate the question so that the problem is clearly shown.
Post the question
Hold your thumbs that this might save your day.
The txt file should in the program fill a list shown in a JPanel and after each step have a checkbox to comfirm "I have been a good boy and done this".
The list can change over time and grow and shrink, so the solution needs a scrollbar.
The list should also contaion a capability to show more the one row.
The solution im working on is done in Jave compiler 1.6 and im using Swing for my layout.
Ideas i have had so far are:
Modified JTable... and the other solutions i am asshamed of..
And thats about it.. ..
JTree with custom renderer. The renderer should be a panle with checkbox and text area.
have look at JTree
have to override JTree Renderer and Editor (comcept is similair for JTable and JTree)
all data are stored in the DefaultTreeModel
examples about Tree Model,Tree Renderer Editor, Tree and here
Also consider org.netbeans.swing.outline.Outline, discussed here and illustrated below. It's not apparent in the screenshot, but the the Outline instance has been added to a JScrollPane.
I would say JTreeTable is a right choice. It will provide a lot of power and flexibility. Please see some very basic examples:
http://www.ibm.com/developerworks/java/library/j-5things14/index.html
http://www.java2s.com/Code/Java/Swing-Components/JTreeTablecomponent.htm
For any serious purpose please use a mature implementation provided, for example, by a SwingLab project:
http://swingx.java.net/
http://java.net/projects/swinglabs
Please also see the following answer:
Java Swing table tree
Hey i want to create a thumbnail viewer, for my app, i want something similar to this.
I was wondering if there is a pre-existing component that can display thumbnails (FREE), or i was considering to use a JTable, with a custom cell renderer.
What do you think, what would be the best way.
It will be used to display images, keep in mind that i must be able to select individual and multiple files to perform actions on them.
thx in advance.
A JList would probably be better than a JTable. You can use a "horizontal wrap" style. You can always create a custom renderer for the list as well.
i need to implement a list as shown in the screenshot below!
now, my question is, what BB component do you suggest to use?
i thought of a RichList, but there are not many possibilities to customize this component afaik.
the alternative would be a Table.
are there other ways to implement this? is it possible to customize a RichList in a way to make it look like the screenshot below?
Setup: BB Eclipse Plugin v1.3, SDK 6.0
Use a ListField. You will have to do your own painting to setup an individual row, but it will be the most efficient way of doing this.
I haven't studied the 6.0 SDK very much, but here is a possible solution for you list:
Each item in the list would be a HorizontalFieldManager. This HorizontalFieldManager would contain the image on the left(this would be a BitmapField) and a VerticalFieldManager. The VerticalField manager would contain 2 LabelFields. The first one for the first row that is bold, and the second one for the rows underneath.
Of course, the first HorizontalFieldManager would have to be FOCUSABLE. You can override the onFocus, onUnfocus and paint methods to handle the focused(selected)/unfocused(unselected) states of the field.
The list would be a VerticalFieldManager that contains custom HorizontalFieldManager elements, as I explained above.
I'm not saying that this is the best solution, but it's a solution and it works(I've done something similar for OS 4.5 - 5.0).
What Swing class can I use to implement something like this?
Add To List http://img22.imageshack.us/img22/3260/swingwidget.jpg
EDIT: Hmm..for some reason I cannot add the image here. Well, here's the link:
Basically, I need a list table, where each column can be of different type of gui (i.e. plain text, check box, or drop-down menu).
EDIT I have re-publish the image for you ;)
You would use a JTable to implement it. Your data will be stored in a TableModel. The DefaultTableCellRenderer and DefaultTableCellEditor should do what you need, but you can also customize the rendering/behavior if necessary.
More info on renderers/editors: http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#editrender
Definitely JTable.
JTable allow you to define what render will have each column. That way you can add checkboxes, combos, textfields etc. to it.
Here's an screenshot:
alt text http://img43.imageshack.us/img43/9430/jtable.png
You can read more about it here: How to use Tables
JTable will do this for you, you're going to need to understand the MVC pattern pretty well to acheive this as you will need a custom model and renderer, but once you get the hang of it its not too hard.
David gearys book "Graphic Java Vol.2" has an excellent section on JTable, whilst this book is now fairly old I still personally think thats the best explanation of JTable I've seen.