How can i customize a dialog box in GMF? - java

Hi,
I am doing a project in GMF. I want to customize a dialog box with a set of default values under the "Choices" column. This is a dialog box which contains a set of values on the left side (Choices), that can be selected to the right side (Feature), and can be moved up or down. Kindly help me..
Thanks in Advance.

Create a class extends to jface Dialog, implement the methods for configuring the shell and create control where you can create composite with two columns in which 1st column will have your default value column "Choices", you can use tree viewer or table viewer according to your requirement. On the selection of content in tree viewer activate the 2nd column composite. You can even use pagebook, A pagebook is a composite control where only a single control is visible at a time.

Related

Adempiere Hiding / Showing Field Based on tick mark checked or unchecked in client widnow by using display logic

I am working with adempiere, I would like to Hide/Show field of a window based on tick mark available in another window Client which is (AD_Clinet table). E.g. I created barcode field in Material Receipt window which i would like to show only when Client screen Scan Barcode On Material Receipt is tick marked. I am using Display logic of window Tab Field > Tab > Field ,following things are tried by me
AD_Client.Is_ScanBarcodeMaterialReceiot
Barcode_Field= #SELECT Is_ScanBarcodeMaterialReceiot FROM AD_Client WHERE AD_Client_ID=##AD_Client_ID##
#Barcode_Field=AD_Client.Is_ScanBarcodeMaterialReceiot#
I didn't got proper output for that.
Please provide suggessions to solve out this problem.
The display logic in ADempiere does not support sql statements. You can use the SQL in a virtual column and then reference that column in your display logic.
So add a Yes/No virtual column to the table with the sql value set to
SELECT AD_Client.Is_ScanBarcodeMaterialReceipt FROM AD_Client WHERE AD_Client_ID=##AD_Client_ID#
Call this column by the same name Is_ScanBarcodeMaterialReceipt. Add it to the window/tab but don't display it. The value should appear in the context when you open the window.
Then you can set your display logic on the bar code field to
#Is_ScanBarcodeMaterialReceipt#=Y

How to refresh the composite while filtering through text field?

I have a section and formtoolkit in one composite. When I enter some text in Search box (Text field) it should filter based on user input and show the results below. I am facing one problem while filtering the data. How to refresh the data in composite when user enters text in Text field.
I want a solution which is same as how it works in
Preferences -> compiler -> Errors/Warnings?
Example:
If I enter "null" in search box it will display all the related "null" values below.
How to achieve this implementation for filtering/refreshing the composite data?
The preference page you reference does this with a Composite containing all the controls to be filtered. The Composite uses the GridLayout layout.
Each control has a GridData layout data. To set a control visible or invisible it uses:
control.setVisible(visible);
((GridData)control.getLayoutData()).exclude = !visible;
Once this has been done it calls:
composite.layout(true, true);
to redo the layout of the Composite completely.
Most of this code is in org.eclipse.jdt.internal.ui.preference.OptionsConfigurationBlock
To do the filtering you create a Text field for the filter and add a ModifyListener to listen to changes in the text.
Each time the text changes you match the text of each control with the filter and set the control visible / invisible as described above. At the end of filtering you do the layout call.

Filtering a ListView in wicket using 2 drop down boxes

I am trying to filter a list that is placed into a listview through the use of 2 drop down boxes.
The first dropdown box is titled price and the second is owner.
I want to be able to select a value in one or more of these drop down boxes and then have the List view re-render with the filtered results.
The trouble is I do not know how to begin this task, would someone be so kind as to enlighten me :D
Thanks in advance!
Your best starting point is probably this example: (Source code also available on this page, ChoicePage.java is the name)
First of all, you have to use a dynamic model in your ListView that generates the list of items depending on what you had selected in the dropdown boxes.
Then the basic idea is that you add an AjaxFormComponentUpdatingBehavior to the components that control the updates (your two dropdown boxes in your case), and in the onUpdate() method of this behaviour you should add the component you want to update to that AjaxRequestTarget passed.

SWT Combo Box Default selection

Im a newbie to swt..I have an SWT Combo box with 2 entries. Currently, it shows a blank selection as the user did not select any. Is there any way to make sure that even if the user does not select any entry in the combo box, he still gets to see the default value selected, is this even possible?..
Use the Combo's select method to select the default option when you create it.

JTable: how to select columns at runtime

I have too many columns in a table to display them all at once, and would like to let the user change which columns are visible. How can I do this?
note: It is easy to make the application select columns at runtime. What I am asking is what UI element(s) to add to allow the user to hide/unhide columns at runtime.
If you can import some external libraries, you could have a look to
http://swinglabs.org/docs/components/JXTable/tutorial.jsp which supports such runtime modifications.
Table Column Manager allows the user to right click on the table header to control which columns are visible.
There isn't a standard way, however what you could do is something like this:
Use a custom table header render component to install additional actions/UI on the column headers (e.g. through a context menu of checkboxes)
Add a custom model which you can re-configure to display different items depending on what the user selected through additional actions on the column headers
Do the event wiring/plumbing.
Alternatively: find a custom component that does this. There probably is something out there already: projects like the component library from JIDE would be a good place to look.
Use TableModel.addColumn(TableColumn) and TableModel.removeColumn(TableColumn) methods to show/hide columns on-the-fly.
You can attach that calls to any other GUI components (for example, make a JPanel or a JTable with a few checkboxes).
Either display a popup menu with the possible columns when user right-clicks the header or implement a small (and light) popup dialog with a checkbox list for selecting the visible columns. The dialog can be opened by right-clicking, by clicking a toolbar button or from a toolbar menu.

Categories