当前位置: 首页>>代码示例>>Java>>正文


Java FormEntryCaption.getLongText方法代码示例

本文整理汇总了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;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:20,代码来源:FormSummaryView.java

示例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);
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:23,代码来源:Chatterbox.java

示例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);
    }
}
 
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:31,代码来源:ODKView.java

示例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));
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:31,代码来源:ChatterboxWidgetFactory.java

示例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;
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:37,代码来源:QuestionsView.java

示例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);
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:13,代码来源:FormHierarchyBuilder.java

示例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);
    }
}
 
开发者ID:sages-health,项目名称:sagesmobile-mCollect,代码行数:31,代码来源:ODKView.java

示例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;
    }
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:51,代码来源:SingleQuestionView.java


注:本文中的org.javarosa.form.api.FormEntryCaption.getLongText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。