@Override public synchronized String getEffectiveRule(final String catlabel) { for (final CategoryGroup cg : m_config.getCategoryGroups()) { for (final Category cat : cg.getCategories()) { if (cat.getLabel().equals(catlabel)) { return "(" + cg.getCommon().getRule() + ") & (" + cat.getRule() + ")"; } } } return null; }
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Common common = new Common(this, this); FrameLayout fl = new FrameLayout(this); ImageView iv = new ImageView(this); FrameLayout.LayoutParams flparam = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); FrameLayout.LayoutParams lparam = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT); iv.setImageBitmap(common.newImage("100x100.png", ImageFormat.RGB565).getBitmap()); lparam.setMarginStart(50); lparam.setMarginEnd(0); iv.setLayoutParams(lparam); iv.requestLayout(); fl.addView(iv); this.setContentView(fl, flparam); AlphaAnimation animation = new AlphaAnimation(0, 1); animation.setDuration(3000); iv.setAnimation(animation); iv.startAnimation(animation); }
public void setCommon(final Common common) { if (common == null) { m_common = new Common(); } else { m_common = common; } }
/** * {@inheritDoc} * * Return the effective rule for the specified category. The category rule * ANDed with the rule of the category group that the category belongs to. */ @Override public String getEffectiveRule(final String catlabel) { try { getReadLock().lock(); for (final CategoryGroup cg : m_config.getCategoryGroups()) { for (final Category cat : cg.getCategories()) { if (cat.getLabel().equals(catlabel)) { return "(" + cg.getCommon().getRule() + ") & (" + cat.getRule() + ")"; } } } } finally { getReadLock().unlock(); } return null; }
function Common() { var _this = this; this.viewModel = null; this.showViewModel = function () { alert(_this.viewModel); }; } var common = null; $().ready(function () { common = new Common(); });
/** * Creates the categories map. Reads the categories from the categories.xml * and creates the 'RTCCategory's map */ public static HashMap<String, RTCCategory> createCategoriesMap() { CatFactory cFactory = null; try { CategoryFactory.init(); cFactory = CategoryFactory.getInstance(); } catch (IOException ex) { LOG.error("Failed to load categories information", ex); throw new UndeclaredThrowableException(ex); } HashMap<String, RTCCategory> retval = new HashMap<String, RTCCategory>(); cFactory.getReadLock().lock(); try { for (CategoryGroup cg : cFactory.getConfig().getCategoryGroups()) { final String commonRule = cg.getCommon().getRule(); for (final org.opennms.netmgt.config.categories.Category cat : cg.getCategories()) { RTCCategory rtcCat = new RTCCategory(cat, commonRule); retval.put(rtcCat.getLabel(), rtcCat); } } } finally { cFactory.getReadLock().unlock(); } return retval; }
public class MainActivity implements Common.OnSelectedListener { Common common = new Common(); public MainActivity() { } public void startMyCallback() { common.mCallback = this; } @Override public void getFailureDialog() { RecordFailure fd = new RecordFailure(); fd.show(getSupportFragmentManager(), "dialog"); } }