
//
// Mining module for TETDM 
// TypingApplication.java Version 0.30 
// This is one of the sample modules.
// You should read the README file.
//

package module.MiningModules.TypingApplication;		

import source.*;
import source.TextData.*;
//import source.Utility.*;

import java.io.*;
import java.util.*;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

public class TypingApplication extends MiningModule implements ActionListener
{	
	JButton setPanelButton[];
	int buttonNumber;
	int mining[][], visual[][], size[][];	
    
	public TypingApplication()
	{
		setModuleID(20003);						// Set your module ID after you have got it
		setCategoryID(9);		
		pairingVisualizationID = new int[]{0};
        defaultSetPanelModuleID = new int[]{20003,20001,0};
        defaultSetPanelVisualizationID = new int[]{0,20001,17};
        defaultBalancedPanelSizeX = new int[]{1,4,4};
		setToolType(1);
        setUseMode(1);
	}
	
	void panelDataCreation(int m[], int v[], int s[], int number)
	{
		mining[number] = m;
		visual[number] = v;
		size[number] = s;
	}	
	
	public void initializePanel()
    {
		buttonNumber = 2;
		
		operationPanel.setBackground(Color.GREEN);
		operationPanel.setLayout(new GridLayout(buttonNumber,1));
		
		setPanelButton = new JButton[buttonNumber];
		mining = new int[buttonNumber][];
		visual = new int[buttonNumber][];
		size = new int[buttonNumber][];
		
		// set0
		int m0[] = {20003,20001,0};
		int v0[] = {0,20001,17};
		int s0[] = {1,4,4};
		
		// set1
		int m1[] = {20003,20001,0};
		int v1[] = {0,20002,17};
		int s1[] = {1,4,4};
		
		panelDataCreation(m0,v0,s0,0);
		panelDataCreation(m1,v1,s1,1);

		
		String buttonNames[] = {"Number","Color"};
		
		if(isMenuInJapanese())
			for(int i=0;i<buttonNumber;i++)
				buttonNames[i] = inJapanese[i];
		
		for(int i=0;i<buttonNumber;i++)
		{
			setPanelButton[i] = new JButton(buttonNames[i]);
			setPanelButton[i].setBackground(Color.red);
			setPanelButton[i].addActionListener(this);
			operationPanel.add(setPanelButton[i]);
		}
    }

	public void initializeData(){}
	
	public void miningOperations(int optionNumber)
	{
		switch(optionNumber)
		{
			case 0:			
				break;
		}
	}
	
	//Action listener
	public void actionPerformed(ActionEvent e)
	{
		writeSelectionButtonLog(e);/////NEW LOG
		
		for(int i=0;i<buttonNumber;i++)
			if(e.getSource() == setPanelButton[i])
			{
				panelSetFromModule(mining[i], visual[i], size[i]);
				return;
			}
		
	}
}
