I want to find out how to do custom binding on java, I've searching on google but not found any.
It's simple problem,
I have two jSpinner, jSpin1 and jSpin2.
jSpin2 value is half from jSpin1.
when I do binding, there is
Binding source : jSpin1
Binding expression : ${value}
so the value in jSpin2 exactly the same with jSpin1. then how could I make its value half from jSpin1?
thank you.
As I Understand you use NetBeans GUI Builder. You can do it by the next steps:
- do right click on jSpin2 (in design view) and select ‘Properties’
- select ‘Binding’ at the top of dialog
- click on ‘...’ button on ‘value’ property
- select ‘jSpin1’ from ‘Binding Source’
- select ‘value’ from ‘Binding Expression’
- edit ‘Binding Expression’ to ‘${value/2}’
(Also you can put ‘jSpin1[${value/2}]’ in ‘value’ property)
Related
I have a part that is defined as "Part Descriptor" in the Application.e4xmi. And I have the following structure under the "Windows and Dialogs" node:
- Trimmed Window
- Controls
- Part Sash Container
- Part Stack
Part - A
- Part - B
I tried adding a Placeholder, but it doesn't let me select anything. I know how to add a part programmatically (even though it's ugly in E4), but I want to do it inside the Application.e4xmi, because that's the right place.
How do I add the part defined in the "Part Descriptor"?
I have a invoice for which I want to show in preview mode with a watermark. I have integrated the report with my web application (Spring MVC).
Any solution?
EDIT: I want to pick a value from a dataset (Table: invoiceheader), and use that value to decide whether to show /not show the watermark. I am unable to pick that value from Birt script. Can you please please guide..
Sorry .. the customer asked for a different way of identifying the fact rather that from passing the parameter.
Thanks
You need to declare a report parameter in the .rptdesign of the invoice. For example we name it "useWatermark", and we set the datatype to boolean and a default value to true.
Select the report root in the outline view of the designer -> script tab -> beforeFactory
if (!params["useWatermark"].value){
reportContext.getDesignHandle().findMasterPage("Simple MasterPage").setProperty("backgroundImage", "");
}
This script removes the watermark if the parameter is set to false. By default, the master page is named "Simple Masterpage" but if you have renamed it or if there are multiple masterPages defined in the report you should adjust the script consequently.
EDIT: if we need to extract the information from a dataset, then we can't make use of the masterPage, we have to use a grid instead.
Create a grid with one cell, and drop all the content of your page into it
Set your watermark as background-image of the grid
Create a report variable "useWatermark" in the "Outline/variables" branch (see picture below), set default value to true/false as you like
Select dataset invoiceHeader -> script tab -> onFetch, and affect the variable from a boolean dataset column, or from any expression returning true/false:
vars["useWatermark"]=row["myBooleanDatasetColumn"];
This dataset must be used somewhere in the report body, otherwise it won't be triggered and the variable won't be initialized
Select the grid -> script tab -> onRender
if (!vars["useWatermark"]){
this.getStyle().backgroundImage="";
}
I have made a eclipse RCP application, everything is working fine but i recently noticed the Refractor option in menu. I would like to get rid of it. I have the following in ActionBarAdvisor.java:
#Override
protected void fillMenuBar(IMenuManager menu) {
menu.add(createFile());
menu.add(createEdit());
menu.add(createNavigate());
menu.add(createProject());
menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(createWindow());
menu.add(createHelp());
}
The above functions add actions to menu as:
edit.add(undoAct);
and also undoAct is defined as:
private IWorkbenchAction undoAction
makeActions function has contents as:
#Override
protected void makeActions(IWorkbenchWindow window) {
undoAction = ActionFactory.UNDO.create(window);
undoAction.setText("Undo Menu");
register(undoAction);
}
I found a suggestion which said to use hideActionSets to hide the menu. But I could not hide the entire menu but just its actions!
Remove "File, edit,...etc" menus from Eclipse RCP application
How to remove Refractor option now?
Thank you.
You can use activities, as described here.
First, you will need to find the ID of the menu:
Use the Plug-In Spy
The first way is to use the Plug-In Spy. Press alt-shift-F2 and click on a
menu item or toolbar button that you want to be hidden. If there is an ID
string under the heading "active action definition identifier" then you are
in luck. This item has been added using the Command Extension and you can
use this ID as the pattern argument for the Activities Extension. But not
all items that have been added using the Command Extension present their ID
string to the plug-in spy.
As a side note, the ID strings are period separated. For instance the ID for
a button might be "org.eclipse.ui.navigate.backwardHistory". Regular
expressions use the period to stand for any character. Luckily the period
used as a wild card matches with actual period characters so you don't need
to escape them if you don't want to. I find it makes it a bit easier to read
if they are not escaped and it is highly unlikely it will cause any
ambiguous matches.
Use the Plug-In Registry and plugin.xml files
The second way is to use the Plug-In Registry. You can open this view by
going to:
Window/Show View.../Other/Plug-in Development/Plug-In Registry
What you would like to do is to try to get a couple pieces of information:
a) the plugin that is contributing the UI element
b) information about what kind of extension the plugin is using to create
the UI element
If there is a very unique word associated with the UI element or its tool
tip then you can use this in the Plug-In Registry's filter field to try to
nail down which plug-in is contributing the UI element. The filter field is
not a very powerful tool so it can be a bit frustrating to use. It does not
allow wildcards and does not match space characters.
When you track down which plug-in is contributing the UI element then you
open the the plug-in in question from the Plug-Ins view which is found
grouped with the Package Explorer in the Plug-in Development perspective.
Then go to the Extensions tab and search for the ID string which can usually
be found in either a usage of the Command or ActionSet extension. If the UI
element is added using an ActionSet then you prefix the plug-in ID to UI ID
in the pattern argument given to the Activities Extension. For example
org.eclipse.ui.actionsets.foo becomes the pattern
org.eclipse.ui/org.eclipse.ui.actionsets.foo.
Then create a new Activity which will never be activated and a corresponding activityPatternBinding with the id you found in the last step. It will look like this in your plugin.xml:
<extension point="org.eclipse.ui.activities">
<activity id="myActivity" name="MenuHidingActivity">
<enabledWhen>
<with variable="activePartId">
<equals value="nonExistentPartId"></equals>
</with>
</enabledWhen>
</activity>
<activityPatternBinding activityId="myActivity" pattern="menuItemID">
</activityPatternBinding>
</extension>
How can I disable right click event on ajaxfallbacklink in Wicket framework (6)?
If using ajaxfallbacklink, and opening a new tab (as rightclick on mouse would let me do), i will get an exception.
(http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.html)
" ajax target if this linked was invoked using ajax, null otherwise"
Therefore I would like to disable the rightclickbrowser menu, or fix the exception for these kinds of links. How could I do this in a good way codewise?
Christophs answer got me on the right track. Which is "Before opening a new tab/win with an ajaxlink (rightclick), check that target itself (and maybe it's parameter) is not null and take precautions for that. setResponsePage(YOURPAGE) or something". Doh;) Chr. should have the credits for this.
When I type this
private MyKlass myklass;
and hit 'save' in Eclipse, it becomes this:
private final MyKlass myklass;
How do I stop Eclipse from doing this?
You need to disable that option in your 'save actions'.
right click your project > properties, then go to java editor > save actions. go to 'configure', 'code style' tab, and you have it on the bottom ('private fields').
Window - Preferences - Java - Editor - Save Actions - Configure... - Code Style - Use modifier final when possible
The same option can be found in Java - Code Style - Clean up.
If you want to leave this feature enabled in general but turn it off for a specific field, I found a simple workaround. Just declare a protected method that assigns to this field.
protected void preventFinal() {
field = null;
}
You can go to Project --> Properties --> Java Editor --> Save actions , Uncheck "Enable project specific settings"
There is Section called Save Actions in Eclipse Window -> Preferences -> Java -> Editor. There You can Configure Aditional actions - > (tab) code style - > Variable declarations -> edit use of final keyword.
Initialize the field with null:
private File tempDir = null;