In a jsff file a component has been designed and the values are being fetched from a Static VO. There are only two values in the static Vo. I need the first option to be set as default. But there is a empty value that is being set. I have written a condition to disable it. And when it is disabled the value must be set to the first one.
I have tried the List UI Hints and tried to enable the Include No selection item: Labeled Item first of list, I tried creating a new vo which only has one value and rendered it in Jsff(But it will make the code more complex for the future development) I have tried creating the switcher. But none of them worked as they should.
Can anyone suggest me a alternative where the code complexity does not increase and by default there is a first value selected. And disable if there is condition for disable tag in jsff is true.
PS: Once the field is disabled the first value must be the default value to be set by default.
There don't seem to be any default way to do this with Oracle ADF without adding code to your view Object. Here's how to automatically select First value in your ADF LOV (detail from here https://cedricleruth.com/autoselect-first-value-in-adf-lov-inside-a-table/) :
Generate the RowImpl Java class of your View Object and Static VO
In this RowImpl.java add the following function to return the first value if no value is already selected
public String defaultNextStatus() {
String value = (String) getAttributeInternal(AttributesEnum.NextStatus.index());
if (value == null) {
XxcrWorkflowUvVORowImpl nextStatut = (XxcrWorkflowUvVORowImpl) getWfkVA().first();
//Wkfva is the VO of the LOV
if (nextStatut != null) {
return nextStatut.getTxtValeur();
}
}
return value;
}
In the Detail panel of the attribute add the following Default Value Expression: adf.object.defaultNextStatus()
In the Detail panel of the attribute set the refresh Expression Value to false to avoid picking the first value again in case of ppr/refresh
Related
Intention is to rule to activate when TradeEvent with specific book name appears, and PanicButtonManager panic mode is enabled:
when
$tradeEvent : TradeEvent(
bookShortName == "FMBTHQLA")
p : PanicButtonManager(
panicModeEnabled)
The thing is that when I change field panicModeEnabled value in drools it's not updated. The field value is constant from time of PanicButtonManager creation. But when I try to "print" it it's working fine:
when
$tradeEvent : TradeEvent(
bookShortName == "FMBTHQLA");
p : PanicButtonManager(
panicModeEnabled)
then
modify ($tradeEvent){
messageCode = "PM003",
message = "HQLA: FMBTHQLA is restricted to HQLA mode. Panic status: " + p.isPanicModeEnabled(),
tradeValidationStatus = STATUS.ERROR
}
This code activated whenever new TradeEvent appears with specific book name, but second condition stays same even tho I change panicMode field. But at the same time in message it prints correct status(it changes).
Why in "when" section evaluation of panicModeEnabled stays same? It keeps value from creation of class PanicButtonManager and doesn't update with change of field, but field prints correctly in message.
How do I make PanicButtonManager evaluate correctly in when section(Not keep state from creation time but update with field update).
From the comments, the state of PanicButtonManager is modified outside of Drools. Therefore to make the changed state visible, you need to call update to trigger a reevaluation of the rules with the new value. The modify is only making the new state of the TradeEvent visible.
The syntax would be like this:
rule "..."
when
// ...
p: PanicButtonManager( panicModeEnabled )
then
// ...
update(p);
end
Note that update will reevaluate all of the rules with the new condition(s), not just the remaining rules in the previous set of matches.
I have a form that requires multiple user inputs. One of them is a drop down list from which the User has to choose. Now I have to set the next input field as required depending on the options chosen in the first field.
For ex: There are 4 input options to be chosen for the first input field - A,B,C,D
I want the next input field to become mandatory when the user chooses option A and D.
How do I build the expression for the required field in this case?
I have tried doing this but that doesn't work
https://stackoverflow.com/a/48089828/15161963
1). Assume that, the name of first field() is 'FirstField' and next input field id 'SecondField' .
2). Then on 'SecondField'component's Required property , write EL as below .
Required = #{bindings.FirstField.attributeValue eq 'A' || bindings.FirstField.attributeValue eq 'B'}
3). And ensure that , 'SecondField's partialTrigger property points to 'FirstField' component .
I think you can binding your dopdownlist to a bean.
binding=#{yourBean.firstDropdowList}
Create method isDisableInputField
Boolean isRequireYourInputField(){
Boolean dropdownValue=firstDropdowList.getValue();
if("A".equals(dropdownValue) ||"D".equals(dropdownValue)) {
return true:
}
return false
}
In your af dropdown tag. Set
require=#{yourBean.isRequireYourInputField()}
I want to remove entrys out of an attribute map. The problem is that the remove method can't match the key I search for:
final Attributes attributes = manifest.getMainAttributes();
symbolicName = getAttributeValue(attributes, "Bundle-SymbolicName");
attributes.remove("Bundle-SymbolicName");
When i run that code, the entry with the key "Bundle-SymbolicName" (and every other i try to remove) is still in attributes.
In the debugger i can evaluate the following expressions:
attributes.getValue("Bundle-Version") = 0.1.0.qualifier
attributes.containsKey("Bundle-Version") = false
attributes.remove("Bundle-Version") returns null (Returns the previous attribute value, or null if none.)
Is this a problem with typecasting?
RealSkeptic did answer my question: The keys of Attributes are not strings. I need to use the type Attributes.Name
A query is executed from within a facade to generate the report data. The query is correctly grouping data as follows: one row with A=351 (the one with B=757), rows with A=352 (B=523/535/etc.), and so on.
If the first row appearing in the page has A=350, then the second has a value diferente from 350 (e.g. 351), the "351" header will be displayed in the next page (only if there are enough 351 rows to reach another page, of course).
The 2nd and 3rd rows should not be inside 351 group, but inside another group called 352. But this behavior is not always happening for other pages. In this case, both descriptions are equal, but still 352 is being displayed on page 11.
Is it a bug in JasperReports?
I used to do a programmatic sort instead of SQL GROUP BY, as follows, and it didn't change anything:
Collections.sort(Reports.LIST,
(Comparator<MyObject>) new Comparator<MyObject>() {
public int compare(MyObject o1, MyObject o2) {
if (o1.getA().compareTo(o2.getA()) == 0) {
return o1.getB().compareTo(o2.getB());
} else {
return o1.getA().compareTo(o2.getA());
}
}
}
);
EDIT: Found out it happens in this specific case wherever the row is located (the 352 one is the last one in this page):
The Group Expression option has only the description, not the number; so, when the descriptions were equal for same number, it didn't separate the rows.
Steps:
Open iReport and your file;
Go to the Report Inspector (the left pane)
Click on the desired Group Header and open the Properties pane (right side)
Under the last section Group properties, type the correct Group Expression.
I am working on automation in jbehave. I have scenario in which i have multiple steps. Now out of that 2 steps are having same input parameter name. For one i am passing value from examples table and for other i am passing value in statement itself even though it is taking value from example table only.
I know i can change the input parameter name in java/jbehave statement but that is not possible because both the statements are used at multiple times and for one scenario i can not break all existing scenarios.
Any clue on this or anyone who faced similar situation should also comment on this.
code snippet
story file
Scenario :
Given I pass value '1'
And I take value from temp file '<value>'
Examples
value |
2
java file :
#Given("I pass value '$value'")
public void fn(#Named("value") int value)
{
------
}
#Given("I take value from temp '$value'")
public void fn2(#Named("value") int value)
{
-----
}
Now the issue here is that for first statement even though i am passing value '1' from statement it is taking value from example table only which is '2'.
I tested a similar scenario on versions 3.9.5 and 4.0.4 of JBehave, and it worked fine on both versions.
This is my scenario:
Scenario: some scenario
Given I pass value '1'
Given I take value from temp file '<value>'
Examples:
|value|
|2|
|3|
and here is my java code:
public class MySteps {
#Given("I pass value '$value'")
public void fn(int value)
{
System.out.println("GIVEN : I pass value = " + value);
}
#Given("I take value from temp file '$value'")
public void fn2( #Named("value") int value)
{
System.out.println("GIVEN : I take value from temp = " + value);
}
}
I have created a project in Eclipse using maven jbehave-simple-archetype.
You can clone this project into Eclipse from this link: https://github.com/kordirko/jb_test
To change a version just edit it in pom.xml => <jbehave.core.version>3.9.5</jbehave.core.version>
========== EDIT ================
Consider setting useDelimiterNamedParameters(true) option in JBehve configuration
http://jbehave.org/reference/stable/parametrised-scenarios.html
They write in documentation, that starting from version 4.0.4 this option is enabled by default.
We can configure JBehave to interpret the name contained between the delimiters as the parameter name and look it up in the parameters provided by the examples table. The default behaviour of parameter lookup is overridden via the ParameterControls:
new MostUsefulConfiguration()
.useParameterControls(new ParameterControls().useDelimiterNamedParameters(true));
In this mode, the step method would look much simplified:
#Given("a stock of $symbol and a $threshold")
public void aStock(String symbol, double threshold) {
// ...
}
Starting from version 4.0, the use of delimiter named parameters is the default behaviour.
I tested this option and it seemed to work both in 3.9.5 and 4.0.4 versions.
This is a test scenario:
Scenario: some scenario
Given I pass value '1'
Given I pass value '<value>'
........
Examples:
|value|
|2|
|3|
and a java method without #Named annotation:
#Given("I pass value '$value'")
public void fn(int value)
{
System.out.println("GIVEN : I pass value = " + value);
}
The first step Given I pass value '1' is taking 1 as a parameter.
The second step Given I pass value '<value>' matches <value> by name with a column named <value> from the example table, and is taking values from this table.