As you can see, I’tried DISPLAYONLY=false and leaving it to default, to no avail.
As a bonus question, it is possible to assign specific elements of an array as valueprops? I have a int[5] that I want to display. Can I somehow display this array without explicitly splitting each individual element in the Adapter class?
I haven’t used the code assistant but wrote the Adapter myself (and put it in the correct folder, as the app ‘works’, just not the CHECKBOX)
I will try the code assistant to see if it gets any better…
Oh, and before you ask, don’t mind the program (it’s just a low-level base for a Yahtzee game,not any top notch application. Everyone has to start somewhere, and I got bored of those ‘Hello World’ exercises )
import com.softwareag.cis.server.Adapter;
public class IndexAdapter extends Adapter {
int result1 = 0;
int result2 = 0;
int result3 = 0;
int result4 = 0;
int result5 = 0;
boolean check1= true;
boolean check2= true;
boolean check3= true;
boolean check4= true;
boolean check5= true;
int attempt = 0;
String attemptText = writeAttemptText(attempt);
public void rollDice () {
int[] dice = new int[5];
for (int i = 0; i<dice.length; i++) {
Double d = new Double((6 * Math.random()) + 1);
dice[i] = d.intValue();
}
attempt += 1;
attemptText = writeAttemptText(attempt);
assignResults(dice);
}
public void assignResults(int[] inResult) {
setResult1(inResult[0]);
setResult2(inResult[1]);
setResult3(inResult[2]);
setResult4(inResult[3]);
setResult5(inResult[4]);
}
private String writeAttemptText(int i) {
String result;
switch (i) {
case 0: result = "No try yet.";
break;
case 1: result = "1 roll done.";
break;
case 2: result = "2 rolls done.";
break;
case 3: result = "All rolls done. Please make a selection below...";
break;
default: result = "Over the top!! (" + i + " rolls already!?)";
}
return result;
}
/**
* @return Returns the result1.
*/
public int getResult1() {
return result1;
}
/**
* @param inResult1 The result1 to set.
*/
public void setResult1(int inResult1) {
result1 = inResult1;
}
/**
* @return Returns the result2.
*/
public int getResult2() {
return result2;
}
/**
* @param inResult2 The result2 to set.
*/
public void setResult2(int inResult2) {
result2 = inResult2;
}
/**
* @return Returns the result3.
*/
public int getResult3() {
return result3;
}
/**
* @param inResult3 The result3 to set.
*/
public void setResult3(int inResult3) {
result3 = inResult3;
}
/**
* @return Returns the result4.
*/
public int getResult4() {
return result4;
}
/**
* @param inResult4 The result4 to set.
*/
public void setResult4(int inResult4) {
result4 = inResult4;
}
/**
* @return Returns the result5.
*/
public int getResult5() {
return result5;
}
/**
* @param inResult5 The result5 to set.
*/
public void setResult5(int inResult5) {
result5 = inResult5;
}
/**
* @return Returns the check1.
*/
public boolean isCheck1() {
return check1;
}
/**
* @param inCheck1 The check1 to set.
*/
public void setCheck1(boolean inCheck1) {
check1 = inCheck1;
}
/**
* @return Returns the check2.
*/
public boolean isCheck2() {
return check2;
}
/**
* @param inCheck2 The check2 to set.
*/
public void setCheck2(boolean inCheck2) {
check2 = inCheck2;
}
/**
* @return Returns the check3.
*/
public boolean isCheck3() {
return check3;
}
/**
* @param inCheck3 The check3 to set.
*/
public void setCheck3(boolean inCheck3) {
check3 = inCheck3;
}
/**
* @return Returns the check4.
*/
public boolean isCheck4() {
return check4;
}
/**
* @param inCheck4 The check4 to set.
*/
public void setCheck4(boolean inCheck4) {
check4 = inCheck4;
}
/**
* @return Returns the check5.
*/
public boolean isCheck5() {
return check5;
}
/**
* @param inCheck5 The check5 to set.
*/
public void setCheck5(boolean inCheck5) {
check5 = inCheck5;
}
/**
* @return Returns the attempt.
*/
public int getAttempt() {
return attempt;
}
/**
* @param inAttempt The attempt to set.
*/
public void setAttempt(int inAttempt) {
attempt = inAttempt;
}
/**
* @return Returns the attemptText.
*/
public String getAttemptText() {
return attemptText;
}
/**
* @param inAttemptText The attemptText to set.
*/
public void setAttemptText(String inAttemptText) {
attemptText = inAttemptText;
}
}
(1) the valueprop should point to a boolen (or - well… - could also point to a string)
(2) the statusprop should point to a string having the values CS_EDIT/DISPLAY/INVISIBLE.
(3) Never use “is*” for property access but always “get*”
Thanks for the response.
(1) They did point to a boolean, weren’t they?
(2) I removed that prop.
(3) Seems very counterintuitive to use get* instead of is* to access boolean properties…(these were default-generated constructors made by Eclipse) But hey!.. Now it works.