Package nu.fw.jeti.jabber.elements

Examples of nu.fw.jeti.jabber.elements.XDataBuilder


    panel.add(lbl, c);
  }
 
  private void sendForm(XDataCallback callback)
  {
    XDataBuilder builder = new XDataBuilder();
    builder.type ="submit";
    for (Iterator iter = fields.iterator(); iter.hasNext();)
    {
      Object element = iter.next();
      String var = null;
      String value = null;
      if(element instanceof Object[])
      {
        var =(String)((Object[])element)[0];
        value =(String)((Object[])element)[1];
        if(value != null)
        {
          builder.addField(new XDataField(var,value));
        }
      }
      else
      {
        JComponent component = (JComponent)element;
        var = component.getName();
        if(component instanceof JCheckBox)
        {
            value = String.valueOf(((JCheckBox)component).isSelected()?1:0)
        }
        else if(component instanceof JTextComponent)
        {
          value = ((JTextComponent)component).getText();
        }
        else if(component instanceof JComboBox)
        {
          value =((LabelValue)((JComboBox)component).getSelectedItem()).value;
        }
        if(value != null)
        {
          builder.addField(new XDataField(var,value));
        }
        if(component instanceof JList)
        {
          JList list = ((JList)component);
          if (!list.isSelectionEmpty())
          {
            Object[] values = list.getSelectedValues();
            for (int i = 0; i < values.length; i++)
            {
              builder.addField(new XDataField(var,((LabelValue)values[i]).value));
            }
          }
         }
      }
    }
    try
    {
      callback.sendForm(builder.build());
    }
    catch (InstantiationException e)
    {
      e.printStackTrace();
    }
View Full Code Here


  private boolean reported;
  private List items;
 
  public XDataHandler()
  {
    builder = new XDataBuilder();
    fieldBuilder = new XDataFieldBuilder();
  }
View Full Code Here

        setLocationRelativeTo(null);

        progressBar.setMaximum((int)(file.length()/1024));

        id = "file"+backend.getIdentifier();
        XDataBuilder xdb = new XDataBuilder();
        xdb.type ="form";
        XDataFieldBuilder xdfb = new XDataFieldBuilder();
        xdfb.var="stream-method";
        xdfb.type="list-single";
        if (Preferences.getBoolean("filetransfer","bytestreams.enable",true)) {
            xdfb.addOption("http://jabber.org/protocol/bytestreams");
        }
        if (Preferences.getBoolean("filetransfer", "ibb.enable", true)) {
            xdfb.addOption("http://jabber.org/protocol/ibb");
        }
        xdb.addField(xdfb.build());
        XData xdata=null;
        try {
            xdata = xdb.build();
        } catch (InstantiationException e1) {
            e1.printStackTrace();
        }
        IQSi si = new IQSi(
            id, "http://jabber.org/protocol/si/profile/file-transfer",null,
View Full Code Here

TOP

Related Classes of nu.fw.jeti.jabber.elements.XDataBuilder

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.