use of com.tencent.wstt.gt.ui.model.TagTimeEntry in project GT by Tencent.
the class GTOpMulPerfActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gt_perf_op_mul_detail);
Intent intent = this.getIntent();
if (intent == null) {
finish();
}
Bundle extras = intent.getExtras();
if (extras == null) {
finish();
}
final String name = extras.getString("name");
final String alias = extras.getString("alias");
final String client = extras.getString("client");
// 出参的性能数据源取法
dataSet = OpPerfBridge.getProfilerData(name);
// 在onCreat之前数据源可能被清理了,这样就不打开页面
if (null == dataSet) {
finish();
return;
}
// 保存对应的出参变量,以便刷值
op = ClientManager.getInstance().getClient(client).getOutPara(name);
attentEntry = dataSet.getSubTagEntrys()[0];
about = dataSet.getDesc();
tvTitle = (TextView) findViewById(R.id.perf_detail_title);
tvTitle.setText(alias);
tvKey = (TextView) findViewById(R.id.op_perf_detail_key);
tvKey.setText(name);
tvAbout = (TextView) findViewById(R.id.op_perf_detail_about);
tvAbout.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
GTOutParaPerfDialog dialog = new GTOutParaPerfDialog(v.getContext(), alias, name, about);
dialog.show();
}
});
lv_attentAttr = (ListView) findViewById(R.id.op_perf_detail_attent_list);
attrAdapter = new ArrayAdapter<String>(this, R.layout.gt_simple_dropdown_item);
for (TagTimeEntry itemName : dataSet.getChildren()) {
attrAdapter.add(itemName.getName());
}
lv_attentAttr.setAdapter(attrAdapter);
lv_attentAttr.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long arg3) {
img_empty.setVisibility(View.GONE);
lv_attentAttr.setVisibility(View.GONE);
String lastSelectedItem = btn_attent.getText().toString();
btn_attent.setText(attrAdapter.getItem(position));
attentEntry = dataSet.getSubTagEntrys()[position];
if (!lastSelectedItem.equals(attentEntry.getName())) {
refreshAttent();
refreshThreshold();
}
}
});
/*
* 用于覆盖整个屏幕的透明ImageView,
* 主要帮助点击非lv_attentAttr区域使lv_attentAttr消失
*/
img_empty = (ImageView) findViewById(R.id.view_empty);
img_empty.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
img_empty.setVisibility(View.GONE);
lv_attentAttr.setVisibility(View.GONE);
return true;
}
});
btn_attent = (Button) findViewById(R.id.op_perf_detail_attent);
btn_attent.setText(attrAdapter.getItem(0));
btn_attent.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
btn_attent.setBackgroundResource(R.drawable.a_gt_perf_op_btn_selected_border);
handler.postDelayed(new Runnable() {
@Override
public void run() {
btn_attent.setBackgroundResource(R.drawable.a_gt_perf_op_btn_default_border);
}
}, 200);
if (lv_attentAttr.getVisibility() == View.VISIBLE) {
img_empty.setVisibility(View.GONE);
lv_attentAttr.setVisibility(View.GONE);
} else {
lv_attentAttr.setVisibility(View.VISIBLE);
img_empty.setVisibility(View.VISIBLE);
}
}
});
btn_back = (ImageButton) findViewById(R.id.perf_detail_back);
btn_back.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
finish();
}
});
// btn_save = (ImageButton)findViewById(R.id.perf_detail_save);
// btn_save.setOnClickListener(new OnClickListener() {
//
// public void onClick(View v) {
// String lastSaveLog = GTGWInternal.getLastSaveFolder();
// if (lastSaveLog != null && lastSaveLog.contains(".")
// && lastSaveLog.endsWith(LogUtils.TLOG_POSFIX))
// {
// lastSaveLog = lastSaveLog.substring(0, lastSaveLog.lastIndexOf("."));
// }
// et_savePath3.setText(lastSaveLog.trim());
// dlg_save.show();
// }
// });
RelativeLayout rl_save = (RelativeLayout) LayoutInflater.from(this).inflate(R.layout.gt_dailog_save_gw, null, false);
ImageButton btn_cleanSavePath = (ImageButton) rl_save.findViewById(R.id.save_clean);
btn_cleanSavePath.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
et_savePath3.setText("");
}
});
et_savePath1 = (EditText) rl_save.findViewById(R.id.save_editor_folder_parent1);
et_savePath2 = (EditText) rl_save.findViewById(R.id.save_editor_folder_parent2);
et_savePath3 = (EditText) rl_save.findViewById(R.id.save_editor);
et_saveTestDesc = (EditText) rl_save.findViewById(R.id.save_editor_desc);
String lastSaveLog = GTGWInternal.getLastSaveFolder();
if (lastSaveLog != null && lastSaveLog.contains(".") && lastSaveLog.endsWith(LogUtils.TLOG_POSFIX)) {
lastSaveLog = lastSaveLog.substring(0, lastSaveLog.lastIndexOf("."));
}
et_savePath3.setText(lastSaveLog);
et_savePath1.setText(Env.CUR_APP_NAME);
et_savePath2.setText(Env.CUR_APP_VER);
dlg_save = new Builder(this).setTitle(getString(R.string.save)).setView(rl_save).setPositiveButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).setNegativeButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String path1 = et_savePath1.getText().toString().trim();
if (!StringUtil.isLetter(path1)) {
ToastUtil.ShowShortToast(GTOpMulPerfActivity.this, getString(R.string.save_folder_valid));
return;
}
String path2 = et_savePath2.getText().toString().trim();
if (!StringUtil.isLetter(path2)) {
ToastUtil.ShowShortToast(GTOpMulPerfActivity.this, getString(R.string.save_folder_valid));
return;
}
String path3 = et_savePath3.getText().toString().trim();
if (!StringUtil.isLetter(path3)) {
ToastUtil.ShowShortToast(GTOpMulPerfActivity.this, getString(R.string.save_folder_valid));
return;
}
String testDesc = et_saveTestDesc.getText().toString().trim();
GWSaveEntry saveEntry = new GWSaveEntry(path1, path2, path3, testDesc);
GTGWInternal.saveGWData(saveEntry, dataSet);
dialog.dismiss();
}
}).create();
btn_delete = (ImageButton) findViewById(R.id.perf_detail_delete);
btn_delete.setOnClickListener(showDeleteDlg);
// 告警区操作的UI
tvWarningCntToast = (TextView) findViewById(R.id.op_perf_detail_warning_cnt_toast);
tvWarningCnt = (TextView) findViewById(R.id.bh_perf_detail_warning_cnt);
// 告警区
final LinearLayout ll_warnArea = (LinearLayout) findViewById(R.id.op_perf_detail_warnarea);
img_bottom_arrow = (ImageView) findViewById(R.id.bottom_arrow);
if (dataSet.getThresholdEntry().isEnable()) {
img_bottom_arrow.setBackgroundResource(R.drawable.unfold_arrow);
ll_warnArea.setVisibility(View.VISIBLE);
} else {
img_bottom_arrow.setBackgroundResource(R.drawable.fold_arrow);
ll_warnArea.setVisibility(View.GONE);
}
// 告警抬头文本
tvWaringArea = (TextView) findViewById(R.id.op_perf_detail_interval_toast);
// 折叠线
ll_fold = (LinearLayout) findViewById(R.id.warning_fold);
// 因为多曲线情况的各子项的告警的enable值是一起变化的,所以从一个判断决定UI初始状态即可
if (!attentEntry.getThresholdEntry().isEnable()) {
img_bottom_arrow.setBackgroundResource(R.drawable.fold_arrow);
ll_warnArea.setVisibility(View.GONE);
tvWarningCntToast.setVisibility(View.GONE);
tvWarningCnt.setVisibility(View.GONE);
tvWaringArea.setText(getString(R.string.warning_title_mul_disable));
}
ll_fold.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO 需要对所有的子项告警全开和全屏蔽,UI与业务逻辑混一起了,需要重构
if (attentEntry.getThresholdEntry().isEnable()) {
for (TagTimeEntry temp : dataSet.getSubTagEntrys()) {
temp.getThresholdEntry().setEnable(false);
}
img_bottom_arrow.setBackgroundResource(R.drawable.fold_arrow);
ll_warnArea.setVisibility(View.GONE);
tvWarningCntToast.setVisibility(View.GONE);
tvWarningCnt.setVisibility(View.GONE);
tvWaringArea.setText(getString(R.string.warning_title_mul_disable));
} else {
for (TagTimeEntry temp : dataSet.getSubTagEntrys()) {
temp.getThresholdEntry().setEnable(true);
}
img_bottom_arrow.setBackgroundResource(R.drawable.unfold_arrow);
ll_warnArea.setVisibility(View.VISIBLE);
tvWarningCntToast.setVisibility(View.VISIBLE);
tvWarningCnt.setVisibility(View.VISIBLE);
tvWaringArea.setText(getString(R.string.warning_title_mul));
}
}
});
// 从未开始统计过的出参,不允许设置告警
if (!op.hasMonitorOnce) {
etUpperInterval.setEnabled(false);
etUpperValue.setEnabled(false);
etLowerValue.setEnabled(false);
} else {
etUpperInterval = (EditText) findViewById(R.id.op_perf_detail_upper_interval);
etUpperValue = (EditText) findViewById(R.id.op_perf_detail_upper_value);
etLowerValue = (EditText) findViewById(R.id.op_perf_detail_lower_value);
etUpperInterval.setInputType(EditorInfo.TYPE_CLASS_PHONE);
etUpperValue.setInputType(EditorInfo.TYPE_CLASS_PHONE);
etLowerValue.setInputType(EditorInfo.TYPE_CLASS_PHONE);
etUpperInterval.setOnKeyListener(thresholdKeyListener);
etUpperValue.setOnKeyListener(thresholdKeyListener);
etLowerValue.setOnKeyListener(thresholdKeyListener);
refreshThreshold();
}
tvValue = (TextView) findViewById(R.id.op_perf_detail_value);
tvTimes = (TextView) findViewById(R.id.bh_perf_detail_times);
tvMin = (TextView) findViewById(R.id.bh_perf_detail_min);
tvMax = (TextView) findViewById(R.id.bh_perf_detail_max);
tvAve = (TextView) findViewById(R.id.bh_perf_detail_ave);
// tvValue.setText(dataSet.getLastValue());
tvValue.setText(op.getValue());
refreshAttent();
LinearLayout ll_chart = (LinearLayout) findViewById(R.id.bh_perf_detail_chart);
chartView = new GTMulOpPerfDetailView(this, dataSet);
chartView.setInput(0);
ll_chart.addView(chartView);
}
use of com.tencent.wstt.gt.ui.model.TagTimeEntry in project GT by Tencent.
the class GTOpSinglePerfActivity method createRealtimeData.
/*
* 用实时数据更新图表数据
*/
private void createRealtimeData() {
TagTimeEntry anchorEntry = dataSet;
if (dataSet.getSubTagEntrys().length > 0) {
anchorEntry = dataSet.getSubTagEntrys()[0];
}
if (anchorEntry.getRecordSize() == lastdataSetLength) {
return;
}
lastdataSetLength = anchorEntry.getRecordSize();
int start = lastdataSetLength > GTPerfDetailView.xMax ? lastdataSetLength - GTPerfDetailView.xMax : 0;
chartView.setInput(start);
chartView.postInvalidate();
}
use of com.tencent.wstt.gt.ui.model.TagTimeEntry in project GT by Tencent.
the class GTAUTFragment method hashistory.
private void hashistory(final int type) {
// 当去除性能指标项的勾选时,查看是否该项存在历史数据,有则提示,无则直接删除
String outparaname = cb_alias[type];
AlertDialog.Builder builder = new Builder(getActivity());
boolean hasdata = true;
ArrayList<String> tempL = new ArrayList<String>();
tempL = (ArrayList<String>) AUTManager.registOpTable.get(outparaname);
if (tempL != null) {
for (int i = 0; i < tempL.size(); i++) {
TagTimeEntry tte = OpPerfBridge.getProfilerData((String) tempL.get(i));
if (tte == null) {
hasdata = false;
} else {
if (tte.hasChild() && tte.getChildren()[0].getRecordSize() > 0) {
hasdata = true;
} else if (tte.getRecordSize() <= 0) {
hasdata = false;
}
}
}
if (!hasdata) {
unregisterOutpara(type);
} else {
builder.setMessage(getString(R.string.AUT_page_tip1));
builder.setTitle(getString(R.string.AUT_page_tip_title));
builder.setPositiveButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
cb_boxs[type].setChecked(true);
}
});
builder.setNegativeButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// UI需要清理dataSet
unregisterOutpara(type);
dialog.dismiss();
}
});
builder.setCancelable(false);
builder.show();
}
}
}
use of com.tencent.wstt.gt.ui.model.TagTimeEntry in project GT by Tencent.
the class GTOpSMActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gt_perf_op_detail_sm);
Intent intent = this.getIntent();
Bundle extras = intent.getExtras();
final String name = extras.getString("name");
final String alias = extras.getString("alias");
final String client = extras.getString("client");
// 出参的性能数据源取法
dataSet = OpPerfBridge.getProfilerData(name);
// 在onCreat之前数据源可能被清理了,这样就不打开页面
if (null == dataSet) {
finish();
return;
}
// 保存对应的出参变量,以便刷值
op = ClientManager.getInstance().getClient(client).getOutPara(name);
about = dataSet.getDesc();
tvTitle = (TextView) findViewById(R.id.perf_detail_title);
// tvTitle.setText(alias);
tvTitle.setText("SM for Test");
tvKey = (TextView) findViewById(R.id.op_perf_detail_key);
tvKey.setText(name);
tvAbout = (TextView) findViewById(R.id.op_perf_detail_about);
tvAbout.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
GTOutParaPerfDialog dialog = new GTOutParaPerfDialog(v.getContext(), alias, name, about);
dialog.show();
}
});
btn_back = (ImageButton) findViewById(R.id.perf_detail_back);
btn_back.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
finish();
}
});
// btn_save = (ImageButton)findViewById(R.id.perf_detail_save);
// btn_save.setOnClickListener(new OnClickListener() {
//
// public void onClick(View v) {
// String lastSaveLog = GTGWInternal.getLastSaveFolder();
// if (lastSaveLog != null && lastSaveLog.contains(".")
// && lastSaveLog.endsWith(LogUtils.TLOG_POSFIX))
// {
// lastSaveLog = lastSaveLog.substring(0, lastSaveLog.lastIndexOf("."));
// }
// et_savePath3.setText(lastSaveLog.trim());
// dlg_save.show();
// }
// });
btn_delete = (ImageButton) findViewById(R.id.perf_detail_delete);
btn_delete.setOnClickListener(showDeleteDlg);
// 告警区
final LinearLayout ll_warnArea = (LinearLayout) findViewById(R.id.op_perf_detail_warnarea);
img_bottom_arrow = (ImageView) findViewById(R.id.bottom_arrow);
if (dataSet.getThresholdEntry().isEnable()) {
img_bottom_arrow.setBackgroundResource(R.drawable.unfold_arrow);
ll_warnArea.setVisibility(View.VISIBLE);
} else {
img_bottom_arrow.setBackgroundResource(R.drawable.fold_arrow);
ll_warnArea.setVisibility(View.GONE);
}
// 告警抬头文本
tvWaringArea = (TextView) findViewById(R.id.op_perf_detail_interval_toast);
if (!dataSet.getThresholdEntry().isEnable()) {
tvWaringArea.setText(getString(R.string.warning_title_disable));
}
// 折叠线
ll_fold = (LinearLayout) findViewById(R.id.warning_fold);
ll_fold.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (dataSet.getThresholdEntry().isEnable()) {
dataSet.getThresholdEntry().setEnable(false);
img_bottom_arrow.setBackgroundResource(R.drawable.fold_arrow);
ll_warnArea.setVisibility(View.GONE);
tvWaringArea.setText(getString(R.string.warning_title_disable));
} else {
dataSet.getThresholdEntry().setEnable(true);
img_bottom_arrow.setBackgroundResource(R.drawable.unfold_arrow);
ll_warnArea.setVisibility(View.VISIBLE);
tvWaringArea.setText(getString(R.string.warning_title));
}
}
});
etUpperInterval = (EditText) findViewById(R.id.op_perf_detail_upper_interval);
etUpperValue = (EditText) findViewById(R.id.op_perf_detail_upper_value);
etLowerValue = (EditText) findViewById(R.id.op_perf_detail_lower_value);
// 从未开始统计过的出参,不允许设置告警
if (!op.hasMonitorOnce) {
etUpperInterval.setEnabled(false);
etUpperValue.setEnabled(false);
etLowerValue.setEnabled(false);
// isfoldWarnArea = true;
// img_bottom_arrow.setBackgroundResource(R.drawable.unfold_arrow);
// ll_warnArea.setVisibility(View.GONE);
} else {
etUpperInterval.setInputType(EditorInfo.TYPE_CLASS_PHONE);
etUpperValue.setInputType(EditorInfo.TYPE_CLASS_PHONE);
etLowerValue.setInputType(EditorInfo.TYPE_CLASS_PHONE);
etUpperInterval.setOnKeyListener(thresholdKeyListener);
etUpperValue.setOnKeyListener(thresholdKeyListener);
etLowerValue.setOnKeyListener(thresholdKeyListener);
int upperDuration = dataSet.getThresholdEntry().getduration();
if (upperDuration != Integer.MAX_VALUE) {
etUpperInterval.setText(Integer.toString(upperDuration));
}
double upperValue = dataSet.getThresholdEntry().getUpperValue();
if (upperValue != Integer.MAX_VALUE) {
etUpperValue.setText(Double.toString(upperValue));
}
double lowerValue = dataSet.getThresholdEntry().getLowerValue();
if (lowerValue != Integer.MIN_VALUE) {
etLowerValue.setText(Double.toString(lowerValue));
}
}
RelativeLayout rl_save = (RelativeLayout) LayoutInflater.from(this).inflate(R.layout.gt_dailog_save_gw, null, false);
ImageButton btn_cleanSavePath = (ImageButton) rl_save.findViewById(R.id.save_clean);
btn_cleanSavePath.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
et_savePath3.setText("");
}
});
et_savePath1 = (EditText) rl_save.findViewById(R.id.save_editor_folder_parent1);
et_savePath2 = (EditText) rl_save.findViewById(R.id.save_editor_folder_parent2);
et_savePath3 = (EditText) rl_save.findViewById(R.id.save_editor);
et_saveTestDesc = (EditText) rl_save.findViewById(R.id.save_editor_desc);
String lastSaveLog = GTGWInternal.getLastSaveFolder();
if (lastSaveLog != null && lastSaveLog.contains(".") && lastSaveLog.endsWith(LogUtils.TLOG_POSFIX)) {
lastSaveLog = lastSaveLog.substring(0, lastSaveLog.lastIndexOf("."));
}
et_savePath3.setText(lastSaveLog);
et_savePath1.setText(Env.CUR_APP_NAME);
et_savePath2.setText(Env.CUR_APP_VER);
dlg_save = new Builder(this).setTitle(getString(R.string.save)).setView(rl_save).setPositiveButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).setNegativeButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String path1 = et_savePath1.getText().toString().trim();
if (!StringUtil.isLetter(path1)) {
ToastUtil.ShowShortToast(GTOpSMActivity.this, getString(R.string.save_folder_valid));
return;
}
String path2 = et_savePath2.getText().toString().trim();
if (!StringUtil.isLetter(path2)) {
ToastUtil.ShowShortToast(GTOpSMActivity.this, getString(R.string.save_folder_valid));
return;
}
String path3 = et_savePath3.getText().toString().trim();
if (!StringUtil.isLetter(path3)) {
ToastUtil.ShowShortToast(GTOpSMActivity.this, getString(R.string.save_folder_valid));
return;
}
String testDesc = et_saveTestDesc.getText().toString().trim();
GWSaveEntry saveEntry = new GWSaveEntry(path1, path2, path3, testDesc);
GTGWInternal.saveGWDataForSM(saveEntry, dataSet);
dialog.dismiss();
}
}).create();
tvValue = (TextView) findViewById(R.id.op_perf_detail_value);
tvTimes = (TextView) findViewById(R.id.bh_perf_detail_times);
tvMin = (TextView) findViewById(R.id.bh_perf_detail_min);
// tvMax = (TextView) findViewById(R.id.bh_perf_detail_max);
tvAve = (TextView) findViewById(R.id.bh_perf_detail_ave);
tvScore = (TextView) findViewById(R.id.bh_perf_detail_score);
tvGood = (TextView) findViewById(R.id.bh_perf_detail_good);
tvBad = (TextView) findViewById(R.id.bh_perf_detail_bad);
tvWarningCnt = (TextView) findViewById(R.id.bh_perf_detail_warning_cnt);
if (op == null) {
tvValue.setText(dataSet.getLastValue());
} else {
tvValue.setText(op.getValue());
}
TagTimeEntry anchorEntry = dataSet;
if (dataSet.getSubTagEntrys().length > 0) {
anchorEntry = dataSet.getSubTagEntrys()[0];
}
ArrayList<Integer> smrs = SMUtils.getSmDetail(anchorEntry.getRecordList());
if (smrs.size() < 6) {
finish();
return;
}
dataSet.exInt_1 = smrs.get(1);
dataSet.exInt_2 = smrs.get(3);
dataSet.exInt_3 = smrs.get(5);
tvTimes.setText(anchorEntry.getRecordSizeText());
tvMin.setText(anchorEntry.getMin());
// tvMax.setText(anchorEntry.getMax());
tvAve.setText(anchorEntry.getAve());
tvScore.setText(smrs.get(5).toString());
tvGood.setText(smrs.get(3).toString());
tvBad.setText(smrs.get(1).toString());
tvWarningCnt.setText(Integer.toString(anchorEntry.getThresholdEntry().getUpperWariningCount() + anchorEntry.getThresholdEntry().getLowerWariningCount()));
LinearLayout ll_chart = (LinearLayout) findViewById(R.id.bh_perf_detail_chart);
chartView = new GTPerfDetailView(this, dataSet);
chartView.setInput(0);
ll_chart.addView(chartView);
}
use of com.tencent.wstt.gt.ui.model.TagTimeEntry in project GT by Tencent.
the class GTParamOutListAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ParamConst.ViewHolderDrag_nopic switch_drag = null;
final OutPara ov = (OutPara) list.get(position);
final String key = ov.getKey();
String value = ov.getFreezValue();
// 已记录历史数据个数的获取
TagTimeEntry tte = OpPerfBridge.getProfilerData(key);
int his_count = 0;
if (tte != null) {
if (tte.hasChild()) {
his_count = tte.getChildren()[0].getRecordSize();
} else {
his_count = tte.getRecordSize();
}
}
final String alias = ov.getAlias();
final int type = getItemViewType(position);
/*
* 根据每行UI的类型进行UI模型准备与数据准备
*/
int disable_pos = OpUIManager.getOutListDisableTitlePosition();
switch(type) {
case TYPE_PROMPT_ITEM:
convertView = PROMPT_ITEM_convertView;
break;
case TYPE_DIVIDE_ITEM:
convertView = DIVIDE_ITEM_convertView;
break;
case TYPE_DISABLE_ITEM:
convertView = DISABLE_ITEM_convertView;
break;
case TYPE_SWITCH_ITEM:
if (convertView == null) {
convertView = mInflater.inflate(R.layout.gt_outlistrow_value, null);
switch_drag = new ParamConst.ViewHolderDrag_nopic();
switch_drag.tv_key = (TextView) convertView.findViewById(R.id.draglist_key);
switch_drag.tv_alias = (TextView) convertView.findViewById(R.id.draglist_shotkey);
switch_drag.tv_value = (TextView) convertView.findViewById(R.id.draglist_value);
switch_drag.tv_listview_bottom_border = (TextView) convertView.findViewById(R.id.listrow_bottom_border);
switch_drag.tv_his_data = (TextView) convertView.findViewById(R.id.data_flag);
switch_drag.tv_listrowbg = (TextView) convertView.findViewById(R.id.listrow_bg);
switch_drag.cb = (CheckBox) convertView.findViewById(R.id.cb_tick);
} else {
switch_drag = (ParamConst.ViewHolderDrag_nopic) convertView.getTag();
}
if (ov.isAlert()) {
switch_drag.tv_listrowbg.setBackgroundColor(context.getResources().getColor(R.color.orange));
switch_drag.tv_listrowbg.getBackground().setAlpha(80);
} else {
switch_drag.tv_listrowbg.setBackgroundColor(Color.TRANSPARENT);
}
if (OpUIManager.gw_running) {
switch_drag.cb.setClickable(false);
switch_drag.cb.setEnabled(false);
} else {
switch_drag.cb.setEnabled(true);
switch_drag.cb.setClickable(true);
}
switch_drag.cb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!ov.isMonitor()) {
/*
* 当ov的数据长度大于15万条时,提示用户先保存和清除
*/
TagTimeEntry tte = OpPerfBridge.getProfilerData(ov.getKey());
if (ov.hasMonitorOnce && null != tte) {
int size = 0;
if (tte.hasChild()) {
size = tte.getChildren()[0].getRecordSize();
} else {
size = tte.getRecordSize();
}
if (size >= GTMemoryDaemonThread.singleLimit) {
ToastUtil.ShowLongToast(context, "OutPara " + ov.getAlias() + " has more than " + GTMemoryDaemonThread.singleLimit + " records." + "You should save and clear records first.");
return;
}
}
ov.setMonitor(true);
OpUIManager.list_change = true;
// 如果是第一次启动监视,需要初始化出参对应的性能数据对象
if (!ov.hasMonitorOnce) {
OpPerfBridge.registMonitor(ov);
}
} else {
ov.setMonitor(false);
OpUIManager.list_change = true;
OpPerfBridge.endProfier(ov);
}
}
});
if (position > disable_pos) {
switch_drag.tv_key.setTextColor(Color.GRAY);
switch_drag.tv_alias.setTextColor(Color.GRAY);
switch_drag.tv_value.setTextColor(Color.GRAY);
switch_drag.cb.setChecked(ov.isMonitor());
switch_drag.cb.setEnabled(false);
switch_drag.cb.setVisibility(View.GONE);
} else {
switch_drag.cb.setVisibility(View.VISIBLE);
}
convertView.setTag(switch_drag);
break;
}
// 数据修改部分
switch(type) {
case TYPE_PROMPT_ITEM:
if (((OutPara) list.get(1)).getKey().equals(ParamConst.DIVID_TITLE)) {
PROMPT_ITEM_title.setText(ParamConst.PROMPT_INIT_TITLE);
} else {
PROMPT_ITEM_title.setText(ParamConst.PROMPT_TITLE);
}
break;
case TYPE_DIVIDE_ITEM:
if (position > 1) {
DIVIDE_ITEM_top_border.setVisibility(View.VISIBLE);
} else {
DIVIDE_ITEM_top_border.setVisibility(View.GONE);
}
break;
case TYPE_SWITCH_ITEM:
switch_drag.tv_key.setText(key);
switch_drag.tv_alias.setText(alias);
switch_drag.tv_value.setText(value);
if (his_count <= 0) {
switch_drag.tv_his_data.setVisibility(View.GONE);
} else if (his_count < 100) {
switch_drag.tv_his_data.setText(Integer.toString(his_count));
switch_drag.tv_his_data.setVisibility(View.VISIBLE);
} else {
switch_drag.tv_his_data.setText("99+");
switch_drag.tv_his_data.setVisibility(View.VISIBLE);
}
if (position == (list.size() - 1)) {
switch_drag.tv_listview_bottom_border.setVisibility(View.VISIBLE);
} else {
switch_drag.tv_listview_bottom_border.setVisibility(View.GONE);
}
if (position > disable_pos) {
switch_drag.tv_key.setTextColor(Color.GRAY);
switch_drag.tv_alias.setTextColor(Color.GRAY);
switch_drag.tv_value.setTextColor(Color.GRAY);
} else {
switch_drag.tv_key.setTextColor(Color.WHITE);
switch_drag.tv_alias.setTextColor(Color.WHITE);
switch_drag.tv_value.setTextColor(Color.WHITE);
}
switch_drag.cb.setChecked(ov.isMonitor());
break;
case TYPE_DISABLE_ITEM:
if (2 == position || position > 1 && ((OutPara) list.get(position - 1)).getKey().equals(ParamConst.DIVID_TITLE)) {
DISABLE_ITEM_top_border.setVisibility(View.GONE);
} else {
DISABLE_ITEM_top_border.setVisibility(View.VISIBLE);
}
break;
}
return convertView;
}
Aggregations