List of usage examples for java.util.concurrent ExecutionException printStackTrace
public void printStackTrace()
From source file:it.uniroma2.foundme.studente.ReadMessageActivity.java
public static void populateView(String[] result) { messages = new String[result.length]; final ArrayList<String> listp = new ArrayList<String>(); for (int i = 0; i < result.length; i++) { if (i == 0 && result[0].equalsIgnoreCase(Variables_it.NO_MSG)) { listp.add(result[0]);//from ww w.java2 s. c o m messages[0] = result[0]; break; } else { String[] items = result[i].split(","); String ap = "[" + items[0] + "] " + items[1]; listp.add(ap); messages[i] = items[2]; } } //creo l'adapter ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, listp); //inserisco i dati lvMessaggi.setAdapter(adapter); swipeMsg.setColorSchemeColors(0xff429874, 0xffffffff, 0xff429874, 0xffffffff); swipeMsg.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { swipeMsg.setRefreshing(true); (new Handler()).postDelayed(new Runnable() { @Override public void run() { swipeMsg.setRefreshing(false); try { getMsg(Title, false); } catch (ExecutionException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } }, 3000); } }); lvMessaggi.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (!messages[position].equalsIgnoreCase(Variables_it.NO_MSG)) { Intent i = new Intent(context, ShowMsgActivity.class); i.putExtra(Variables_it.COURSE, Title); i.putExtra(Variables_it.MID, messages[position]); i.putExtra(Variables_it.ID, Sid); i.putExtra(Variables_it.TITLE, listp.get(position)); context.startActivity(i); } } }); lvMessaggi.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView absListView, int i) { } @Override public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (firstVisibleItem == 0) swipeMsg.setEnabled(true); else swipeMsg.setEnabled(false); } }); }
From source file:org.polymap.kaps.ui.form.RichtwertzoneProvider.java
public static SortedMap<String, Object> findFor(GemeindeComposite gemeinde) { // long start = System.currentTimeMillis(); SortedMap<String, Object> ret = null; try {// w ww.j a v a2 s . c o m ret = getCache().get(gemeinde); } catch (ExecutionException e) { e.printStackTrace(); ret = new TreeMap(); } // log.info( "findFor: " + gemeinde.schl().get() + " needed " + (System.currentTimeMillis() - start) + "ms" ); return ret; }
From source file:it.uniroma2.foundme.studente.ShowCourseActivity.java
public static void populateView(String[] result) { courses = new String[result.length]; System.arraycopy(result, 0, courses, 0, result.length); List<Map<String, String>> data = new ArrayList<Map<String, String>>(); for (int i = 0; i < result.length; i++) { Map<String, String> datum = new HashMap<String, String>(2); if (i == 0 && result[0].equalsIgnoreCase(Variables_it.NO_COURSE)) { datum.put(Variables_it.COURSE, result[0]); datum.put(Variables_it.PROF, ""); data.add(datum);//from w w w . j av a 2 s . com break; } else { String[] items = result[i].split(","); datum.put(Variables_it.COURSE, items[0]); datum.put(Variables_it.PROF, items[1]); data.add(datum); } } //creo l'adapter SimpleAdapter adapter = new SimpleAdapter(context, data, android.R.layout.simple_list_item_2, new String[] { Variables_it.COURSE, Variables_it.PROF }, new int[] { android.R.id.text1, android.R.id.text2 }); lvCorsiSeguiti.setAdapter(adapter); swipeShow.setColorSchemeColors(0xff429874, 0xffffffff, 0xff429874, 0xffffffff); swipeShow.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { swipeShow.setRefreshing(true); (new Handler()).postDelayed(new Runnable() { @Override public void run() { swipeShow.setRefreshing(false); try { getCourse(false); } catch (ExecutionException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } }, 3000); } }); lvCorsiSeguiti.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (!courses[position].equalsIgnoreCase(Variables_it.NO_COURSE)) { Intent i = new Intent(context, CourseActivity.class); i.putExtra(Variables_it.COURSE, courses[position]); ((Activity) context).startActivity(i); } } }); lvCorsiSeguiti.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView absListView, int i) { } @Override public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (firstVisibleItem == 0) swipeShow.setEnabled(true); else swipeShow.setEnabled(false); } }); }
From source file:it.uniroma2.foundme.studente.FollowCourseActivity.java
public static void alertMessage(final String info) { DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: extractData(info);/*from w w w . jav a2s .c o m*/ try { managefollowing(title, cfu, prof, Sid); } catch (ExecutionException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } break; case DialogInterface.BUTTON_NEGATIVE: break; } } }; AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(Variables_it.FOLLOW_REQUEST).setNegativeButton(Variables_it.NO, dialogClickListener) .setPositiveButton(Variables_it.YES, dialogClickListener).show(); }
From source file:it.uniroma2.foundme.studente.UnFollowCourseActivity.java
public static void populateView(String[] result) { courses = new String[result.length]; System.arraycopy(result, 0, courses, 0, result.length); List<Map<String, String>> data = new ArrayList<Map<String, String>>(); for (int i = 0; i < result.length; i++) { Map<String, String> datum = new HashMap<String, String>(2); if (i == 0 && result[0].equalsIgnoreCase(Variables_it.NO_COURSE)) { datum.put(Variables_it.COURSE, result[0]); datum.put(Variables_it.PROF, ""); data.add(datum);/* www.j a v a 2 s .co m*/ break; } else { String[] items = result[i].split(","); datum.put(Variables_it.COURSE, items[0]); datum.put(Variables_it.PROF, items[1]); data.add(datum); } } //creo l'adapter SimpleAdapter adapter = new SimpleAdapter(context, data, android.R.layout.simple_list_item_2, new String[] { Variables_it.COURSE, Variables_it.PROF }, new int[] { android.R.id.text1, android.R.id.text2 }); lvCorsiSeguiti.setAdapter(adapter); swipeUnfollow.setColorSchemeColors(0xff429874, 0xffffffff, 0xff429874, 0xffffffff); swipeUnfollow.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { swipeUnfollow.setRefreshing(true); (new Handler()).postDelayed(new Runnable() { @Override public void run() { try { getCourse(false); } catch (ExecutionException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } swipeUnfollow.setRefreshing(false); } }, 3000); } }); lvCorsiSeguiti.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (!courses[position].equalsIgnoreCase(Variables_it.NO_COURSE)) alertMessage(courses[position]); } }); lvCorsiSeguiti.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView absListView, int i) { } @Override public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (firstVisibleItem == 0) swipeUnfollow.setEnabled(true); else swipeUnfollow.setEnabled(false); } }); }
From source file:foundme.uniroma2.it.professore.ReadMessageActivity.java
public static void populateView(String[] result) { messageIds = new String[result.length]; List<Map<String, String>> data = new ArrayList<Map<String, String>>(); for (int i = 0; i < result.length; i++) { Map<String, String> datum = new HashMap<String, String>(2); if (i == 0 && result[0].equalsIgnoreCase(Variables_it.NO_MSG)) { datum.put("Msg", result[0]); datum.put("Num", ""); data.add(datum);/* w w w .ja v a 2 s .co m*/ messageIds[0] = result[0]; break; } else { String[] items = result[i].split(","); String ap = "[" + items[0] + "] " + items[1]; datum.put("Msg", ap); datum.put("Num", "Messaggio Visualizzato: " + items[2] + " volte"); data.add(datum); messageIds[i] = items[3]; } } //creo l'adapter SimpleAdapter adapter = new SimpleAdapter(context, data, android.R.layout.simple_list_item_2, new String[] { "Msg", "Num" }, new int[] { android.R.id.text1, android.R.id.text2 }); //inserisco i dati lvMessaggi.setAdapter(adapter); swipeMsg.setColorSchemeColors(0xff429874, 0xffffffff, 0xff429874, 0xffffffff); swipeMsg.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { swipeMsg.setRefreshing(true); (new Handler()).postDelayed(new Runnable() { @Override public void run() { swipeMsg.setRefreshing(false); try { getMsg(Title, false); } catch (ExecutionException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } }, 3000); } }); lvMessaggi.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { toEdit = messageIds[position]; for (int j = 0; j < parent.getChildCount(); j++) parent.getChildAt(j).setBackgroundColor(Color.TRANSPARENT); view.setBackgroundColor(0xff429874); ((Activity) context).startActionMode(modeCallBack); viewList = view; return true; } }); lvMessaggi.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView absListView, int i) { } @Override public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (firstVisibleItem == 0) swipeMsg.setEnabled(true); else swipeMsg.setEnabled(false); } }); }
From source file:forge.assets.ImageCache.java
/** * This requests the original unscaled image from the cache for the given key. * If the image does not exist then it can return a default image if desired. * <p>/*from ww w . j a v a2 s . co m*/ * If the requested image is not present in the cache then it attempts to load * the image from file (slower) and then add it to the cache for fast future access. * </p> */ public static Texture getImage(String imageKey, boolean useDefaultIfNotFound) { if (StringUtils.isEmpty(imageKey)) { return null; } boolean altState = imageKey.endsWith(ImageKeys.BACKFACE_POSTFIX); if (altState) { imageKey = imageKey.substring(0, imageKey.length() - ImageKeys.BACKFACE_POSTFIX.length()); } if (imageKey.startsWith(ImageKeys.CARD_PREFIX)) { imageKey = ImageUtil.getImageKey(ImageUtil.getPaperCardFromImageKey(imageKey.substring(2)), altState, true); if (StringUtils.isBlank(imageKey)) { return defaultImage; } } Texture image; if (useDefaultIfNotFound) { // Load from file and add to cache if not found in cache initially. image = cache.getIfPresent(imageKey); if (image != null) { return image; } if (imageLoaded) { //prevent loading more than one image each render for performance if (!delayLoadRequested) { //ensure images continue to load even if no input is being received delayLoadRequested = true; Gdx.graphics.requestRendering(); } return null; } imageLoaded = true; } try { image = cache.get(imageKey); } catch (final ExecutionException ex) { if (!(ex.getCause() instanceof NullPointerException)) { ex.printStackTrace(); } image = null; } catch (final Exception ex) { image = null; } // No image file exists for the given key so optionally associate with // a default "not available" image and add to cache for given key. if (image == null) { if (useDefaultIfNotFound) { image = defaultImage; cache.put(imageKey, defaultImage); } } return image; }
From source file:it.uniroma2.foundme.studente.FollowCourseActivity.java
public static void populateView(String[] result) { courses = new String[result.length]; System.arraycopy(result, 0, courses, 0, result.length); List<Map<String, String>> data = new ArrayList<Map<String, String>>(); for (int i = 0; i < result.length; i++) { Map<String, String> datum = new HashMap<String, String>(2); if (i == 0 && result[0].equalsIgnoreCase(Variables_it.NO_COURSE)) { datum.put(Variables_it.COURSE, result[0]); datum.put(Variables_it.PROF, ""); data.add(datum);//www .j a v a 2 s . com break; } else { String[] items = result[i].split(","); String ap = items[0] + items[1]; datum.put(Variables_it.COURSE, ap); datum.put(Variables_it.PROF, items[2]); data.add(datum); } } //creo l'adapter final SimpleAdapter adapter = new SimpleAdapter(context, data, android.R.layout.simple_list_item_2, new String[] { Variables_it.COURSE, Variables_it.PROF }, new int[] { android.R.id.text1, android.R.id.text2 }); lvTuttiCorsi.setAdapter(adapter); lvTuttiCorsi.setTextFilterEnabled(true); swipeFollow.setColorSchemeColors(0xff429874, 0xffffffff, 0xff429874, 0xffffffff); swipeFollow.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { swipeFollow.setRefreshing(true); (new Handler()).postDelayed(new Runnable() { @Override public void run() { swipeFollow.setRefreshing(false); try { getCourse(false); } catch (ExecutionException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } }, 3000); } }); lvTuttiCorsi.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (!courses[position].equalsIgnoreCase(Variables_it.NO_COURSE)) alertMessage(courses[position]); } }); lvTuttiCorsi.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView absListView, int i) { } @Override public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (firstVisibleItem == 0) swipeFollow.setEnabled(true); else swipeFollow.setEnabled(false); } }); etFilter.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { adapter.getFilter().filter(s.toString()); } }); }
From source file:forge.ImageCache.java
/** * Returns the Image corresponding to the key. *//*from w w w . ja v a2s .c om*/ private static BufferedImage getImage(final String key) { FThreads.assertExecutedByEdt(true); try { return ImageCache._CACHE.get(key); } catch (final ExecutionException ex) { if (ex.getCause() instanceof NullPointerException) { return null; } ex.printStackTrace(); return null; } catch (final InvalidCacheLoadException ex) { // should be when a card legitimately has no image return null; } }
From source file:org.apache.usergrid.services.ServiceInfo.java
/** Delegates to _getClassName via a CacheLoader due to the expense of path name calculation */ public static String getClassName(String servicePattern) { try {/*from w w w .j a v a 2 s. co m*/ return servicePatternCache.get(servicePattern); } catch (ExecutionException ee) { ee.printStackTrace(); } return _getClassName(servicePattern); }