本文整理汇总了Java中org.javarosa.core.model.FormIndex.createBeginningOfFormIndex方法的典型用法代码示例。如果您正苦于以下问题:Java FormIndex.createBeginningOfFormIndex方法的具体用法?Java FormIndex.createBeginningOfFormIndex怎么用?Java FormIndex.createBeginningOfFormIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.javarosa.core.model.FormIndex
的用法示例。
在下文中一共展示了FormIndex.createBeginningOfFormIndex方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FormEntryModel
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
/**
* Creates a new entry model for the form with the appropriate
* repeat structure
*
* @param form
* @param repeatStructure The structure of repeats (the repeat signals which should
* be sent during form entry)
* @throws IllegalArgumentException If repeatStructure is not valid
*/
public FormEntryModel(FormDef form, int repeatStructure) {
this.form = form;
if(repeatStructure != REPEAT_STRUCTURE_LINEAR && repeatStructure != REPEAT_STRUCTURE_NON_LINEAR) {
throw new IllegalArgumentException(repeatStructure +": does not correspond to a valid repeat structure");
}
//We need to see if there are any guessed repeat counts in the form, which prevents
//us from being able to use the new repeat style
//Unfortunately this is probably (A) slow and (B) might overflow the stack. It's not the only
//recursive walk of the form, though, so (B) isn't really relevant
if(repeatStructure == REPEAT_STRUCTURE_NON_LINEAR && containsRepeatGuesses(form)) {
repeatStructure = REPEAT_STRUCTURE_LINEAR;
}
this.repeatStructure = repeatStructure;
this.currentFormIndex = FormIndex.createBeginningOfFormIndex();
}
示例2: 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);
}
}
示例3: FormEntryModel
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
/**
* Creates a new entry model for the form with the appropriate
* repeat structure
*
* @param repeatStructure The structure of repeats (the repeat signals which should
* be sent during form entry)
* @throws IllegalArgumentException If repeatStructure is not valid
*/
public FormEntryModel(FormDef form, int repeatStructure) {
this.form = form;
if (repeatStructure != REPEAT_STRUCTURE_LINEAR && repeatStructure != REPEAT_STRUCTURE_NON_LINEAR) {
throw new IllegalArgumentException(repeatStructure + ": does not correspond to a valid repeat structure");
}
//We need to see if there are any guessed repeat counts in the form, which prevents
//us from being able to use the new repeat style
//Unfortunately this is probably (A) slow and (B) might overflow the stack. It's not the only
//recursive walk of the form, though, so (B) isn't really relevant
if (repeatStructure == REPEAT_STRUCTURE_NON_LINEAR && containsRepeatGuesses(form)) {
repeatStructure = REPEAT_STRUCTURE_LINEAR;
}
this.repeatStructure = repeatStructure;
this.currentFormIndex = FormIndex.createBeginningOfFormIndex();
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: getIndexFromXPath
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public FormIndex getIndexFromXPath(String xPath) {
if ( xPath.equals("beginningOfForm") ) {
return FormIndex.createBeginningOfFormIndex();
} else if ( xPath.equals("endOfForm") ) {
return FormIndex.createEndOfFormIndex();
} else if ( xPath.equals("unexpected") ) {
Log.e(t, "Unexpected string from XPath");
throw new IllegalArgumentException("unexpected string from XPath");
} else {
FormIndex returned = null;
FormIndex saved = getFormIndex();
// the only way I know how to do this is to step through the entire form
// until the XPath of a form entry matches that of the supplied XPath
try {
jumpToIndex(FormIndex.createBeginningOfFormIndex());
int event = stepToNextEvent(true);
while ( event != FormEntryController.EVENT_END_OF_FORM ) {
String candidateXPath = getXPath(getFormIndex());
// Log.i(t, "xpath: " + candidateXPath);
if ( candidateXPath.equals(xPath) ) {
returned = getFormIndex();
break;
}
event = stepToNextEvent(true);
}
} finally {
jumpToIndex(saved);
}
return returned;
}
}
示例7: Chatterbox
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public Chatterbox (String formTitle, JrFormEntryController controller) {
//#style framedForm
super(formTitle);
this.controller = controller;
this.model = controller.getModel();
if (model.isReadOnlyMode()) {
//#style ReviewFramedForm
UiAccess.setStyle(this);
}
//22 Jan, 2009 - [email protected]
//This constructor code supresses the ability to scroll the chatterbox by dragging the mouse
//pointer. This "Feature" was causing tons of problems for our nurses. Let me know if anyone else
//wants to make this a customizable inclusion.
this.container = new Container(false) {
protected boolean handlePointerScrollReleased(int relX, int relY) {
return false;
}
};
multiLingual = (model.getForm().getLocalizer() != null);
questionIndexes = new SortedIndexSet();
activeQuestionIndex = FormIndex.createBeginningOfFormIndex(); //null is not allowed
//#if device.identifier == Sony-Ericsson/P1i
KEY_CENTER_LETS_HOPE = 13;
//#endif
//#if device.identifier == Sony-Ericsson/K610i
POUND_KEYCODE = Canvas.KEY_STAR;
//#endif
if(FormManagerProperties.EXTRA_KEY_AUDIO_PLAYBACK.equals(controller.getExtraKeyMode())){
USE_HASH_FOR_AUDIO = true;
}else{
USE_HASH_FOR_AUDIO = false;
}
}
示例8: getIndexFromXPath
import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public FormIndex getIndexFromXPath(String xPath) {
if ( xPath.equals("beginningOfForm") ) {
return FormIndex.createBeginningOfFormIndex();
} else if ( xPath.equals("endOfForm") ) {
return FormIndex.createEndOfFormIndex();
} else if ( xPath.equals("unexpected") ) {
System.err.printf(t, "Unexpected string from XPath");
throw new IllegalArgumentException("unexpected string from XPath");
} else {
FormIndex returned = null;
FormIndex saved = getFormIndex();
// the only way I know how to do this is to step through the entire form
// until the XPath of a form entry matches that of the supplied XPath
try {
jumpToIndex(FormIndex.createBeginningOfFormIndex());
int event = stepToNextEvent(true);
while ( event != FormEntryController.EVENT_END_OF_FORM ) {
String candidateXPath = getXPath(getFormIndex());
// Log.i(t, "xpath: " + candidateXPath);
if ( candidateXPath.equals(xPath) ) {
returned = getFormIndex();
break;
}
event = stepToNextEvent(true);
}
} finally {
jumpToIndex(saved);
}
return returned;
}
}
示例9: 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);
}