本文整理汇总了Java中org.javarosa.form.api.FormEntryCaption.getLongText方法的典型用法代码示例。如果您正苦于以下问题:Java FormEntryCaption.getLongText方法的具体用法?Java FormEntryCaption.getLongText怎么用?Java FormEntryCaption.getLongText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.javarosa.form.api.FormEntryCaption
的用法示例。
在下文中一共展示了FormEntryCaption.getLongText方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHeaderText
import org.javarosa.form.api.FormEntryCaption; //导入方法依赖的package包/类
private String getHeaderText(FormEntryCaption[] hierachy) {
String headertext = "";
for (FormEntryCaption caption : hierachy) {
String c = caption.getLongText();
if(c != null) {
headertext += c;
if (caption.getIndex().getInstanceIndex() > -1) {
headertext += " " + (caption.getMultiplicity() + 1);
}
headertext += ": ";
}
}
if (headertext.endsWith(": "))
headertext = headertext.substring(0, headertext.length() - 2);
return headertext;
}
示例2: createHeaderForElement
import org.javarosa.form.api.FormEntryCaption; //导入方法依赖的package包/类
private void createHeaderForElement(FormIndex questionIndex, boolean newRepeat) {
FormEntryCaption prompt = model.getCaptionPrompt(questionIndex);
String headerText; //decide what text form to use.
boolean isNew = uncommittedRepeats.contains(model.decrementIndex(questionIndex)); //this is ghetto
headerText = prompt.getRepetitionText(isNew); //droos: this doesn't feel right... should this if/else be wrapped up in the caption?
if (headerText == null)
headerText = prompt.getLongText();
if(headerText != null) {
if (newRepeat) {
removeFrame(activeQuestionIndex);
}
ChatterboxWidget headerWidget = widgetFactory.getNewLabelWidget(questionIndex, headerText);
//If there is no valid header, there's no valid header. Possibly no label.
this.append(headerWidget);
this.questionIndexes.add(questionIndex);
headerWidget.setPinned(true);
}
}
示例3: addGroupText
import org.javarosa.form.api.FormEntryCaption; //导入方法依赖的package包/类
/**
* // * Add a TextView containing the hierarchy of groups to which the question belongs. //
*/
private void addGroupText(FormEntryCaption[] groups) {
StringBuilder s = new StringBuilder("");
String t = "";
int i;
// list all groups in one string
for (FormEntryCaption g : groups) {
i = g.getMultiplicity() + 1;
t = g.getLongText();
if (t != null) {
s.append(t);
if (g.repeats() && i > 0) {
s.append(" (" + i + ")");
}
s.append(" > ");
}
}
// build view
if (s.length() > 0) {
TextView tv = new TextView(getContext());
tv.setText(s.substring(0, s.length() - 3));
int questionFontsize = Collect.getQuestionFontsize();
tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, questionFontsize - 4);
tv.setPadding(0, 0, 0, 5);
mView.addView(tv, mLayout);
}
}
示例4: getNewRepeatWidget
import org.javarosa.form.api.FormEntryCaption; //导入方法依赖的package包/类
public ChatterboxWidget getNewRepeatWidget (FormIndex index, FormEntryModel model, Chatterbox cbox) {
//GroupDef repeat = (GroupDef)f.explodeIndex(index).lastElement();
//damn linked lists...
FormIndex end = index;
while (!end.isTerminal()) {
end = end.getNextLevel();
}
int multiplicity = end.getInstanceIndex();
FormEntryCaption p = model.getCaptionPrompt(index);
String label; //decide what text form to use.
label = p.getLongText();
if(label == null){
label = p.getShortText();
}
String labelInner = (label == null || label.length() == 0 ? Localization.get("repeat.repitition") : label);
String promptLabel = Localization.get((multiplicity > 0 ? "repeat.message.multiple" : "repeat.message.single"), new String[] {labelInner});
FakedFormEntryPrompt prompt = new FakedFormEntryPrompt(promptLabel,
Constants.CONTROL_SELECT_ONE, Constants.DATATYPE_TEXT);
prompt.addSelectChoice(new SelectChoice(null,Localization.get("yes"), "y", false));
prompt.addSelectChoice(new SelectChoice(null,Localization.get("no"), "n", false));
return new ChatterboxWidget(cbox, prompt, ChatterboxWidget.VIEW_EXPANDED, new CollapsedWidget(), new SelectOneEntryWidget(ChoiceGroup.EXCLUSIVE));
}
示例5: deriveGroupText
import org.javarosa.form.api.FormEntryCaption; //导入方法依赖的package包/类
/**
* Returns the hierarchy of groups to which the question belongs.
*/
private SpannableStringBuilder deriveGroupText(FormEntryCaption[] groups) {
SpannableStringBuilder s = new SpannableStringBuilder("");
String t;
String m;
int i;
// list all groups in one string
for (FormEntryCaption g : groups) {
i = g.getMultiplicity() + 1;
t = g.getLongText();
m = g.getMarkdownText();
if (m != null) {
Spannable markdownSpannable = MarkupUtil.returnMarkdown(getContext(), m);
s.append(markdownSpannable);
} else if (t != null && !t.trim().equals("")) {
s.append(t);
} else {
continue;
}
if (g.repeats() && i > 0) {
s.append(" (").append(String.valueOf(i)).append(")");
}
s.append(" > ");
}
//remove the trailing " > "
if (s.length() > 0) {
s.delete(s.length() - 2, s.length());
}
return s;
}
示例6: addRepeatHeading
import org.javarosa.form.api.FormEntryCaption; //导入方法依赖的package包/类
private void addRepeatHeading() {
FormEntryCaption fc = FormEntryActivity.mFormController.getCaptionPrompt();
if (fc.getMultiplicity() == 0) {
// Only add the heading if it is the repeat group entry, not an element in the group.
HierarchyElement group =
new HierarchyElement(context, fc.getLongText(), null,
context.getResources().getDrawable(R.drawable.expander_ic_minimized),
false,
HierarchyEntryType.collapsed, fc.getIndex());
formList.add(group);
}
}
示例7: addGroupText
import org.javarosa.form.api.FormEntryCaption; //导入方法依赖的package包/类
/**
* // * Add a TextView containing the hierarchy of groups to which the question belongs. //
*/
private void addGroupText(FormEntryCaption[] groups) {
StringBuffer s = new StringBuffer("");
String t = "";
int i;
// list all groups in one string
for (FormEntryCaption g : groups) {
i = g.getMultiplicity() + 1;
t = g.getLongText();
if (t != null) {
s.append(t);
if (g.repeats() && i > 0) {
s.append(" (" + i + ")");
}
s.append(" > ");
}
}
// build view
if (s.length() > 0) {
TextView tv = new TextView(getContext());
tv.setText(s.substring(0, s.length() - 3));
int questionFontsize = Collect.getQuestionFontsize();
tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, questionFontsize - 4);
tv.setPadding(0, 0, 0, 5);
mView.addView(tv, mLayout);
}
}
示例8: getView
import org.javarosa.form.api.FormEntryCaption; //导入方法依赖的package包/类
public SingleQuestionScreen getView(FormEntryPrompt prompt, boolean fromFormView) {
FormEntryCaption[] captionHierarchy = model.getCaptionHierarchy(prompt.getIndex());
String groupTitle = "";
if (captionHierarchy.length > 1) {
int captionCount = 0;
for (int i = 0 ; i < captionHierarchy.length -1 ; ++i) {
FormEntryCaption caption = captionHierarchy[i];
captionCount++;
String captionText = caption.getLongText();
if(captionText != null) {
if(caption.repeats()) {
groupTitle += caption.getRepetitionText(false);
} else {
groupTitle += caption.getLongText();
}
groupTitle += ": ";
}
}
if (groupTitle.endsWith(": ")) {
groupTitle = groupTitle.substring(0, groupTitle.length() - 2);
}
}
String shortPrompt = prompt.getSpecialFormQuestionText(FormEntryCaption.TEXT_FORM_SHORT);
if(shortPrompt != null ){
if(groupTitle != "") {
groupTitle += ": " +shortPrompt;
} else {
groupTitle += shortPrompt;
}
}
if(groupTitle == "") {
groupTitle = backupTitle;
}
currentQuestionScreen = factory.getQuestionScreen(prompt, groupTitle, fromFormView, goingForward);
if (model.getLanguages() != null && model.getLanguages().length > 0) {
currentQuestionScreen.addLanguageCommands(model.getLanguages());
}
if(currentGuess != -1 && controller.isEntryOptimized()) {
currentQuestionScreen.configureProgressBar(currentGuess,numQuestions);
}
currentQuestionScreen.setCommandListener(this);
return currentQuestionScreen;
}