1 package jarmos.app.activity.kermor;
11 import android.app.Activity;
12 import android.app.ProgressDialog;
13 import android.content.DialogInterface;
14 import android.content.DialogInterface.OnCancelListener;
15 import android.os.Bundle;
16 import android.os.Handler;
17 import android.os.Message;
18 import android.util.Log;
19 import android.view.View;
20 import android.widget.Button;
21 import android.widget.TableLayout;
22 import android.widget.Toast;
38 private ProgressDialog pd;
44 protected void onCreate(Bundle savedInstanceState) {
45 super.onCreate(savedInstanceState);
46 setContentView(
R.layout.kermor_main);
50 mng = Const.getModelManager(getApplicationContext(), getIntent());
52 Log.e(
"SimulationActivity",
"Creation of ModelManager failed", e);
57 pd = ProgressDialog.show(SimulationActivity.this,
"Loading model data",
"",
true,
true,
new OnCancelListener() {
59 public void onCancel(DialogInterface dialog) {
66 final Handler sh =
new Handler() {
68 public void handleMessage(Message msg) {
71 Toast.makeText(SimulationActivity.this,
"Model successfully simulated!", Toast.LENGTH_LONG).show();
76 Button solveButton = (Button) findViewById(
R.id.solveButton);
77 solveButton.setOnClickListener(
new View.OnClickListener() {
78 public void onClick(View view) {
79 pd = ProgressDialog.show(SimulationActivity.this,
"",
"Solving...");
84 sh.sendEmptyMessage(0);
86 Log.e(
"SimulationActivity",
"Error simulating", e);
95 public void handleMessage(Message msg) {
96 pd.setMessage(msg.getData().getString(
"file") +
"...");
99 mng.addMessageHandler(progressHandler);
101 final Handler h =
new Handler() {
103 public void handleMessage(Message msg) {
106 pb.createBars((TableLayout) findViewById(
R.id.paramLayout));
109 mng.removeMessageHandler(progressHandler);
111 Toast.makeText(SimulationActivity.this,
"Model successfully loaded!", Toast.LENGTH_LONG).show();
131 rm.loadOfflineData(mng);
132 }
catch (Exception e) {
133 Log.e(
"SimulationActivity",
"Error loading reduced model.", e);
135 h.sendEmptyMessage(0);
A helper class for a collection of UI elements regarding model parameter display. ...
Main reduced model class.
This class serves as base class for accessing various types of models at different locations...
Custom exception for JKerMor related errors.
The JKerMor model simulation activity.
This Exception gets thrown when an error occurs regarding the functionality of the ModelManager...
void onCreate(Bundle savedInstanceState)
Class that contains miscellaneous JaRMoS specific constants and static functions. ...
A progress notification handler implementation for android platforms.