use of com.tencent.wstt.gt.views.GTPerfDetailView 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.views.GTPerfDetailView in project GT by Tencent.
the class GTPerfGroupDetailActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gt_perf_detail);
Intent intent = this.getIntent();
if (intent == null) {
finish();
}
Bundle extras = intent.getExtras();
if (extras == null) {
finish();
}
String name = extras.getString("name");
String parentName = extras.getString("parent_name");
long tid = extras.getLong("tid");
dataSet = GTTimeInternal.findTagTimeEntry(tid, parentName, name);
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 = GTTimeInternal.getLastSaveTimeDetail();
if (lastSaveLog != null && lastSaveLog.contains(".") && lastSaveLog.endsWith(LogUtils.TLOG_POSFIX)) {
lastSaveLog = lastSaveLog.substring(0, lastSaveLog.lastIndexOf("."));
}
lastSaveLog = lastSaveLog.trim();
et_savePath.setText(lastSaveLog);
dlg_save.show();
}
});
RelativeLayout rl_save = (RelativeLayout) LayoutInflater.from(this).inflate(R.layout.gt_dailog_save, 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_savePath.setText("");
}
});
et_savePath = (EditText) rl_save.findViewById(R.id.save_editor);
String lastSaveLog = GTTimeInternal.getLastSaveTimeDetail();
if (lastSaveLog != null && lastSaveLog.contains(".") && lastSaveLog.endsWith(LogUtils.TLOG_POSFIX)) {
lastSaveLog = lastSaveLog.substring(0, lastSaveLog.lastIndexOf("."));
}
et_savePath.setText(lastSaveLog);
dlg_save = new Builder(this).setTitle(getString(R.string.save_file)).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) {
GTTimeInternal.saveTimeLogDetail(et_savePath.getText().toString().trim(), dataSet);
dialog.dismiss();
}
}).create();
tvGroup = (TextView) findViewById(R.id.bh_perf_detail_group);
tvGroup.setMovementMethod(ScrollingMovementMethod.getInstance());
tvTag = (TextView) findViewById(R.id.bh_perf_detail_tag);
tvTag.setMovementMethod(ScrollingMovementMethod.getInstance());
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);
tvGroup.setText(parentName);
if (tid != 0) {
tvTag.setText(dataSet.getNameT());
} else {
tvTag.setText(name);
}
tvTimes.setText(dataSet.getRecordSizeText());
tvMin.setText(dataSet.getMin());
tvMax.setText(dataSet.getMax());
tvAve.setText(dataSet.getAve());
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.views.GTPerfDetailView in project GT by Tencent.
the class GTOpSinglePerfActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gt_perf_op_detail);
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);
// 保存对应的出参变量,以便刷值
op = ClientManager.getInstance().getClient(client).getOutPara(name);
// 在onCreat之前数据源可能被清理了,这样就不打开页面
if (null == dataSet) {
// finish();
// return;
dataSet = new TagTimeEntry(null);
dataSet.setName(name);
dataSet.setExkey(ClientManager.getInstance().getClientKey(client));
}
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();
}
});
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_savePath3 = (EditText) rl_save.findViewById(R.id.save_editor);
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 = (EditText) rl_save.findViewById(R.id.save_editor_folder_parent1);
et_savePath1.setText(Env.CUR_APP_NAME);
et_savePath2 = (EditText) rl_save.findViewById(R.id.save_editor_folder_parent2);
et_savePath2.setText(Env.CUR_APP_VER);
et_saveTestDesc = (EditText) rl_save.findViewById(R.id.save_editor_desc);
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(GTOpSinglePerfActivity.this, getString(R.string.save_folder_valid));
return;
}
String path2 = et_savePath2.getText().toString().trim();
if (!StringUtil.isLetter(path1)) {
ToastUtil.ShowShortToast(GTOpSinglePerfActivity.this, getString(R.string.save_folder_valid));
return;
}
String path3 = et_savePath3.getText().toString().trim();
if (!StringUtil.isLetter(path3)) {
ToastUtil.ShowShortToast(GTOpSinglePerfActivity.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();
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);
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];
}
tvTimes.setText(anchorEntry.getRecordSizeText());
tvMin.setText(anchorEntry.getMin());
tvMax.setText(anchorEntry.getMax());
tvAve.setText(anchorEntry.getAve());
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);
}
Aggregations