<commit_before>/**
 *
 */
package org.javarosa.formmanager.view;

import java.util.Enumeration;
import java.util.Hashtable;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.List;

import org.javarosa.formmanager.activity.FormListModule;

/**
 * @author <NAME>
 *
 */
public class FormList extends List implements CommandListener {
	// TODO: These should all be il8n'd
	private final Command CMD_EXIT = new Command("Exit", Command.BACK, 2);
    private final Command CMD_GETNEWFORMS = new Command("Get New Forms", Command.SCREEN, 2);
    private final Command CMD_VIEWMODELS = new Command("View Saved", Command.SCREEN, 3);
    private final Command CMD_DELETE_FORM = new Command("Delete",Command.SCREEN,4);
    private final Command CMD_SHAREFORMS = new Command("Share Forms", Command.SCREEN, 2);
    private final Command CMD_SETTINGS = new Command("Settings", Command.SCREEN, 3);
    
    private FormListModule parent = null;
    
	public FormList(FormListModule p, String title) {
		this(p, title, List.IMPLICIT);
	}

	public FormList(FormListModule p, String title, int listType) {
		
		super(title, listType);
		this.parent = p;
	}

	public void loadView(Hashtable args) {
		this.deleteAll();
		this.createView();
		this.setCommandListener(this);
		this.populateWithXForms(args);
	}

	private void createView() {
		addScreenCommands();
	}
	
	private void addScreenCommands() {
		this.addCommand(CMD_EXIT);
        //this.addCommand(CMD_OPEN);
        this.addCommand(CMD_DELETE_FORM);
        this.addCommand(CMD_VIEWMODELS);
        this.addCommand(CMD_GETNEWFORMS);
        this.addCommand(CMD_SHAREFORMS);
        //#if polish.usePolishGui
        this.addCommand(CMD_SETTINGS);
        //#endif
	}
	
	/**
	 * Put the list
	 */
	private void populateWithXForms(Hashtable listOfForms) {
		Integer pos = null;
		Enumeration e = listOfForms.keys();
		while(e.hasMoreElements()){
			pos = (Integer)e.nextElement();
			String form = (String)listOfForms.get(pos);
			this.append(form,null);
		}
	}


	public void commandAction(Command c, Displayable arg1) {
		Hashtable v = new Hashtable();
		
		// TODO Auto-generated method stub
		if (c == List.SELECT_COMMAND) {
			//LOG
			System.out.println("Selected a form");
			
			v.put( new Integer(0), new Integer(this.getSelectedIndex()));
			Hashtable returnvals = new Hashtable();
			returnvals.put(Commands.CMD_SELECT_XFORM, v);
			this.parent.viewCompleted(returnvals, ViewTypes.FORM_LIST);
		}
/*
        if (c == CMD_DELETE_FORM) {
			XFormMetaData data = (XFormMetaData) formIDs.elementAt(this.getSelectedIndex());
			// TODO check for any form dependancies
			this.mainShell.deleteForm(data.getRecordId());
			createView();
		}
*/
		if (c == CMD_EXIT) {
			
		}
/*
		if (c == CMD_GETNEWFORMS) {
			this.mainShell.getNewFormsByTransportPropertySetting();
		}
*/
		if (c == CMD_VIEWMODELS) {
			this.mainShell.displayModelList();
		}
/*
		if (c == CMD_SHAREFORMS) {
			this.mainShell.startBToothClient();
		}
		if (c == CMD_SETTINGS) {
			this.mainShell.editProperties();
		}
		*/	}

}
<commit_msg>[r498] [branches/dev] whoops, uncommented broken code. Fixed now<commit_after>/**
 *
 */
package org.javarosa.formmanager.view;

import java.util.Enumeration;
import java.util.Hashtable;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.List;

import org.javarosa.formmanager.activity.FormListModule;

/**
 * @author <NAME>
 *
 */
public class FormList extends List implements CommandListener {
	// TODO: These should all be il8n'd
	private final Command CMD_EXIT = new Command("Exit", Command.BACK, 2);
    private final Command CMD_GETNEWFORMS = new Command("Get New Forms", Command.SCREEN, 2);
    private final Command CMD_VIEWMODELS = new Command("View Saved", Command.SCREEN, 3);
    private final Command CMD_DELETE_FORM = new Command("Delete",Command.SCREEN,4);
    private final Command CMD_SHAREFORMS = new Command("Share Forms", Command.SCREEN, 2);
    private final Command CMD_SETTINGS = new Command("Settings", Command.SCREEN, 3);
    
    private FormListModule parent = null;
    
	public FormList(FormListModule p, String title) {
		this(p, title, List.IMPLICIT);
	}

	public FormList(FormListModule p, String title, int listType) {
		
		super(title, listType);
		this.parent = p;
	}

	public void loadView(Hashtable args) {
		this.deleteAll();
		this.createView();
		this.setCommandListener(this);
		this.populateWithXForms(args);
	}

	private void createView() {
		addScreenCommands();
	}
	
	private void addScreenCommands() {
		this.addCommand(CMD_EXIT);
        //this.addCommand(CMD_OPEN);
        this.addCommand(CMD_DELETE_FORM);
        this.addCommand(CMD_VIEWMODELS);
        this.addCommand(CMD_GETNEWFORMS);
        this.addCommand(CMD_SHAREFORMS);
        //#if polish.usePolishGui
        this.addCommand(CMD_SETTINGS);
        //#endif
	}
	
	/**
	 * Put the list
	 */
	private void populateWithXForms(Hashtable listOfForms) {
		Integer pos = null;
		Enumeration e = listOfForms.keys();
		while(e.hasMoreElements()){
			pos = (Integer)e.nextElement();
			String form = (String)listOfForms.get(pos);
			this.append(form,null);
		}
	}


	public void commandAction(Command c, Displayable arg1) {
		Hashtable v = new Hashtable();
		
		// TODO Auto-generated method stub
		if (c == List.SELECT_COMMAND) {
			//LOG
			System.out.println("Selected a form");
			
			v.put( new Integer(0), new Integer(this.getSelectedIndex()));
			Hashtable returnvals = new Hashtable();
			returnvals.put(Commands.CMD_SELECT_XFORM, v);
			this.parent.viewCompleted(returnvals, ViewTypes.FORM_LIST);
		}
/*
        if (c == CMD_DELETE_FORM) {
			XFormMetaData data = (XFormMetaData) formIDs.elementAt(this.getSelectedIndex());
			// TODO check for any form dependancies
			this.mainShell.deleteForm(data.getRecordId());
			createView();
		}
*/
		if (c == CMD_EXIT) {
			
		}
/*
		if (c == CMD_GETNEWFORMS) {
			this.mainShell.getNewFormsByTransportPropertySetting();
		}
*/
		if (c == CMD_VIEWMODELS) {
			
		}
/*
		if (c == CMD_SHAREFORMS) {
			this.mainShell.startBToothClient();
		}
		if (c == CMD_SETTINGS) {
			this.mainShell.editProperties();
		}
		*/	}

}

{'fraction_non_alphanumeric': 0.1200909780136467, 'fraction_numerical': 0.003184230477634572, 'mean_word_length': 3.2390745501285347, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5626760', 'n_tokens_mistral': 2368, 'n_tokens_neox': 2144, 'n_words': 442}