import org.tizen.dynamicanalyzer.sql.SqlManager;
import org.tizen.dynamicanalyzer.swap.model.RecordEventObject;
import org.tizen.dynamicanalyzer.swap.model.data.ReplayData;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
private DACustomButton saveButton = null;
private DACustomButton okButton = null;
private final int MESSAGE_ID = 7;
- //public static String MODIFIABILITY_FALSE = 0;
public static String MODIFIABILITY_TRUE = "MODIFIABILITY_TRUE ";
public static String SELECTED_ITEM_COPY = "SELECTED_ITEM_COPY ";
public static String ITEM_TIME_VAILD_FALSE = "ITEM_TIME_VAILD_FALSE ";
-
+
private final int TOUCH_EVENT_CODE_MOUSED_DOWN_START = 57;
private final int TOUCH_EVENT_CODE_SECOND_ITEM = 48;
private final int TOUCH_EVENT_CODE_X = 53;
private final int TOUCH_EVENT_CODE_Y = 54;
private final int TOUCH_EVENT_CODE_MOUSED_UP_START = 57;
private final int TOUCH_EVENT_VALUE_SECOND_ITEM = 10;
-
+
private final int KEY = 1;
private final int TOUCH = 3;
private final int KEY_MENU = 169;
private final int KEY_POWER = 116;
private final int KEY_VOLUME_UP = 115;
private final int KEY_VOLUME_DOWN = 114;
-
-
+
private final int EVENT_MOUSE_DOWN_TIME_TABLE_INDEX = 1;
private final int EVENT_MOUSE_UP_TIME_TABLE_INDEX = 2;
private final int EVENT_TYPE_TABLE_INDEX = 3;
private final int EVENT_VALUE1_TABLE_INDEX = 4;
private final int EVENT_VALUE2_TABLE_INDEX = 5;
-
+
private int insertDBRid = 0;
private int insertkeySequence = 1;
private int insertSecTimeSequence = 0;
-
+
private long preMouseUpTime = 0;
-
- private long repalyStartTime = 0;
- private long replayStartSecTime = 0;
- private long replayStartNanoTime = 0;
private static ReplayEditDialogDataManager instance = null;
private ReplayData replayDBData = null;
private List<ReplayEditTableData> replayModifyDataList = null;
private List<List<String>> tableItemsList = null;
-
+
private List<Integer> removeDBIndex = new ArrayList<Integer>();
public static ReplayEditDialogDataManager getInstance() {
return instance;
}
- public void clean(){
+ public void clean() {
replayModifyDataList = null;
replayDBData = null;
tableItemsList = null;
}
-
+
public ReplayData getReplayDBData() {
if (null == replayDBData) {
replayDBData = new ReplayData();
replayDBData = SqlManager.getInstance().getReplayLogs(false);
- // SqlManager.getInstance().closeReplayConnection();
}
return replayDBData;
}
public List<ReplayEditTableData> getReplayModifyData() {
if (null == replayModifyDataList) {
replayModifyDataList = new ArrayList<ReplayEditTableData>();
- makeReplayEditData(getReplayDBData());
+ ReplayData replayData = getReplayDBData();
+ makeReplayEditData(replayModifyDataList, replayData);
removeNotExistMouseUpTimeItem(replayModifyDataList);
- setRemoveDBIndex();
- sortTableItem();
-
+ setRemoveDBIndex(replayModifyDataList);
+ sortTableItem(replayModifyDataList);
+ // removeWrongData(replayModifyDataList);
}
return replayModifyDataList;
}
- private void removeNotExistMouseUpTimeItem(List<ReplayEditTableData> listData){
- for(int i = 0 ;i < listData.size() ; i++){
- if(listData.get(i).getStrEventMouseUpTime().length() < 1){
+ private void removeWrongData(List<ReplayEditTableData> listData) {
+ List<ReplayEditTableData> removeList = new ArrayList<ReplayEditTableData>();
+ for (int i = 0; i < listData.size(); i++) {
+ if (listData.get(i).getLongEventMouseDownTime() > listData.get(i)
+ .getLongEventMouseUpTime()) {
+ removeList.add(listData.get(i));
+ }
+ if (i > 0) {
+ if (listData.get(i - 1).getLongEventMouseDownTime() == listData
+ .get(i).getLongEventMouseDownTime()
+ && listData.get(i - 1).getLongEventMouseUpTime() == listData
+ .get(i).getLongEventMouseUpTime()) {
+ removeList.add(listData.get(i));
+ }
+ }
+ }
+ listData.removeAll(removeList);
+ }
+
+ private void removeNotExistMouseUpTimeItem(
+ List<ReplayEditTableData> listData) {
+ for (int i = 0; i < listData.size(); i++) {
+ if (listData.get(i).getStrEventMouseUpTime().length() < 1) {
listData.remove(i);
}
}
}
-
-
- private void sortTableItem(){
- Collections.sort(getReplayModifyData(), new ReplayEditTableItemListSortComparator());
+
+ private void sortTableItem(List<ReplayEditTableData> listData) {
+ Collections.sort(listData,
+ new ReplayEditTableItemListSortComparator());
}
-
- private ReplayEditTableData getLastReplayEditTableData(){
+
+ private ReplayEditTableData getLastReplayEditTableData() {
return getReplayModifyData().get(getReplayModifyData().size() - 1);
}
- private void makeReplayEditData(ReplayData dbData) {
+ private void makeReplayEditData(List<ReplayEditTableData> editList, ReplayData dbData) {
int size = dbData.getRecordEvent().size();
for (int i = 0; i < size; i++) {
RecordEventObject reo = dbData.getRecordEvent().get(i);
- setEventStartTime(i, reo);
if (reo.getEventType() == 0) { // event end log
continue;
}
}
ReplayEditTableData data = makeEditTableData(reo);
if (null != data) {
- getReplayModifyData().add(data);
+ editList.add(data);
}
}
}
-
- private void setRemoveDBIndex() {
- int nSize = getReplayModifyData().size();
+
+ private void setRemoveDBIndex(List<ReplayEditTableData> listData) {
+ int nSize = listData.size();
for (int i = 0; i < nSize; i++) {
- int rid = getReplayModifyData().get(i).getEventRid();
+ int rid = listData.get(i).getEventRid();
if (rid > -1) {
- System.out.println(getReplayModifyData().get(i)
- .getStrEventType()
- + " getReplayModifyData().get(i).getEventRid() : "
- + getReplayModifyData().get(i).getEventRid());
- if (getReplayModifyData().get(i).getStrEventType()
+ if (listData.get(i).getStrEventType()
.equals(ReplayEditLabels.CONTEXT_TOUCH)) {
for (int j = rid; j < rid + 7; j++) {
removeDBIndex.add(j);
}
- } else if (getReplayModifyData().get(i).getStrEventType()
+ } else if (listData.get(i).getStrEventType()
.equals(ReplayEditLabels.CONTEXT_KEY)) {
for (int j = rid; j < rid + 4; j++) {
removeDBIndex.add(j);
}
}
-
- private void setEventStartTime(int i, RecordEventObject reo){
- if( i == 0){
- repalyStartTime = reo.getTime();
- replayStartSecTime = reo.getEventTime().getSec();
- replayStartNanoTime = reo.getEventTime().getNano();
- }
- if(repalyStartTime >= reo.getTime()){
- repalyStartTime = reo.getTime();
- replayStartSecTime = reo.getEventTime().getSec();
- replayStartNanoTime = reo.getEventTime().getNano();
- }
- }
private boolean isEventMouseUpTime(RecordEventObject reo) {
- if (getReplayModifyData().size() < 1) {
- return false;
- }
boolean isEventMouseUpTime = false;
switch (reo.getEventType()) {
case KEY: {
switch (reo.getEventType()) {
case KEY: {
-
+
replayType = new ReplayEditTableData();
replayType.setEventMouseDownTime(reo.getTime());
replayType.setStrEventType(setEventType(reo.getEventType()));
replayType.setStrEventValue1(setEventValue1(reo.getEventCode()));
replayType.setStrEventValue2(CommonConstants.DASH);
replayType.setEventRid(reo.getId());
- System.out.println("reo.getId() : "+reo.getId());
break;
}
case TOUCH: {
if (reo.getEventCode() == TOUCH_EVENT_CODE_MOUSED_DOWN_START
&& reo.getEventValue() != -1) {
-// if (isDrawEvnet()) {
-// return null;
-// }
+ if (isDrawEvnet()) {
+ return null;
+ }
replayType = new ReplayEditTableData();
replayType.setEventMouseDownTime(reo.getTime());
replayType.setStrEventType(setEventType(reo.getEventType()));
replayType.setEventRid(reo.getId());
- System.out.println("reo.getId() : "+reo.getId());
} else if (reo.getEventCode() == TOUCH_EVENT_CODE_X) {
getReplayModifyData()
.get(getReplayModifyData().size() - 1)
SqlManager.getInstance().closeReplayConnection();
}
}
-
- public void insertDB(boolean isSave, String dbPath){
- SqlManager.getInstance().deleteReplayTableItems(isSave, dbPath,removeDBIndex);
+
+ public void insertDB(boolean isSave, String dbPath) {
+ for (int i = 0; i < removeDBIndex.size(); i++) {
+ }
+ SqlManager.getInstance().deleteReplayTableItems(isSave, dbPath,
+ removeDBIndex);
insertDBData(isSave, dbPath);
}
-
- private void cleanInsertData(){
+
+ private void cleanInsertData() {
insertDBRid = 0;
insertkeySequence = 1;
insertSecTimeSequence = 0;
preMouseUpTime = 0;
}
-
- private void insertDBData(boolean isSave, String dbPath){
+
+ private void insertDBData(boolean isSave, String dbPath) {
cleanInsertData();
int size = getTableItemsList().size();
for (int i = 0; i < size; i++) {
List<String> item = getTableItemsList().get(i);
List<List<String>> dataList = new ArrayList<List<String>>();
- if(item.get(EVENT_TYPE_TABLE_INDEX).equals(ReplayEditLabels.CONTEXT_TOUCH)){
+ if (item.get(EVENT_TYPE_TABLE_INDEX).equals(
+ ReplayEditLabels.CONTEXT_TOUCH)) {
dataList = makeDBTouchData(item);
- }else if(item.get(EVENT_TYPE_TABLE_INDEX).equals(ReplayEditLabels.CONTEXT_KEY)){
+ } else if (item.get(EVENT_TYPE_TABLE_INDEX).equals(
+ ReplayEditLabels.CONTEXT_KEY)) {
dataList = makeDBKeyData(item);
- }else{ //Draw
-
+ } else { // Draw
+
}
- if(dataList.size() > 0 ){
- SqlManager.getInstance().insertRepalyTableItem(isSave, dbPath, dataList);
+ if (dataList.size() > 0) {
+ SqlManager.getInstance().insertRepalyTableItem(isSave, dbPath,
+ dataList);
}
}
}
-
+
public String getDBTime(String time) {
String strTime = time;
if (strTime.contains(ReplayEditLabels.CONTEXT_VALUE_S)) {
strTime += 10000;
return strTime;
}
-
+
private String getDBPoint(String point) {
String strPoint = point;
if (strPoint.contains(ReplayEditLabels.CONTEXT_VALUE_X)) {
return strPoint;
}
-
-
- private long getEventNanoTime(long time){
- long mouseEventSec = (replayStartSecTime + insertSecTimeSequence);
- long mouseDelaytime = time - repalyStartTime;
- if(mouseDelaytime == 0){
- return replayStartNanoTime;
- }
- System.out.println("mouseDelaytime : "+mouseDelaytime);
- if((time - repalyStartTime) < 1){
- return replayStartNanoTime;
- }
- long mouseDelaySec = (mouseEventSec - replayStartSecTime) * 1000000;
- System.out.println("mouseDelaySec : "+mouseDelaySec);
- long mouseEventNano = ((mouseDelaytime - mouseDelaySec) * 1000) +replayStartNanoTime;
- System.out.println("replayStartNanoTime : "+replayStartNanoTime);
- System.out.println("mouseEventNano : "+mouseEventNano);
-
+ private long getEventNanoTime(long time) {
+ int startSec = AnalyzerManager.getProject().getProfileStartTime()
+ .getSec();
+ int startNano = AnalyzerManager.getProject().getProfileStartTime()
+ .getNano();
+ long startTime = startSec / 1000000 + startNano / 1000;
+
+ long mouseEventSec = (startSec + insertSecTimeSequence);
+ long mouseDelaytime = time - startTime;
+ if (mouseDelaytime == 0) {
+ return startNano;
+ }
+ if ((time - startTime) < 1) {
+ return startNano;
+ }
+ long mouseDelaySec = (mouseEventSec - startSec) * 1000000;
+ long mouseEventNano = ((mouseDelaytime - mouseDelaySec) * 1000)
+ + startNano;
return mouseEventNano;
}
-
- private String getSecTime(){
- long mouseDownEventSec = (replayStartSecTime + insertSecTimeSequence);
+
+ private String getSecTime() {
+ int startSec = AnalyzerManager.getProject().getProfileStartTime()
+ .getSec();
+ long mouseDownEventSec = (startSec + insertSecTimeSequence);
return Long.toString(mouseDownEventSec);
}
-
- private String getMouseDownNanoTime(List<String> item){
- String itemMouseDownTime = getDBTime(item.get(EVENT_MOUSE_DOWN_TIME_TABLE_INDEX));
- long downTime = Long.parseLong(itemMouseDownTime);
- if(preMouseUpTime > 0 && downTime - preMouseUpTime > 1000000){
+
+ private String getMouseDownNanoTime(List<String> item) {
+ String itemMouseDownTime = getDBTime(item
+ .get(EVENT_MOUSE_DOWN_TIME_TABLE_INDEX));
+ long downTime = Long.parseLong(itemMouseDownTime);
+ if (preMouseUpTime > 0 && downTime - preMouseUpTime > 1000000) {
long delayTime = (downTime - preMouseUpTime) / 1000000;
- insertSecTimeSequence += delayTime;
+ insertSecTimeSequence += delayTime;
}
-
+
long mouseDownEventNano = getEventNanoTime(downTime);
- while(mouseDownEventNano > 1000000000){
+ while (mouseDownEventNano > 1000000000) {
insertSecTimeSequence++;
mouseDownEventNano = getEventNanoTime(downTime);
}
-
+
return Long.toString(mouseDownEventNano);
}
-
- private String getMouseUpNanoTime(List<String> item){
- String itemMouseDownTime = getDBTime(item.get(EVENT_MOUSE_DOWN_TIME_TABLE_INDEX));
- String itemMouseUpTime = getDBTime(item.get(EVENT_MOUSE_UP_TIME_TABLE_INDEX));
- long downTime = Long.parseLong(itemMouseDownTime);
+
+ private String getMouseUpNanoTime(List<String> item) {
+ String itemMouseDownTime = getDBTime(item
+ .get(EVENT_MOUSE_DOWN_TIME_TABLE_INDEX));
+ String itemMouseUpTime = getDBTime(item
+ .get(EVENT_MOUSE_UP_TIME_TABLE_INDEX));
+ long downTime = Long.parseLong(itemMouseDownTime);
long upTime = Long.parseLong(itemMouseUpTime);
-
- if(upTime - downTime > 1000000){
+
+ if (upTime - downTime > 1000000) {
long delayTime = (downTime - downTime) / 1000000;
- insertSecTimeSequence += delayTime;
+ insertSecTimeSequence += delayTime;
}
-
- long mouseUpEventNano =getEventNanoTime(upTime);
- while(mouseUpEventNano > 1000000000){
+
+ long mouseUpEventNano = getEventNanoTime(upTime);
+ while (mouseUpEventNano > 1000000000) {
insertSecTimeSequence++;
mouseUpEventNano = getEventNanoTime(upTime);
}
-
+
preMouseUpTime = upTime;
return Long.toString(mouseUpEventNano);
}
-
- private String getKeyValue(List<String> item){
+
+ private String getKeyValue(List<String> item) {
String keyValue = item.get(EVENT_VALUE1_TABLE_INDEX);
int nKey = 0;
- if(keyValue.equals(ReplayEditLabels.CONTEXT_KEY_MENU)){
+ if (keyValue.equals(ReplayEditLabels.CONTEXT_KEY_MENU)) {
nKey = 169;
- }else if(keyValue.equals(ReplayEditLabels.CONTEXT_KEY_HOME)){
+ } else if (keyValue.equals(ReplayEditLabels.CONTEXT_KEY_HOME)) {
nKey = 139;
- }else if(keyValue.equals(ReplayEditLabels.CONTEXT_KEY_BACK)){
+ } else if (keyValue.equals(ReplayEditLabels.CONTEXT_KEY_BACK)) {
nKey = 158;
- }else if(keyValue.equals(ReplayEditLabels.CONTEXT_KEY_POWER)){
+ } else if (keyValue.equals(ReplayEditLabels.CONTEXT_KEY_POWER)) {
nKey = 116;
- }else if(keyValue.equals(ReplayEditLabels.CONTEXT_KEY_VOLUME_DOWN)){
+ } else if (keyValue.equals(ReplayEditLabels.CONTEXT_KEY_VOLUME_DOWN)) {
nKey = 115;
- }else if(keyValue.equals(ReplayEditLabels.CONTEXT_KEY_VOLUME_UP)){
+ } else if (keyValue.equals(ReplayEditLabels.CONTEXT_KEY_VOLUME_UP)) {
nKey = 114;
}
return Integer.toString(nKey);
}
- private List<List<String>> makeDBKeyData(List<String> item){
- String itemMouseDownTime = getDBTime(item.get(EVENT_MOUSE_DOWN_TIME_TABLE_INDEX));
- String itemMouseUpTime = getDBTime(item.get(EVENT_MOUSE_UP_TIME_TABLE_INDEX));
+
+ private List<List<String>> makeDBKeyData(List<String> item) {
+ String itemMouseDownTime = getDBTime(item
+ .get(EVENT_MOUSE_DOWN_TIME_TABLE_INDEX));
+ String itemMouseUpTime = getDBTime(item
+ .get(EVENT_MOUSE_UP_TIME_TABLE_INDEX));
String mouseDownNanoTime = getMouseDownNanoTime(item);
String mouseUpNanoTime = getMouseUpNanoTime(item);
String itemValue1 = getKeyValue(item);
-
- System.out.println("item : "+item+" mouseDownNanoTime : "+mouseDownNanoTime+" mouseUpNanoTime : "+mouseUpNanoTime);
-
+ int sec = Integer.parseInt(getSecTime());
+
List<List<String>> dbKeyDataList = new ArrayList<List<String>>();
- for(int i = 0; i < 4 ; i++){
+ for (int i = 0; i < 4; i++) {
List<String> keyData = new ArrayList<String>();
- if (i == 0) {
- keyData.add(Integer.toString(insertDBRid++));
- keyData.add(Integer.toString(MESSAGE_ID));
- keyData.add(Integer.toString(8815));
- keyData.add(itemMouseDownTime);
- keyData.add(getSecTime());
- keyData.add(mouseDownNanoTime);
- keyData.add("1");
- keyData.add(Integer.toString(KEY));
- keyData.add(itemValue1);
- keyData.add("1");
- } else if (i == 1) {
- keyData.add(Integer.toString(insertDBRid++));
- keyData.add(Integer.toString(MESSAGE_ID));
- keyData.add(Integer.toString(8815));
- keyData.add(itemMouseDownTime);
- keyData.add(getSecTime());
- keyData.add(mouseDownNanoTime);
- keyData.add("1");
- keyData.add("0");
- keyData.add("0");
- keyData.add("0");
- } else if (i == 2) {
- keyData.add(Integer.toString(insertDBRid++));
- keyData.add(Integer.toString(MESSAGE_ID));
- keyData.add(Integer.toString(8815));
- keyData.add(itemMouseUpTime);
- keyData.add(getSecTime());
- keyData.add(mouseUpNanoTime);
- keyData.add("1");
- keyData.add(Integer.toString(KEY));
- keyData.add(itemValue1);
- keyData.add("0");
- } else if (i == 3) {
- keyData.add(Integer.toString(insertDBRid++));
- keyData.add(Integer.toString(MESSAGE_ID));
- keyData.add(Integer.toString(8815));
- keyData.add(itemMouseUpTime);
- keyData.add(getSecTime());
- keyData.add(mouseUpNanoTime);
- keyData.add("1");
- keyData.add("0");
- keyData.add("0");
- keyData.add("0");
- }
- dbKeyDataList.add(keyData);
+ if (i == 0) {
+ keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(MESSAGE_ID));
+ keyData.add(Integer.toString(8815));
+ keyData.add(itemMouseDownTime);
+ keyData.add(getSecTime());
+ keyData.add(mouseDownNanoTime);
+ keyData.add("1");
+ keyData.add(Integer.toString(KEY));
+ keyData.add(itemValue1);
+ keyData.add("1");
+ } else if (i == 1) {
+ keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(MESSAGE_ID));
+ keyData.add(Integer.toString(8815));
+ keyData.add(itemMouseDownTime);
+ keyData.add(getSecTime());
+ keyData.add(mouseDownNanoTime);
+ keyData.add("1");
+ keyData.add("0");
+ keyData.add("0");
+ keyData.add("0");
+ } else if (i == 2) {
+ keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(MESSAGE_ID));
+ keyData.add(Integer.toString(8815));
+ keyData.add(itemMouseUpTime);
+ keyData.add(getSecTime());
+ keyData.add(mouseUpNanoTime);
+ keyData.add("1");
+ keyData.add(Integer.toString(KEY));
+ keyData.add(itemValue1);
+ keyData.add("0");
+ } else if (i == 3) {
+ keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(MESSAGE_ID));
+ keyData.add(Integer.toString(8815));
+ keyData.add(itemMouseUpTime);
+ keyData.add(getSecTime());
+ keyData.add(mouseUpNanoTime);
+ keyData.add("1");
+ keyData.add("0");
+ keyData.add("0");
+ keyData.add("0");
+ }
+ dbKeyDataList.add(keyData);
}
return dbKeyDataList;
}
-
- private List<List<String>> makeDBTouchData(List<String> item){
- String itemMouseDownTime = getDBTime(item.get(EVENT_MOUSE_DOWN_TIME_TABLE_INDEX));
- String itemMouseUpTime = getDBTime(item.get(EVENT_MOUSE_UP_TIME_TABLE_INDEX));
+
+ private List<List<String>> makeDBTouchData(List<String> item) {
+ String itemMouseDownTime = getDBTime(item
+ .get(EVENT_MOUSE_DOWN_TIME_TABLE_INDEX));
+ String itemMouseUpTime = getDBTime(item
+ .get(EVENT_MOUSE_UP_TIME_TABLE_INDEX));
String mouseDownNanoTime = getMouseDownNanoTime(item);
String mouseUpNanoTime = getMouseUpNanoTime(item);
String itemValue1 = item.get(EVENT_VALUE1_TABLE_INDEX);
String itemValue2 = item.get(EVENT_VALUE2_TABLE_INDEX);
-
- System.out.println("item : "+item+" mouseDownNanoTime : "+mouseDownNanoTime+" mouseUpNanoTime : "+mouseUpNanoTime);
-
+
+ int sec = Integer.parseInt(getSecTime());
List<List<String>> dbKeyDataList = new ArrayList<List<String>>();
- for(int i = 0; i < 7 ; i++){
+ for (int i = 0; i < 7; i++) {
List<String> keyData = new ArrayList<String>();
- if (i == 0) {
- keyData.add(Integer.toString(insertDBRid++));
- keyData.add(Integer.toString(MESSAGE_ID));
- keyData.add(Integer.toString(8815));
- keyData.add(itemMouseDownTime);
- keyData.add(getSecTime());
- keyData.add(mouseDownNanoTime);
- keyData.add("0");
- keyData.add(Integer.toString(TOUCH));
- keyData.add(Integer.toString(TOUCH_EVENT_CODE_MOUSED_DOWN_START));
- keyData.add(Integer.toString(insertkeySequence++));
- } else if (i == 1) {
- keyData.add(Integer.toString(insertDBRid++));
- keyData.add(Integer.toString(MESSAGE_ID));
- keyData.add(Integer.toString(8815));
- keyData.add(itemMouseDownTime);
- keyData.add(getSecTime());
- keyData.add(mouseDownNanoTime);
- keyData.add("0");
- keyData.add(Integer.toString(TOUCH));
- keyData.add(Integer.toString(TOUCH_EVENT_CODE_SECOND_ITEM));
- keyData.add(Integer.toString(TOUCH_EVENT_VALUE_SECOND_ITEM));
- } else if (i == 2) {
- keyData.add(Integer.toString(insertDBRid++));
- keyData.add(Integer.toString(MESSAGE_ID));
- keyData.add(Integer.toString(8815));
- keyData.add(itemMouseDownTime);
- keyData.add(getSecTime());
- keyData.add(mouseDownNanoTime);
- keyData.add("0");
- keyData.add(Integer.toString(TOUCH));
- keyData.add(Integer.toString(TOUCH_EVENT_CODE_X));
- keyData.add(getDBPoint(itemValue1));
- } else if (i == 3) {
- keyData.add(Integer.toString(insertDBRid++));
- keyData.add(Integer.toString(MESSAGE_ID));
- keyData.add(Integer.toString(8815));
- keyData.add(itemMouseDownTime);
- keyData.add(getSecTime());
- keyData.add(mouseDownNanoTime);
- keyData.add("0");
- keyData.add(Integer.toString(TOUCH));
- keyData.add(Integer.toString(TOUCH_EVENT_CODE_Y));
- keyData.add(getDBPoint(itemValue2));
- } else if (i == 4) {
- keyData.add(Integer.toString(insertDBRid++));
- keyData.add(Integer.toString(MESSAGE_ID));
- keyData.add(Integer.toString(8815));
- keyData.add(itemMouseDownTime);
- keyData.add(getSecTime());
- keyData.add(mouseDownNanoTime);
- keyData.add("0");
- keyData.add("0");
- keyData.add("0");
- keyData.add("0");
- } else if (i == 5) {
- keyData.add(Integer.toString(insertDBRid++));
- keyData.add(Integer.toString(MESSAGE_ID));
- keyData.add(Integer.toString(9164));
- keyData.add(itemMouseUpTime);
- keyData.add(getSecTime());
- keyData.add(mouseUpNanoTime);
- keyData.add("0");
- keyData.add(Integer.toString(TOUCH));
- keyData.add(Integer.toString(TOUCH_EVENT_CODE_MOUSED_UP_START));
- keyData.add("-1");
- }else if (i == 6) {
- keyData.add(Integer.toString(insertDBRid++));
- keyData.add(Integer.toString(MESSAGE_ID));
- keyData.add(Integer.toString(9164));
- keyData.add(itemMouseUpTime);
- keyData.add(getSecTime());
- keyData.add(mouseUpNanoTime);
- keyData.add("0");
- keyData.add("0");
- keyData.add("0");
- keyData.add("0");
- }
- dbKeyDataList.add(keyData);
+ if (i == 0) {
+ keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(MESSAGE_ID));
+ keyData.add(Integer.toString(8815));
+ keyData.add(itemMouseDownTime);
+ keyData.add(getSecTime());
+ keyData.add(mouseDownNanoTime);
+ keyData.add("0");
+ keyData.add(Integer.toString(TOUCH));
+ keyData.add(Integer
+ .toString(TOUCH_EVENT_CODE_MOUSED_DOWN_START));
+ keyData.add(Integer.toString(insertkeySequence++));
+ } else if (i == 1) {
+ keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(MESSAGE_ID));
+ keyData.add(Integer.toString(8815));
+ keyData.add(itemMouseDownTime);
+ keyData.add(getSecTime());
+ keyData.add(mouseDownNanoTime);
+ keyData.add("0");
+ keyData.add(Integer.toString(TOUCH));
+ keyData.add(Integer.toString(TOUCH_EVENT_CODE_SECOND_ITEM));
+ keyData.add(Integer.toString(TOUCH_EVENT_VALUE_SECOND_ITEM));
+ } else if (i == 2) {
+ keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(MESSAGE_ID));
+ keyData.add(Integer.toString(8815));
+ keyData.add(itemMouseDownTime);
+ keyData.add(getSecTime());
+ keyData.add(mouseDownNanoTime);
+ keyData.add("0");
+ keyData.add(Integer.toString(TOUCH));
+ keyData.add(Integer.toString(TOUCH_EVENT_CODE_X));
+ keyData.add(getDBPoint(itemValue1));
+ } else if (i == 3) {
+ keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(MESSAGE_ID));
+ keyData.add(Integer.toString(8815));
+ keyData.add(itemMouseDownTime);
+ keyData.add(getSecTime());
+ keyData.add(mouseDownNanoTime);
+ keyData.add("0");
+ keyData.add(Integer.toString(TOUCH));
+ keyData.add(Integer.toString(TOUCH_EVENT_CODE_Y));
+ keyData.add(getDBPoint(itemValue2));
+ } else if (i == 4) {
+ keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(MESSAGE_ID));
+ keyData.add(Integer.toString(8815));
+ keyData.add(itemMouseDownTime);
+ keyData.add(getSecTime());
+ keyData.add(mouseDownNanoTime);
+ keyData.add("0");
+ keyData.add("0");
+ keyData.add("0");
+ keyData.add("0");
+ } else if (i == 5) {
+ keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(MESSAGE_ID));
+ keyData.add(Integer.toString(9164));
+ keyData.add(itemMouseUpTime);
+ keyData.add(getSecTime());
+ keyData.add(mouseUpNanoTime);
+ keyData.add("0");
+ keyData.add(Integer.toString(TOUCH));
+ keyData.add(Integer.toString(TOUCH_EVENT_CODE_MOUSED_UP_START));
+ keyData.add("-1");
+ } else if (i == 6) {
+ keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(MESSAGE_ID));
+ keyData.add(Integer.toString(9164));
+ keyData.add(itemMouseUpTime);
+ keyData.add(getSecTime());
+ keyData.add(mouseUpNanoTime);
+ keyData.add("0");
+ keyData.add("0");
+ keyData.add("0");
+ keyData.add("0");
+ }
+ dbKeyDataList.add(keyData);
}
return dbKeyDataList;
}
-
-
+
private List<List<String>> getTableItemsList() {
- if(null == tableItemsList){
+ if (null == tableItemsList) {
tableItemsList = new ArrayList<List<String>>();
}
return tableItemsList;
}
- public void setTableItemsList(List<List<String>> tableItemsList) {
- if(null == tableItemsList){
+ public void setTableItemsList(DATableComposite replayComp) {
+ if (null == tableItemsList) {
tableItemsList = new ArrayList<List<String>>();
}
- this.tableItemsList = tableItemsList;
+ for (int i = 0; i < replayComp.getTable().getItemCount(); i++) {
+ List<String> text = new ArrayList<String>();
+ int size = replayComp.getTable().getColumns().length;
+ for (int j = 0; j < size + 1; j++) {
+ text.add(replayComp.getTable().getItem(i).getText(j));
+ }
+ tableItemsList.add(text);
+ }
}
public DACustomButton getSaveButton() {
this.okButton = okButton;
}
-
}
-
-
-
public class ReplayEditTable extends DATableComposite {
private String[] columnNames = null;
+ private final int tableTextOptionColumnIndex = 6;
+ protected DAPopupMenu eventTypePopupMenu = null;
+ protected DAPopupMenu eventKeyPopupMenu = null;
- protected DAPopupMenu typePopupMenu = null;
- protected DAPopupMenu keyValuePopupMenu = null;
-
- private boolean mouseSelectedItem = false;
+ private boolean isMouseSelectedTableItem = false;
private int mouseSelectedItemIndex = -1;
private int mouseSelectedColumnIndex = -1;
private int mouseSelectedPreColunmEndX = -1;
private int selectedCutItemIndex = -1;
private int selectedCopyItemIndex = -1;
+ private int nowMousePositionX = 0;
+ private int nowMousePositionY = 0;
+
DAPopupMenuItem copyItem = null;
DAPopupMenuItem cutItem = null;
DAPopupMenuItem insertItem = null;
public ReplayEditTable(Composite parent, int style) {
super(parent, style);
-
setItemSeqMenu();
setTyepMenu();
setKeyMenu();
case SWT.MouseExit:
break;
case SWT.MouseMove:
- upadteMouseOverSequenceColumn(item, event);
- upadteMouseOverColumn(item, event);
- updateTableItems();
+ upadteMouseOverTableItemsStatus(item, event);
+ updateMouseOverTableItemsText();
break;
case SWT.MouseDoubleClick:
break;
case SWT.MouseUp:
break;
case SWT.MouseDown:
- updateSelectedItemIndex(item, event);
+ updateSelectedItemIndexValue(item, event);
switch (event.button) {
case MOUSE_LEFT: {
- popupMenuMouseDownImage(item, event);
- enableKeyInsert(item, event);
+ enablePopupMenuMouseDownIcon(item, event);
+ updateKeyboardInputStatus(item, event);
break;
}
case MOUSE_RIGHT: {
- popupMenuMouseDownSequenceColumn(item, event);
+ openPoppupMenuMouseDownSequenceColumn(item, event);
break;
}
default: {
}
}
};
-
private List<String> getSelectedItemText(int index) {
List<String> text = new ArrayList<String>();
tableRedraw();
}
-
- private String getMouseSelectedItemOptionText(){
- return table.getItem(getMouseSelectedTableItemIndex()).getText(6);
+ private String getMouseSelectedItemOptionText() {
+ return table.getItem(getMouseSelectedTableItemIndex()).getText(
+ tableTextOptionColumnIndex);
}
-
- private void setMouseSelectedItemOptionText(String text){
- table.getItem(getMouseSelectedTableItemIndex()).setText(6, text);
+
+ private void setMouseSelectedItemOptionText(String text) {
+ table.getItem(getMouseSelectedTableItemIndex()).setText(
+ tableTextOptionColumnIndex, text);
}
-
-
- private int getMouseSelectedTableItemIndex(){
+
+ private int getMouseSelectedTableItemIndex() {
return mouseSelectedItemIndex;
}
- private int getMouseSelectedTableColumnIndex(){
+
+ private int getMouseSelectedTableColumnIndex() {
return mouseSelectedColumnIndex;
}
-
- private String getMouseSelectedTableItemText(){
- return table.getItem(getMouseSelectedTableItemIndex()).getText(getMouseSelectedTableColumnIndex());
+
+ private String getMouseSelectedTableItemText() {
+ return table.getItem(getMouseSelectedTableItemIndex()).getText(
+ getMouseSelectedTableColumnIndex());
}
-
- private void setMouseSelectedTableItemText(String text){
- table.getItem(getMouseSelectedTableItemIndex()).setText(getMouseSelectedTableColumnIndex(), text);
+
+ private void setMouseSelectedTableItemText(String text) {
+ table.getItem(getMouseSelectedTableItemIndex()).setText(
+ getMouseSelectedTableColumnIndex(), text);
}
private void setItemSeqMenu() {
@Override
public void widgetSelected(DAPopupMenuItem menuItem) {
copyItemText = getSelectedItemText(getMouseSelectedTableItemIndex());
- if(copyItemText.get(6).contains(ReplayEditDialogDataManager.SELECTED_ITEM_COPY)){
- copyItemText.get(6).replace(ReplayEditDialogDataManager.SELECTED_ITEM_COPY, "");
+ if (copyItemText.get(tableTextOptionColumnIndex).contains(
+ ReplayEditDialogDataManager.SELECTED_ITEM_COPY)) {
+ copyItemText.get(tableTextOptionColumnIndex).replace(
+ ReplayEditDialogDataManager.SELECTED_ITEM_COPY,
+ CommonConstants.EMPTY);
}
if (selectedCopyItemIndex >= 0) {
disableCopyItem(selectedCopyItemIndex);
} else {
disableCopyItem(selectedCutItemIndex);
}
-
+
selectedCutItemIndex = getMouseSelectedTableItemIndex();
enableCopyItem();
- // testPrintItemsText();
}
});
copyItem = new DAPopupMenuItem(popupMenu);
@Override
public void widgetSelected(DAPopupMenuItem menuItem) {
copyItemText = getSelectedItemText(getMouseSelectedTableItemIndex());
- if(copyItemText.get(6).contains(ReplayEditDialogDataManager.SELECTED_ITEM_COPY)){
- copyItemText.get(6).replace(ReplayEditDialogDataManager.SELECTED_ITEM_COPY, "");
+ if (copyItemText.get(tableTextOptionColumnIndex).contains(
+ ReplayEditDialogDataManager.SELECTED_ITEM_COPY)) {
+ copyItemText.get(tableTextOptionColumnIndex).replace(
+ ReplayEditDialogDataManager.SELECTED_ITEM_COPY,
+ CommonConstants.EMPTY);
}
if (selectedCutItemIndex >= 0) {
disableCopyItem(selectedCutItemIndex);
} else {
disableCopyItem(selectedCopyItemIndex);
}
-
+
selectedCopyItemIndex = getMouseSelectedTableItemIndex();
- System.out.println("selectedCopyItemIndex : "+selectedCopyItemIndex);
enableCopyItem();
- // testPrintItemsText();
}
});
pasteItem = new DAPopupMenuItem(popupMenu);
@Override
public void widgetSelected(DAPopupMenuItem menuItem) {
if (selectedCopyItemIndex >= 0) {
- replaceTableItems(getMouseSelectedTableItemIndex(), copyItemText);
+ replaceTableItems(getMouseSelectedTableItemIndex(),
+ copyItemText);
updateTableSequenceNumber();
disableCopyItem(getMouseSelectedTableItemIndex());
} else if (selectedCutItemIndex >= 0) {
- replaceTableItems(getMouseSelectedTableItemIndex(),copyItemText);
+ replaceTableItems(getMouseSelectedTableItemIndex(),
+ copyItemText);
table.remove(selectedCutItemIndex);
updateTableSequenceNumber();
selectedCutItemIndex = -1;
}
updateVaildState();
tableRedraw();
- // testPrintItemsText();
}
});
insertItem.addListener(new DAPopupMenuListener() {
@Override
public void widgetSelected(DAPopupMenuItem menuItem) {
- if(getCopyItemIndex() > -1){
+ if (getCopyItemIndex() > -1) {
if (selectedCopyItemIndex >= 0) {
- addTableItems(getMouseSelectedTableItemIndex(), copyItemText);
+ addTableItems(getMouseSelectedTableItemIndex(),
+ copyItemText);
} else if (selectedCutItemIndex >= 0) {
- disableCopyItem(selectedCutItemIndex+1);
- addTableItems(getMouseSelectedTableItemIndex(), copyItemText);
+ disableCopyItem(selectedCutItemIndex + 1);
+ addTableItems(getMouseSelectedTableItemIndex(),
+ copyItemText);
table.remove(selectedCutItemIndex - 1);
updateTableSequenceNumber();
- selectedCutItemIndex =-1;
+ selectedCutItemIndex = -1;
}
} else {
- addTableItems(getMouseSelectedTableItemIndex(),
+ addTableItems(
+ getMouseSelectedTableItemIndex(),
getSelectedItemText(getMouseSelectedTableItemIndex()));
}
updateTableSequenceNumber();
updateVaildState();
tableRedraw();
- // testPrintItemsText();
}
});
deleteItem = new DAPopupMenuItem(popupMenu);
updateTableSequenceNumber();
updateVaildState();
tableRedraw();
- // testPrintItemsText();
}
});
}
private void enableCopyItem() {
String itemOption = getMouseSelectedItemOptionText();
- if(!itemOption.contains(ReplayEditDialogDataManager.SELECTED_ITEM_COPY)){
- setMouseSelectedItemOptionText(
- itemOption + ReplayEditDialogDataManager.SELECTED_ITEM_COPY);
+ if (!itemOption
+ .contains(ReplayEditDialogDataManager.SELECTED_ITEM_COPY)) {
+ setMouseSelectedItemOptionText(itemOption
+ + ReplayEditDialogDataManager.SELECTED_ITEM_COPY);
}
}
ReplayEditDialogDataManager.SELECTED_ITEM_COPY,
CommonConstants.EMPTY);
}
- table.getItem(index).setText(6, itemOption);
- System.out.println("disableCopyItem index : "+index+ "itemOption : "+itemOption);
+ table.getItem(index).setText(tableTextOptionColumnIndex, itemOption);
}
private void setTyepMenu() {
- typePopupMenu = new ReplayEditPopupMenu(table);
- typePopupMenu.setMouseListener();
- typePopupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
- DAPopupMenuItem cutItem = new DAPopupMenuItem(typePopupMenu);
+ eventTypePopupMenu = new ReplayEditPopupMenu(table);
+ eventTypePopupMenu.setMouseListener();
+ eventTypePopupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
+ DAPopupMenuItem cutItem = new DAPopupMenuItem(eventTypePopupMenu);
cutItem.setText(ReplayEditLabels.CONTEXT_TOUCH);
cutItem.addListener(new DAPopupMenuListener() {
@Override
updateSelectPopupMenu(ReplayEditLabels.CONTEXT_TOUCH);
}
});
- DAPopupMenuItem copyItem = new DAPopupMenuItem(typePopupMenu);
+ DAPopupMenuItem copyItem = new DAPopupMenuItem(eventTypePopupMenu);
copyItem.setText(ReplayEditLabels.CONTEXT_KEY);
copyItem.addListener(new DAPopupMenuListener() {
@Override
}
private void setKeyMenu() {
- keyValuePopupMenu = new ReplayEditPopupMenu(table);
- keyValuePopupMenu.setMouseListener();
- keyValuePopupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
- DAPopupMenuItem menuItem = new DAPopupMenuItem(keyValuePopupMenu);
+ eventKeyPopupMenu = new ReplayEditPopupMenu(table);
+ eventKeyPopupMenu.setMouseListener();
+ eventKeyPopupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
+ DAPopupMenuItem menuItem = new DAPopupMenuItem(eventKeyPopupMenu);
menuItem.setText(ReplayEditLabels.CONTEXT_KEY_MENU);
menuItem.addListener(new DAPopupMenuListener() {
@Override
updateSelectPopupMenu(ReplayEditLabels.CONTEXT_KEY_MENU);
}
});
- DAPopupMenuItem homeItem = new DAPopupMenuItem(keyValuePopupMenu);
+ DAPopupMenuItem homeItem = new DAPopupMenuItem(eventKeyPopupMenu);
homeItem.setText(ReplayEditLabels.CONTEXT_KEY_HOME);
homeItem.addListener(new DAPopupMenuListener() {
@Override
updateSelectPopupMenu(ReplayEditLabels.CONTEXT_KEY_HOME);
}
});
- DAPopupMenuItem backItem = new DAPopupMenuItem(keyValuePopupMenu);
+ DAPopupMenuItem backItem = new DAPopupMenuItem(eventKeyPopupMenu);
backItem.setText(ReplayEditLabels.CONTEXT_KEY_BACK);
backItem.addListener(new DAPopupMenuListener() {
@Override
updateSelectPopupMenu(ReplayEditLabels.CONTEXT_KEY_BACK);
}
});
- DAPopupMenuItem powerItem = new DAPopupMenuItem(keyValuePopupMenu);
+ DAPopupMenuItem powerItem = new DAPopupMenuItem(eventKeyPopupMenu);
powerItem.setText(ReplayEditLabels.CONTEXT_KEY_POWER);
powerItem.addListener(new DAPopupMenuListener() {
@Override
updateSelectPopupMenu(ReplayEditLabels.CONTEXT_KEY_POWER);
}
});
- DAPopupMenuItem volumeUpItem = new DAPopupMenuItem(keyValuePopupMenu);
+ DAPopupMenuItem volumeUpItem = new DAPopupMenuItem(eventKeyPopupMenu);
volumeUpItem.setText(ReplayEditLabels.CONTEXT_KEY_VOLUME_UP);
volumeUpItem.addListener(new DAPopupMenuListener() {
@Override
updateSelectPopupMenu(ReplayEditLabels.CONTEXT_KEY_VOLUME_UP);
}
});
- DAPopupMenuItem volumeDownItem = new DAPopupMenuItem(keyValuePopupMenu);
+ DAPopupMenuItem volumeDownItem = new DAPopupMenuItem(eventKeyPopupMenu);
volumeDownItem.setText(ReplayEditLabels.CONTEXT_KEY_VOLUME_DOWN);
volumeDownItem.addListener(new DAPopupMenuListener() {
@Override
private void setItemKeyText(Event event) {
boolean iskeyInput = false;
- if (mouseSelectedItem) {
+ if (isMouseSelectedTableItem) {
if (getColumnName(getMouseSelectedTableColumnIndex()).equals(
ReplayEditLabels.TABLE_COLUMN_MOUSE_DOWN_TIME)
- || getColumnName(getMouseSelectedTableColumnIndex()).equals(
- ReplayEditLabels.TABLE_COLUMN_MOUSE_UP_TIME)) {
+ || getColumnName(getMouseSelectedTableColumnIndex())
+ .equals(ReplayEditLabels.TABLE_COLUMN_MOUSE_UP_TIME)) {
if (KeyEvent.VK_0 <= event.character
&& event.character <= KeyEvent.VK_9) {
iskeyInput = true;
setMouseSelectedTableItemText(inputString);
tableRedraw();
- } else if (getColumnName(getMouseSelectedTableColumnIndex()).equals(
- ReplayEditLabels.TABLE_COLUMN_VALUE1)
- || getColumnName(getMouseSelectedTableColumnIndex()).equals(
- ReplayEditLabels.TABLE_COLUMN_VALUE2)) {
+ } else if (getColumnName(getMouseSelectedTableColumnIndex())
+ .equals(ReplayEditLabels.TABLE_COLUMN_VALUE1)
+ || getColumnName(getMouseSelectedTableColumnIndex())
+ .equals(ReplayEditLabels.TABLE_COLUMN_VALUE2)) {
if (KeyEvent.VK_0 <= event.character
&& event.character <= KeyEvent.VK_9) {
iskeyInput = true;
getMouseSelectedTableColumnIndex() + 1,
ReplayEditLabels.CONTEXT_KEY_MENU);
table.getItem(getMouseSelectedTableItemIndex()).setText(
- getMouseSelectedTableColumnIndex() + 2, CommonConstants.DASH);
+ getMouseSelectedTableColumnIndex() + 2,
+ CommonConstants.DASH);
}
} else if (text.contains(ReplayEditLabels.CONTEXT_TOUCH)) {
if (selectedPreTouchContext.size() > 3
selectedPreKeyContext.clear();
selectedPreKeyContext.add(Integer
.toString(getMouseSelectedTableItemIndex()));
- selectedPreKeyContext.add(table.getItem(getMouseSelectedTableItemIndex())
- .getText(getMouseSelectedTableColumnIndex()));
- selectedPreKeyContext.add(table.getItem(getMouseSelectedTableItemIndex())
- .getText(getMouseSelectedTableColumnIndex() + 1));
- selectedPreKeyContext.add(table.getItem(getMouseSelectedTableItemIndex())
- .getText(getMouseSelectedTableColumnIndex() + 2));
+ selectedPreKeyContext.add(table.getItem(
+ getMouseSelectedTableItemIndex()).getText(
+ getMouseSelectedTableColumnIndex()));
+ selectedPreKeyContext.add(table.getItem(
+ getMouseSelectedTableItemIndex()).getText(
+ getMouseSelectedTableColumnIndex() + 1));
+ selectedPreKeyContext.add(table.getItem(
+ getMouseSelectedTableItemIndex()).getText(
+ getMouseSelectedTableColumnIndex() + 2));
} else if (text.equals(ReplayEditLabels.CONTEXT_TOUCH)) {
selectedPreTouchContext.clear();
selectedPreTouchContext.add(Integer
.toString(getMouseSelectedTableItemIndex()));
selectedPreTouchContext.add(table.getItem(
getMouseSelectedTableItemIndex()).getText(
- getMouseSelectedTableColumnIndex()));
+ getMouseSelectedTableColumnIndex()));
selectedPreTouchContext.add(table.getItem(
getMouseSelectedTableItemIndex()).getText(
- getMouseSelectedTableColumnIndex() + 1));
+ getMouseSelectedTableColumnIndex() + 1));
selectedPreTouchContext.add(table.getItem(
getMouseSelectedTableItemIndex()).getText(
- getMouseSelectedTableColumnIndex() + 2));
+ getMouseSelectedTableColumnIndex() + 2));
}
}
private void setPreSelectedContext(String text) {
if (text.equals(ReplayEditLabels.CONTEXT_KEY)) {
table.getItem(getMouseSelectedTableItemIndex()).setText(
- getMouseSelectedTableColumnIndex(), selectedPreKeyContext.get(1));
+ getMouseSelectedTableColumnIndex(),
+ selectedPreKeyContext.get(1));
table.getItem(getMouseSelectedTableItemIndex()).setText(
- getMouseSelectedTableColumnIndex() + 1, selectedPreKeyContext.get(2));
+ getMouseSelectedTableColumnIndex() + 1,
+ selectedPreKeyContext.get(2));
table.getItem(getMouseSelectedTableItemIndex()).setText(
- getMouseSelectedTableColumnIndex() + 2, selectedPreKeyContext.get(3));
+ getMouseSelectedTableColumnIndex() + 2,
+ selectedPreKeyContext.get(3));
} else if (text.equals(ReplayEditLabels.CONTEXT_TOUCH)) {
table.getItem(getMouseSelectedTableItemIndex()).setText(
getMouseSelectedTableColumnIndex(),
}
- private void upadteMouseOverColumn(GridItem item, Event event) {
+ private void upadteMouseOverTableItemsStatus(GridItem item, Event event) {
for (int i = 0; i < table.getItemCount(); i++) {
for (int j = 0; j < table.getColumns().length; j++) {
table.getItem(i).setChecked(j, false);
}
}
- //int selectedColumnIndex = getMouseSelectedTableColumnIndex();
-// String selectedText = getMouseSelectedTableItemText();
int selectedColumnIndex = getMouseColumnIdnex(item, event);
+
String selectedText = item.getText(selectedColumnIndex);
if (selectedText.equals(CommonConstants.DASH)) {
} else {
item.setImage(ImageResources.REPLAY_EDIT_DROPDOWN_DOWN);
}
- for (int i = 0; i < table.getColumns().length; i++) {
- if (selectedColumnIndex != 0
- && item.getText(i).contentEquals(
- ReplayEditLabels.CONTEXT_DRAW)) {
- return;
- }
- }
item.setChecked(selectedColumnIndex, true);
tableRedraw();
}
- private void updateTableItems(){
-
- if(!mouseSelectedItem){
+
+ private void updateMouseOverTableItemsText() {
+ if (!isMouseSelectedTableItem) {
return;
}
-
- if (!updateRollbackText()) {
- updateNextItemsSavedTime();
- }
-
+
+ updateRollbackText();
+ updateNextItemsSavedTime();
+
updateVaildState();
- mouseSelectedItem = false;
+ isMouseSelectedTableItem = false;
tableRedraw();
-
+
}
private boolean updateVaildItems() {
int nSize = table.getItemCount();
long preEventTime = 0;
boolean isVaild = true;
- System.out.println("--------------------");
for (int i = 0; i < nSize; i++) {
long mouseDowntime = getLongTableTime(table.getItem(i).getText(1));
long mouseUptime = getLongTableTime(table.getItem(i).getText(2));
- System.out.println("mouseDowntime : " + mouseDowntime
- + " mouseUptime : " + mouseUptime);
if (mouseUptime < mouseDowntime) {
isVaild = false;
- System.out.println("111 mouseUptime : " + mouseUptime
- + " mouseDowntime : " + mouseDowntime);
- } else if (mouseUptime < preEventTime) {
+ } else if (mouseDowntime < preEventTime) {
isVaild = false;
- System.out.println("222 mouseUptime : " + mouseUptime
- + " preEventTime : " + preEventTime);
} else {
- String itemOption = table.getItem(i).getText(6);
+ String itemOption = table.getItem(i).getText(
+ tableTextOptionColumnIndex);
if (itemOption
.contains(ReplayEditDialogDataManager.ITEM_TIME_VAILD_FALSE)) {
String removeItemOption = itemOption.replace(
ReplayEditDialogDataManager.ITEM_TIME_VAILD_FALSE,
CommonConstants.EMPTY);
- System.out
- .println("removeItemOption : " + removeItemOption);
- table.getItem(i).setText(6, removeItemOption);
+ table.getItem(i).setText(tableTextOptionColumnIndex,
+ removeItemOption);
}
}
preEventTime = mouseUptime;
if (!isVaild) {
- String itemOption = table.getItem(i).getText(6);
+ String itemOption = table.getItem(i).getText(
+ tableTextOptionColumnIndex);
if (!itemOption
.contains(ReplayEditDialogDataManager.ITEM_TIME_VAILD_FALSE)) {
table.getItem(i)
.setText(
- 6,
+ tableTextOptionColumnIndex,
itemOption
+ ReplayEditDialogDataManager.ITEM_TIME_VAILD_FALSE);
}
}
}
- testPrintItemsText();
return isVaild;
}
strTime = strTime.replace(CommonConstants.DOT,
CommonConstants.EMPTY);
}
- if(strTime.length() == 1){
- strTime +=0;
+ if (strTime.length() == 1) {
+ strTime += 0;
}
return Long.parseLong(strTime);
}
int nSize = table.getItemCount();
int startItem = getMouseSelectedTableItemIndex();
for (int i = startItem; i < nSize; i++) {
+ if (!table.getItem(i).getText(tableTextOptionColumnIndex)
+ .contains(ReplayEditDialogDataManager.MODIFIABILITY_TRUE)) {
+ continue;
+ }
long mouseDowntime = getLongTableTime(table.getItem(i).getText(1));
long mouseUptime = getLongTableTime(table.getItem(i).getText(2));
mouseDowntime += addTime;
table.getItem(i).setText(2, getStrTableTime(mouseUptime));
}
}
-
}
private void updateNextItemsSavedTime() {
- if (mouseSelectedItem) {
+ if (isMouseSelectedTableItem) {
String savedString = getMouseSelectedTableItemText();
if (savedString.length() > 0) {
if (getColumnName(getMouseSelectedTableColumnIndex()).equals(
ReplayEditLabels.TABLE_COLUMN_MOUSE_DOWN_TIME)) {
addTableTime(true);
- } else if (getColumnName(getMouseSelectedTableColumnIndex()).equals(
- ReplayEditLabels.TABLE_COLUMN_MOUSE_UP_TIME)) {
+ } else if (getColumnName(getMouseSelectedTableColumnIndex())
+ .equals(ReplayEditLabels.TABLE_COLUMN_MOUSE_UP_TIME)) {
addTableTime(false);
}
}
}
private boolean updateRollbackText() {
- if (mouseSelectedItem) {
+ if (isMouseSelectedTableItem) {
String savedString = getMouseSelectedTableItemText();
boolean isResetText = false;
if (savedString.length() == 0) {
if (getMouseSelectedTableItemIndex() > 0) {
preItemmouseUpTime = table.getItem(
getMouseSelectedTableItemIndex() - 1).getText(
- getMouseSelectedTableColumnIndex() + 1);
+ getMouseSelectedTableColumnIndex() + 1);
}
String mouseDownTime = updateDotChartAtTime();
int comparePreItemTime = compareTime(preItemmouseUpTime,
if (comparePreItemTime >= 0) {
isResetText = true;
}
-// String mouseUpTime = table.getItem(
-// mouseSelectedItemIndex - 1).getText(
-// mouseSelectedColumnIndex + 2);
-// int compareSameItemTime = compareTime(mouseDownTime,
-// mouseUpTime);
-// if (compareSameItemTime >= 0) {
-// isResetText = true;
-// }
-
- } else if (getColumnName(getMouseSelectedTableColumnIndex()).equals(
- ReplayEditLabels.TABLE_COLUMN_MOUSE_UP_TIME)) {
+
+ } else if (getColumnName(getMouseSelectedTableColumnIndex())
+ .equals(ReplayEditLabels.TABLE_COLUMN_MOUSE_UP_TIME)) {
String mouseUpTime = updateDotChartAtTime();
if (table.getItemCount() <= getMouseSelectedTableItemIndex()) {
isResetText = false;
} else {
String sameItemMouseDownTime = table.getItem(
getMouseSelectedTableItemIndex()).getText(
- getMouseSelectedTableColumnIndex()-1);
+ getMouseSelectedTableColumnIndex() - 1);
int compareSameItemTime = compareTime(
sameItemMouseDownTime, mouseUpTime);
if (compareSameItemTime >= 0) {
isResetText = true;
}
-
-// String nextItemMouseDownTime = table.getItem(
-// mouseSelectedItemIndex).getText(
-// mouseSelectedColumnIndex);
-// int compareNextItemTime = compareTime(mouseUpTime,
-// nextItemMouseDownTime);
-// if (compareNextItemTime >= 0) {
-// isResetText = true;
-// }
}
- } else if (getColumnName(getMouseSelectedTableColumnIndex()).equals(
- ReplayEditLabels.TABLE_COLUMN_VALUE1)) {
+ } else if (getColumnName(getMouseSelectedTableColumnIndex())
+ .equals(ReplayEditLabels.TABLE_COLUMN_VALUE1)) {
if (savedString.length() > 7) {
isResetText = true;
}
- } else if (getColumnName(getMouseSelectedTableColumnIndex()).equals(
- ReplayEditLabels.TABLE_COLUMN_VALUE2)) {
+ } else if (getColumnName(getMouseSelectedTableColumnIndex())
+ .equals(ReplayEditLabels.TABLE_COLUMN_VALUE2)) {
if (savedString.length() > 7) {
isResetText = true;
}
private int compareTime(String firstTime, String secondTime) {
StringBuffer firstTimeBuffer = new StringBuffer(firstTime);
StringBuffer highTimeBuffer = new StringBuffer(secondTime);
- System.out.println("firstTimeBuffer : "+firstTimeBuffer+" highTimeBuffer : "+highTimeBuffer);
firstTimeBuffer.deleteCharAt(firstTime.length() - 1);
firstTimeBuffer.deleteCharAt(firstTime.length() - 3);
highTimeBuffer.deleteCharAt(secondTime.length() - 1);
return chagneString;
}
- private void updateSelectedItemIndex(GridItem item, Event event) {
-
+ private void updateSelectedItemIndexValue(GridItem item, Event event) {
GridColumn[] columns = table.getColumns();
mouseSelectedItemIndex = -1;
mouseSelectedColumnIndex = -1;
}
}
- private void enableKeyInsert(GridItem item, Event event) {
- if (!item.getText(6).contains(
+ private void updateKeyboardInputStatus(GridItem item, Event event) {
+ if (!item.getText(tableTextOptionColumnIndex).contains(
ReplayEditDialogDataManager.MODIFIABILITY_TRUE)) {
deleteItem.setEnabled(false);
- } else if (getMouseSelectedTableItemIndex() == 0
- && item.getText(getMouseSelectedTableColumnIndex()).contains(
- ReplayEditLabels.CONTEXT_VALUE_S)) {
return;
}
if (selectedText.contains(ReplayEditLabels.CONTEXT_VALUE_X)
|| selectedText.contains(ReplayEditLabels.CONTEXT_VALUE_Y)
|| selectedText.contains(ReplayEditLabels.CONTEXT_VALUE_S)) {
- mouseSelectedItem = true;
+ isMouseSelectedTableItem = true;
savedItemTextForReset = getMouseSelectedTableItemText();
setMouseSelectedTableItemText(CommonConstants.EMPTY);
}
}
- private void popupMenuMouseDownImage(GridItem item, Event event) {
+ private void enablePopupMenuMouseDownIcon(GridItem item, Event event) {
if (mouseSelectedPreColunmEndX <= event.x
&& event.x <= mouseSelectedPreColunmEndX + 20
&& getMouseSelectedTableItemIndex() != -1) {
+ mouseSelectedPreColunmEndX + 8;
popupPt.y = table.getShell().getBounds().y + table.getItemHeight()
- * getMouseSelectedTableItemIndex() + 145;
+ * getMouseSelectedTableItemIndex() + 160;
- String selectedText = item.getText(getMouseSelectedTableColumnIndex());
+ String selectedText = item
+ .getText(getMouseSelectedTableColumnIndex());
if (selectedText.contains(ReplayEditLabels.CONTEXT_TOUCH)
|| selectedText.contains(ReplayEditLabels.CONTEXT_KEY)) {
- typePopupMenu.open(typePopupMenu.getTopShell(), popupPt.x,
+ eventTypePopupMenu.open(eventTypePopupMenu.getTopShell(), popupPt.x,
popupPt.y);
savedSelectedContext(selectedText);
} else if (selectedText.contains(ReplayEditLabels.CONTEXT_KEY_MENU)
.contains(ReplayEditLabels.CONTEXT_KEY_VOLUME_UP)
|| selectedText
.contains(ReplayEditLabels.CONTEXT_KEY_VOLUME_DOWN)) {
- keyValuePopupMenu.open(keyValuePopupMenu.getTopShell(),
+ eventKeyPopupMenu.open(eventKeyPopupMenu.getTopShell(),
popupPt.x, popupPt.y);
} else {
}
}
- private void popupMenuMouseDownSequenceColumn(GridItem item, Event event) {
- if (!item.getText(6).contains(
+ private void openPoppupMenuMouseDownSequenceColumn(GridItem item, Event event) {
+ if (!item.getText(tableTextOptionColumnIndex).contains(
ReplayEditDialogDataManager.MODIFIABILITY_TRUE)) {
if (selectedCutItemIndex > 0 || selectedCopyItemIndex > 0) {
insertItem.setEnabled(true);
pasteItem.setEnabled(false);
deleteItem.setEnabled(false);
- } else if (getMouseSelectedTableItemIndex() == 0) {
- cutItem.setEnabled(false);
- deleteItem.setEnabled(false);
- pasteItem.setEnabled(false);
} else if (getCopyItemIndex() > -1) {
copyItem.setEnabled(true);
cutItem.setEnabled(true);
popupMenu.closeChild();
}
}
-
- private int getCopyItemIndex(){
+
+ private int getCopyItemIndex() {
int nSize = table.getItemCount();
int index = -1;
for (int i = 0; i < nSize; i++) {
- if(table.getItem(i).getText(6).contains(ReplayEditDialogDataManager.SELECTED_ITEM_COPY)){
+ if (table.getItem(i).getText(tableTextOptionColumnIndex)
+ .contains(ReplayEditDialogDataManager.SELECTED_ITEM_COPY)) {
index = i;
break;
}
return index;
}
- private void upadteMouseOverSequenceColumn(GridItem item, Event event) {
- GridColumn[] columns = table.getColumns();
- if (event.x <= columns[0].getWidth()) {
- for (int i = 0; i < table.getItemCount(); i++) {
- for (int j = 0; j < table.getColumns().length; j++) {
- table.getItem(i).setChecked(j, false);
- }
- }
- String seq = item.getText(0).trim();
- for (int i = 0; i < table.getItemCount(); i++) {
- if (Integer.parseInt(seq) == i) {
- table.getItem(i).setChecked(6, true);
- } else {
- table.getItem(i).setChecked(6, false);
- }
- }
- } else {
- for (int i = 0; i < table.getItemCount(); i++) {
- table.getItem(i).setChecked(6, false);
- }
- }
- if (event.y > table.getItemHeight() * (table.getItemCount() + 1)) {
- for (int i = 0; i < table.getItemCount(); i++) {
- table.getItem(i).setChecked(6, false);
- }
- }
- }
-
private int getMouseColumnIdnex(GridItem item, Event event) {
+ nowMousePositionX = event.x;
+ nowMousePositionY = event.y;
GridColumn[] columns = table.getColumns();
int size = columns.length;
int preColunmStartX = 0;
}
private void tableRedraw() {
- table.redraw();
- setTableItemsList();
+ table.redraw(nowMousePositionX - 100, nowMousePositionY - 100, 100, 100, false);
}
-
- private void updateVaildState(){
- if(updateVaildItems()){
+
+ private void updateVaildState() {
+ if (updateVaildItems()) {
enableSaveButton();
- }else{
+ } else {
disableSaveButton();
}
table.redraw();
}
private void enableSaveButton() {
- if(null != ReplayEditDialogDataManager.getInstance().getOkButton()){
- ReplayEditDialogDataManager.getInstance().getOkButton().setButtonEnabled(true);
+ if (null != ReplayEditDialogDataManager.getInstance().getOkButton()) {
+ ReplayEditDialogDataManager.getInstance().getOkButton()
+ .setButtonEnabled(true);
}
- if(null != ReplayEditDialogDataManager.getInstance().getSaveButton()){
- ReplayEditDialogDataManager.getInstance().getSaveButton().setButtonEnabled(true);
+ if (null != ReplayEditDialogDataManager.getInstance().getSaveButton()) {
+ ReplayEditDialogDataManager.getInstance().getSaveButton()
+ .setButtonEnabled(true);
}
}
private void disableSaveButton() {
- if(null != ReplayEditDialogDataManager.getInstance().getOkButton()){
- ReplayEditDialogDataManager.getInstance().getOkButton().setButtonEnabled(false);
+ if (null != ReplayEditDialogDataManager.getInstance().getOkButton()) {
+ ReplayEditDialogDataManager.getInstance().getOkButton()
+ .setButtonEnabled(false);
}
- if(null != ReplayEditDialogDataManager.getInstance().getSaveButton()){
- ReplayEditDialogDataManager.getInstance().getSaveButton().setButtonEnabled(false);
+ if (null != ReplayEditDialogDataManager.getInstance().getSaveButton()) {
+ ReplayEditDialogDataManager.getInstance().getSaveButton()
+ .setButtonEnabled(false);
}
}
- private void setTableItemsList() {
- List<List<String>> gridItemTextList = new ArrayList<List<String>>();
- for (int i = 0; i < table.getItemCount(); i++) {
- List<String> text = new ArrayList<String>();
- int size = table.getColumns().length;
- for (int j = 0; j < size + 1; j++) {
- text.add(table.getItem(i).getText(j));
- }
- gridItemTextList.add(text);
- }
- ReplayEditDialogDataManager.getInstance().setTableItemsList(
- gridItemTextList);
- }
-
@Override
public void setColumns(String[] columnNames) {
this.columnNames = columnNames;
return CommonConstants.EMPTY;
}
}
-
- public void testPrintItemsText(){
- System.out.println("getMouseSelectedTableItemText() : "
- + getMouseSelectedTableItemText()
- + " getMouseSelectedTableItemIndex() : "
- + getMouseSelectedTableItemIndex()
- + " getMouseSelectedTableColumnIndex() : "
- + getMouseSelectedTableColumnIndex()
- + " getMouseSelectedItemOptionText() : "
- + getMouseSelectedItemOptionText());
- int nSize = table.getItemCount();
- for (int i = 0; i < nSize; i++) {
- System.out.print("index : "+i);
- for(int j = 0 ; j <= table.getColumns().length ; j++){
- System.out.print("("+j+" : "+table.getItem(i).getText(j)+")");
- }
- System.out.println();
- }
- }
+
+ // public void testPrintItemsText(){
+ // System.out.println("getMouseSelectedTableItemText() : "
+ // + getMouseSelectedTableItemText()
+ // + " getMouseSelectedTableItemIndex() : "
+ // + getMouseSelectedTableItemIndex()
+ // + " getMouseSelectedTableColumnIndex() : "
+ // + getMouseSelectedTableColumnIndex()
+ // + " getMouseSelectedItemOptionText() : "
+ // + getMouseSelectedItemOptionText());
+ // int nSize = table.getItemCount();
+ // for (int i = 0; i < nSize; i++) {
+ // System.out.print("index : "+i);
+ // for(int j = 0 ; j <= table.getColumns().length ; j++){
+ // System.out.print("("+j+" : "+table.getItem(i).getText(j)+")");
+ // }
+ // System.out.println();
+ // }
+ // }
}