Package org.araneaframework.uilib.support

Examples of org.araneaframework.uilib.support.DisplayItem


      Set previousDisabledValues = new HashSet(Arrays.asList((Object[]) innerData));           
      Set currentValues = new HashSet(parameterValues == null ? new ArrayList() : Arrays.asList(parameterValues));
      Set disabledItemValues = new HashSet();
     
      for (Iterator i = items.iterator(); i.hasNext();) {
        DisplayItem item = (DisplayItem) i.next();
        if (item.isDisabled()) disabledItemValues.add(item.getValue());
      }
     
      previousDisabledValues.retainAll(disabledItemValues);           
      currentValues.addAll(previousDisabledValues);
     
View Full Code Here


     */   
    public ViewModel() {
      this.selectItems = items;
     
      for (Iterator i = selectItems.iterator(); i.hasNext(); ) {
        DisplayItem displayItem = (DisplayItem) i.next();
        selectItemMap.put(displayItem.getValue(), displayItem);
      }

      String[] values = getValues();
      if (values != null) {   
        for(int i = 0; i < values.length; i++)
View Full Code Here

    if (valueObjects.size() == 0) return;
    BeanMapper beanMapper = new BeanMapper(valueObjects.iterator().next().getClass());

    for (Iterator i = valueObjects.iterator(); i.hasNext();) {
      Object vo = i.next();
      displayItems.addItem(new DisplayItem(beanMapper.getBeanFieldValue(vo, valueName).toString(), beanMapper.getBeanFieldValue(vo,
          displayStringName).toString()));
    }
  }
View Full Code Here

   * @param value the value that is controlled.
   * @return whether <code>value</code> is found in the select items.
   */
  public static boolean isValueInItems(Collection displayItems, String value) {
    for (Iterator i = displayItems.iterator(); i.hasNext(); ) {
      DisplayItem currentItem = (DisplayItem) i.next();
      String currentValue = currentItem.getValue();
      if (value == null && currentValue == null && !currentItem.isDisabled())
        return true;     
      if (value != null && value.equals(currentValue) && !currentItem.isDisabled())
        return true;
    }
    return false;
  }
View Full Code Here

   * @param value display item value.
   * @return display item label by the specified value.
   */
  public static String getLabelForValue(Collection displayItems, String value) {
    for (Iterator i = displayItems.iterator(); i.hasNext(); ) {
      DisplayItem item = (DisplayItem)i.next();
      String currentValue = item.getValue();
      if (value == null && currentValue == null)
        return item.getDisplayString();
      if (value != null && value.equals(currentValue))
        return item.getDisplayString();
    }
    return "";
  }
View Full Code Here

   * @param value display item value.
   * @return display item index by the specified value.
   */
  public static int getValueIndex(List displayItems, String value) {
    for (ListIterator i = displayItems.listIterator(); i.hasNext(); ) {
      DisplayItem item = (DisplayItem) i.next();
      if ((value == null && item.getValue() == null) ||
          value != null && item.getValue() != null && value.equals(item.getValue())) {
        return i.previousIndex();
      }
    }
   
    return -1;
View Full Code Here

   
    if (previousValues != null && previousValues.length == 1) {
      int valueIndex = getValueIndex(previousValues[0]);
     
      if (valueIndex != -1) {
        DisplayItem previousDisplayItem = (DisplayItem) getDisplayItems().get(valueIndex);
       
        if (previousDisplayItem.isDisabled() && parameterValue == null)
          return previousDisplayItem.getValue();
      }
    }
   
    return parameterValue;
  }
View Full Code Here

     */   
    public ViewModel() {
      this.selectItems = items;
     
      for (Iterator i = selectItems.iterator(); i.hasNext(); ) {
        DisplayItem displayItem = (DisplayItem) i.next();
        selectItemMap.put(displayItem.getValue(), displayItem);
      }     
                
    }        
View Full Code Here

   
    // Write items
    String selectedValue = viewModel.getSimpleValue();
   
    for(Iterator i = viewModel.getSelectItems().iterator(); i.hasNext();) {
      DisplayItem item = (DisplayItem)i.next();
      if (!item.isDisabled()) {
        String value = item.getValue();
        String label = item.getDisplayString();
       
        UiUtil.writeOpenStartTag(out, "option");     
        UiUtil.writeAttribute(out, "value", value != null ? value : "");
        if ((value == null && selectedValue == null) ||             
            (value != null && value.equals(selectedValue)))
View Full Code Here

    hierarchyTest.addElement("myTextarea", "my text area", new TextareaControl(), new StringData(), true);

    //Filling in select control (which is under a composite element)
    FormElement mySelectElement = hierarchyTest.addElement("mySelect", "my drop down", new SelectControl(), new LongData(), true);
    SelectControl mySelect = (SelectControl) mySelectElement.getControl();
    mySelect.addItem(new DisplayItem("1", "one"));
    mySelect.addItem(new DisplayItem("2", "two"));
    mySelect.addItem(new DisplayItem("3", "three"));
    mySelect.addItem(new DisplayItem("4", "four"));

    return testForm;
  }
View Full Code Here

TOP

Related Classes of org.araneaframework.uilib.support.DisplayItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.