String text = ""; for (Model model : mModelList) { if (model.isSelected()) { text += model.getText(); } } Log.d("TAG","Output : " + text);
/** * Returns a <code>LabelMap</code> that contains the details for * all fields and methods marked with XML annotations. All of the * attribute annotations are considered and gathered by name in * this map. Also, if there is an associated <code>Style</code> * for serialization the attribute names are renamed with this. * * @return returns the attributes associated with this section */ public LabelMap getAttributes() throws Exception { if(attributes == null) { attributes = model.getAttributes(); } return attributes; }
/** * Returns a <code>LabelMap</code> that contains the details for * all fields and methods marked with XML annotations. All of the * element annotations are considered and gathered by name in * this map. Also, if there is an associated <code>Style</code> * for serialization the element names are renamed with this. * * @return returns the elements associated with this section */ public LabelMap getElements() throws Exception { if(elements == null) { elements = model.getElements(); } return elements; }
/** * This is used to validate the configuration of the scanned class. * If a <code>Text</code> annotation has been used with elements * then validation will fail and an exception will be thrown. * * @param type this is the object type that is being scanned */ private void validateText(Class type) throws Exception { Label label = root.getText(); if(label != null) { if(!label.isTextList()) { if(!elements.isEmpty()) { throw new TextException("Elements used with %s in %s", label, type); } if(root.isComposite()) { throw new TextException("Paths used with %s in %s", label, type); } } } else { if(scanner.isEmpty()) { primitive = isEmpty(); } } }
public void onBindViewHolder(final MyViewHolder holder, int position) { final Model model = mModelList.get(position); holder.textView.setText(model.getText()); holder.view.setBackgroundColor(model.isSelected() ? Color.CYAN : Color.WHITE); holder.textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { model.setSelected(!model.isSelected()); holder.view.setBackgroundColor(model.isSelected() ? Color.CYAN : Color.WHITE);
/** * This is used to acquire the text label for this section if * one has been specified. A text label can only exist in a * section if there are no elements associated with the section * and the section is not composite, as in it does not contain * any further sections. * * @return this returns the text label for this section */ public Label getText() throws Exception { return model.getText(); }
/** * This is used to acquire the full attribute path for this * section. The attribute path is simply the fully qualified * path for this expression with the provided name appended. * If this is an empty path, the provided name is returned. * * @param name this is the name of the attribute to be used * * @return a fully qualified path for the specified name */ public String getAttribute(String name) throws Exception { Expression path = model.getExpression(); if(path == null) { return name; } return path.getAttribute(name); }
public ViewHolder(final View itemView) { super(itemView); context = itemView.getContext(); tvText = (TextView) itemView.findViewById(R.id.tvText); } public void bind(final Model model) { tvText.setText(model.getText()); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Context context = itemView.getContext(); Intent intent = new Intent(context, model.getLaunchClass()); context.startActivity(intent); } }); }
/** * This is used to return the name of the section. The name is * must be a valid XML element name. It is used when a style * is applied to a path as the section name must be styled. * * @return this returns the name of this section instance */ public String getName() { return model.getName(); }
/** * This is used to acquire the path prefix for the section. The * path prefix is used when the section is transformed in to an * XML structure. This ensures that the XML element created to * represent the section contains the optional prefix. * * @return this returns the prefix for this section */ public String getPrefix() { return model.getPrefix(); }
/** * Returns a <code>LabelMap</code> that contains the details for * all fields and methods marked with XML annotations. All of the * attribute annotations are considered and gathered by name in * this map. Also, if there is an associated <code>Style</code> * for serialization the attribute names are renamed with this. * * @return returns the attributes associated with this section */ public ModelMap getModels() throws Exception { if(models == null) { models = model.getModels(); } return models; }
/** * This is used to register the model within the list. The model * is registered at the index provided. If the registration is * out of sequence all indexes that do not have models are * populated with null values to ensure each model resides in * its index position within the list. * * @param model the model to be registered within the list */ public void register(Model model) { int index = model.getIndex(); int size = size(); for(int i = 0; i < index; i++) { if(i >= size) { add(null); } if(i == index -1) { set(index-1, model); } } }
/** * This is used to determine if the specified XPath expression * represents an attribute within the root model. This returns * true if the specified path exists as either an attribute. * * @param path this is the path to search for the attribute * * @return this returns true if the attribute exists */ private boolean isAttribute(String path) throws Exception { Expression target = builder.build(path); Model model = lookup(target); if(model != null) { String name = target.getLast(); if(!target.isPath()) { return model.isAttribute(path); } return model.isAttribute(name); } return false; }
/** * This is used to validate the configuration of the scanned class. * If a <code>Text</code> annotation has been used with elements * then validation will fail and an exception will be thrown. * * @param type this is the object type that is being scanned */ private void validateText(Class type) throws Exception { Label label = root.getText(); if(label != null) { if(!label.isTextList()) { if(!elements.isEmpty()) { throw new TextException("Elements used with %s in %s", label, type); } if(root.isComposite()) { throw new TextException("Paths used with %s in %s", label, type); } } } else { if(scanner.isEmpty()) { primitive = isEmpty(); } } }
/** * This is used to acquire the text label for this section if * one has been specified. A text label can only exist in a * section if there are no elements associated with the section * and the section is not composite, as in it does not contain * any further sections. * * @return this returns the text label for this section */ public Label getText() throws Exception { return model.getText(); }
/** * This is used to acquire the full attribute path for this * section. The attribute path is simply the fully qualified * path for this expression with the provided name appended. * If this is an empty path, the provided name is returned. * * @param name this is the name of the attribute to be used * * @return a fully qualified path for the specified name */ public String getAttribute(String name) throws Exception { Expression path = model.getExpression(); if(path == null) { return name; } return path.getAttribute(name); }
/** * This is used to return the name of the section. The name is * must be a valid XML element name. It is used when a style * is applied to a path as the section name must be styled. * * @return this returns the name of this section instance */ public String getName() { return model.getName(); }
/** * This is used to acquire the path prefix for the section. The * path prefix is used when the section is transformed in to an * XML structure. This ensures that the XML element created to * represent the section contains the optional prefix. * * @return this returns the prefix for this section */ public String getPrefix() { return model.getPrefix(); }