PageRenderTime 39ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/bundles/plugins-trunk/Console/console/bsh/commandoCHOICE.bsh

#
Unknown | 26 lines | 23 code | 3 blank | 0 comment | 0 complexity | 98e2903307441073b73610605841a6d9 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. commandoCHOICE(view,pane,ns,label,var,options)
  2. {
  3. choice = new JComboBox(options);
  4. value = ns.getVariable(var);
  5. if(value != null)
  6. {
  7. for(int i = 0; i < options.size(); i++)
  8. {
  9. opt = options.elementAt(i);
  10. if(value.equals(opt.value))
  11. {
  12. choice.setSelectedIndex(i);
  13. break;
  14. }
  15. }
  16. }
  17. valueChanged()
  18. {
  19. ns.setVariable(var,choice.getSelectedItem().value);
  20. }
  21. pane.addComponent(label,choice);
  22. return this;
  23. }