本文整理汇总了Java中org.javarosa.core.model.FormIndex.isEndOfFormIndex方法的典型用法代码示例。如果您正苦于以下问题:Java FormIndex.isEndOfFormIndex方法的具体用法?Java FormIndex.isEndOfFormIndex怎么用?Java FormIndex.isEndOfFormIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.javarosa.core.model.FormIndex
的用法示例。
在下文中一共展示了FormIndex.isEndOfFormIndex方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isIndexReadonly
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
/**
* @param index
* @return true if the element at the specified index is read only
*/
public boolean isIndexReadonly(FormIndex index) {
if (index.isBeginningOfFormIndex() || index.isEndOfFormIndex())
return true;
TreeReference ref = form.getChildInstanceRef(index);
boolean isAskNewRepeat = (getEvent(index) == FormEntryController.EVENT_PROMPT_NEW_REPEAT ||
getEvent(index) == FormEntryController.EVENT_REPEAT_JUNCTURE);
if (isAskNewRepeat) {
return false;
} else {
TreeElement node = form.getMainInstance().resolveReference(ref);
return !node.isEnabled();
}
}
示例2: incrementIndex
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public FormIndex incrementIndex(FormIndex index, boolean descend) {
List<Integer> indexes = new ArrayList<Integer>();
List<Integer> multiplicities = new ArrayList<Integer>();
List<IFormElement> elements = new ArrayList<IFormElement>();
if (index.isEndOfFormIndex()) {
return index;
} else if (index.isBeginningOfFormIndex()) {
if (form.getChildren() == null || form.getChildren().size() == 0) {
return FormIndex.createEndOfFormIndex();
}
} else {
form.collapseIndex(index, indexes, multiplicities, elements);
}
incrementHelper(indexes, multiplicities, elements, descend);
if (indexes.size() == 0) {
return FormIndex.createEndOfFormIndex();
} else {
return form.buildIndex(indexes, multiplicities, elements);
}
}
示例3: decrementIndex
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public FormIndex decrementIndex(FormIndex index) {
List<Integer> indexes = new ArrayList<Integer>();
List<Integer> multiplicities = new ArrayList<Integer>();
List<IFormElement> elements = new ArrayList<IFormElement>();
if (index.isBeginningOfFormIndex()) {
return index;
} else if (index.isEndOfFormIndex()) {
if (form.getChildren() == null || form.getChildren().size() == 0) {
return FormIndex.createBeginningOfFormIndex();
}
} else {
form.collapseIndex(index, indexes, multiplicities, elements);
}
decrementHelper(indexes, multiplicities, elements);
if (indexes.size() == 0) {
return FormIndex.createBeginningOfFormIndex();
} else {
return form.buildIndex(indexes, multiplicities, elements);
}
}
示例4: isIndexReadonly
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
/**
* @return true if the element at the specified index is read only
*/
public boolean isIndexReadonly(FormIndex index) {
if (index.isBeginningOfFormIndex() || index.isEndOfFormIndex())
return true;
TreeReference ref = form.getChildInstanceRef(index);
boolean isAskNewRepeat = (getEvent(index) == FormEntryController.EVENT_PROMPT_NEW_REPEAT ||
getEvent(index) == FormEntryController.EVENT_REPEAT_JUNCTURE);
if (isAskNewRepeat) {
return false;
} else {
TreeElement node = form.getMainInstance().resolveReference(ref);
return !node.isEnabled();
}
}
示例5: incrementIndex
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public FormIndex incrementIndex(FormIndex index, boolean descend) {
Vector indexes = new Vector();
Vector multiplicities = new Vector();
Vector elements = new Vector();
if (index.isEndOfFormIndex()) {
return index;
} else if (index.isBeginningOfFormIndex()) {
if (form.getChildren() == null || form.getChildren().size() == 0) {
return FormIndex.createEndOfFormIndex();
}
} else {
form.collapseIndex(index, indexes, multiplicities, elements);
}
incrementHelper(indexes, multiplicities, elements, descend);
if (indexes.size() == 0) {
return FormIndex.createEndOfFormIndex();
} else {
return form.buildIndex(indexes, multiplicities, elements);
}
}
示例6: decrementIndex
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public FormIndex decrementIndex(FormIndex index) {
Vector indexes = new Vector();
Vector multiplicities = new Vector();
Vector elements = new Vector();
if (index.isBeginningOfFormIndex()) {
return index;
} else if (index.isEndOfFormIndex()) {
if (form.getChildren() == null || form.getChildren().size() == 0) {
return FormIndex.createBeginningOfFormIndex();
}
} else {
form.collapseIndex(index, indexes, multiplicities, elements);
}
decrementHelper(indexes, multiplicities, elements);
if (indexes.size() == 0) {
return FormIndex.createBeginningOfFormIndex();
} else {
return form.buildIndex(indexes, multiplicities, elements);
}
}
示例7: getEvent
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
/**
* Given a FormIndex, returns the event this FormIndex represents.
*
* @see FormEntryController
*/
public int getEvent(FormIndex index) {
if (index.isBeginningOfFormIndex()) {
return FormEntryController.EVENT_BEGINNING_OF_FORM;
} else if (index.isEndOfFormIndex()) {
return FormEntryController.EVENT_END_OF_FORM;
}
IFormElement element = form.getChild(index);
if (element instanceof GroupDef) {
if (((GroupDef)element).isRepeat()) {
if (repeatStructure != REPEAT_STRUCTURE_NON_LINEAR && form.getMainInstance().resolveReference(form.getChildInstanceRef(index)) == null) {
return FormEntryController.EVENT_PROMPT_NEW_REPEAT;
} else if (repeatStructure == REPEAT_STRUCTURE_NON_LINEAR && index.getElementMultiplicity() == TreeReference.INDEX_REPEAT_JUNCTURE) {
return FormEntryController.EVENT_REPEAT_JUNCTURE;
} else {
return FormEntryController.EVENT_REPEAT;
}
} else {
return FormEntryController.EVENT_GROUP;
}
} else {
return FormEntryController.EVENT_QUESTION;
}
}
示例8: incrementIndex
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public FormIndex incrementIndex(FormIndex index, boolean descend) {
Vector<Integer> indexes = new Vector<>();
Vector<Integer> multiplicities = new Vector<>();
Vector<IFormElement> elements = new Vector<>();
if (index.isEndOfFormIndex()) {
return index;
} else if (index.isBeginningOfFormIndex()) {
if (form.getChildren() == null || form.getChildren().size() == 0) {
return FormIndex.createEndOfFormIndex();
}
} else {
form.collapseIndex(index, indexes, multiplicities, elements);
}
incrementHelper(indexes, multiplicities, elements, descend);
if (indexes.size() == 0) {
return FormIndex.createEndOfFormIndex();
} else {
return form.buildIndex(indexes, multiplicities, elements);
}
}
示例9: decrementIndex
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public FormIndex decrementIndex(FormIndex index) {
Vector<Integer> indexes = new Vector<>();
Vector<Integer> multiplicities = new Vector<>();
Vector<IFormElement> elements = new Vector<>();
if (index.isBeginningOfFormIndex()) {
return index;
} else if (index.isEndOfFormIndex()) {
if (form.getChildren() == null || form.getChildren().size() == 0) {
return FormIndex.createBeginningOfFormIndex();
}
} else {
form.collapseIndex(index, indexes, multiplicities, elements);
}
decrementHelper(indexes, multiplicities, elements);
if (indexes.size() == 0) {
return FormIndex.createBeginningOfFormIndex();
} else {
return form.buildIndex(indexes, multiplicities, elements);
}
}
示例10: getEvent
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
/**
* Given a FormIndex, returns the event this FormIndex represents.
*
* @see FormEntryController
*/
public int getEvent(FormIndex index) {
if (index.isBeginningOfFormIndex()) {
return FormEntryController.EVENT_BEGINNING_OF_FORM;
} else if (index.isEndOfFormIndex()) {
return FormEntryController.EVENT_END_OF_FORM;
}
// This came from chatterbox, and is unclear how correct it is,
// commented out for now.
// DELETEME: If things work fine
// List defs = form.explodeIndex(index);
// IFormElement last = (defs.size() == 0 ? null : (IFormElement)
// defs.lastElement());
IFormElement element = form.getChild(index);
if (element instanceof GroupDef) {
if (((GroupDef) element).getRepeat()) {
if (repeatStructure != REPEAT_STRUCTURE_NON_LINEAR && form.getMainInstance().resolveReference(form.getChildInstanceRef(index)) == null) {
return FormEntryController.EVENT_PROMPT_NEW_REPEAT;
} else if (repeatStructure == REPEAT_STRUCTURE_NON_LINEAR && index.getElementMultiplicity() == TreeReference.INDEX_REPEAT_JUNCTURE) {
return FormEntryController.EVENT_REPEAT_JUNCTURE;
} else {
return FormEntryController.EVENT_REPEAT;
}
} else {
return FormEntryController.EVENT_GROUP;
}
} else {
return FormEntryController.EVENT_QUESTION;
}
}
示例11: getEvent
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
/**
* Given a FormIndex, returns the event this FormIndex represents.
*
* @see FormEntryController
*/
public int getEvent(FormIndex index) {
if (index.isBeginningOfFormIndex()) {
return FormEntryController.EVENT_BEGINNING_OF_FORM;
} else if (index.isEndOfFormIndex()) {
return FormEntryController.EVENT_END_OF_FORM;
}
// This came from chatterbox, and is unclear how correct it is,
// commented out for now.
// DELETEME: If things work fine
// Vector defs = form.explodeIndex(index);
// IFormElement last = (defs.size() == 0 ? null : (IFormElement)
// defs.lastElement());
IFormElement element = form.getChild(index);
if (element instanceof GroupDef) {
if (((GroupDef)element).getRepeat()) {
if (repeatStructure != REPEAT_STRUCTURE_NON_LINEAR && form.getMainInstance().resolveReference(form.getChildInstanceRef(index)) == null) {
return FormEntryController.EVENT_PROMPT_NEW_REPEAT;
} else if (repeatStructure == REPEAT_STRUCTURE_NON_LINEAR && index.getElementMultiplicity() == TreeReference.INDEX_REPEAT_JUNCTURE) {
return FormEntryController.EVENT_REPEAT_JUNCTURE;
} else {
return FormEntryController.EVENT_REPEAT;
}
} else {
return FormEntryController.EVENT_GROUP;
}
} else {
return FormEntryController.EVENT_QUESTION;
}
}
示例12: checkModel
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
private void checkModel(FormEntryModel model, StringBuilder fieldErrors)
{
FormIndex index = model.getFormIndex();
while(!index.isEndOfFormIndex())
{
int event = model.getEvent(index);
if(event != FormEntryController.EVENT_QUESTION)
{
index = model.incrementIndex(index);
continue;
}
FormEntryPrompt prompt = model.getQuestionPrompt(index);
final int dataType = prompt.getDataType();
switch(dataType)
{
case org.javarosa.core.model.Constants.DATATYPE_TEXT:
case org.javarosa.core.model.Constants.DATATYPE_DATE:
case org.javarosa.core.model.Constants.DATATYPE_CHOICE:
case org.javarosa.core.model.Constants.DATATYPE_INTEGER:
case org.javarosa.core.model.Constants.DATATYPE_DECIMAL:
case org.javarosa.core.model.Constants.DATATYPE_LONG:
case org.javarosa.core.model.Constants.DATATYPE_TIME:
case org.javarosa.core.model.Constants.DATATYPE_BOOLEAN:
break;
//Unsupported DataType's below
case org.javarosa.core.model.Constants.DATATYPE_BARCODE:
addFieldTypeNotSupported("BARCODE", fieldErrors, prompt);
break;
case org.javarosa.core.model.Constants.DATATYPE_BINARY:
addFieldTypeNotSupported("BINARY", fieldErrors, prompt);
break;
case org.javarosa.core.model.Constants.DATATYPE_CHOICE_LIST:
addFieldTypeNotSupported("CHOICE_LIST", fieldErrors, prompt);
break;
case org.javarosa.core.model.Constants.DATATYPE_DATE_TIME:
addFieldTypeNotSupported("DATE_TIME", fieldErrors, prompt);
break;
case org.javarosa.core.model.Constants.DATATYPE_GEOPOINT:
addFieldTypeNotSupported("GEOPOINT", fieldErrors, prompt);
break;
case org.javarosa.core.model.Constants.DATATYPE_GEOSHAPE:
addFieldTypeNotSupported("GEOSHAPE", fieldErrors, prompt);
break;
case org.javarosa.core.model.Constants.DATATYPE_GEOTRACE:
addFieldTypeNotSupported("GEOTRACE", fieldErrors, prompt);
break;
case org.javarosa.core.model.Constants.DATATYPE_NULL:
addFieldTypeNotSupported("NULL", fieldErrors, prompt);
break;
case org.javarosa.core.model.Constants.DATATYPE_UNSUPPORTED:
addFieldTypeNotSupported("UNSUPPORTED", fieldErrors, prompt);
break;
default:
addFieldTypeNotSupported("UNKNOWN", fieldErrors, prompt);
break;
}
index = model.incrementIndex(index);
}
}
示例13: populateEntries
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
private void populateEntries() {
Vector<Entry> entriesVec = new Vector<Entry>();
FormIndex index = FormIndex.createBeginningOfFormIndex();
FormDef form = model.getForm();
int prevDepth = 0;
while (!index.isEndOfFormIndex()) {
if (index.isInForm() && model.isIndexRelevant(index)) {
String text = "";
boolean isHeader = false;
Image img = null;
if (model.getEvent(index) == FormEntryController.EVENT_QUESTION) {
FormEntryPrompt prompt = model.getQuestionPrompt(index);
text = getText(prompt);
} else if (model.getEvent(index) == FormEntryController.EVENT_PROMPT_NEW_REPEAT) {
FormEntryCaption[] hierachy = model.getCaptionHierarchy(index);
text = "Add "
+ (index.getElementMultiplicity() == 0 ? "a "
: "another ")
+ hierachy[hierachy.length - 1].getLongText() + "?";
try {
img = Image.createImage(Localization.get("plussign"));
} catch (IOException ioe) {
img = null;
Logger.exception(ioe);
}
} else if ((model.getEvent(index) == FormEntryController.EVENT_GROUP)
|| (model.getEvent(index) == FormEntryController.EVENT_REPEAT)) {
text = getHeaderText(model.getCaptionHierarchy(index));
isHeader = true;
}
if (!text.equals("")) {
Style style = isHeader ? StyleSheet
.getStyle(Constants.STYLE_HEADER) : StyleSheet
.getStyle(Constants.STYLE_PROMPT);
String spacer="";
int i = isHeader?-1:0;
while (i < index.getDepth() - 2) {
//ctsims : Huh?
//spacer = "――" + spacer;
spacer = "> > " + spacer;
i++;
}
text=img==null?spacer+text:text;
entriesVec.addElement(new Entry(text, img, style, index));
}
}
prevDepth = index.getDepth();
index = model.incrementIndex(index);
}
entries = new Entry[entriesVec.size()];
entriesVec.copyInto(entries);
}