/** * Inflate the in-track view for the action of the given MIME-type. Will use the icon provided by * the {@link DataKind}. */ private View inflateAction(String mimeType) { final CheckableImageView view = (CheckableImageView) obtainView(); boolean isActionSet = false; // Add direct intent if single child, otherwise flag for multiple ActionList children = mActions.get(mimeType); Action firstInfo = children.get(0); if (children.size() == 1) { view.setTag(firstInfo); } else { for (Action action : children) { if (action.isPrimary()) { view.setTag(action); isActionSet = true; break; } } if (!isActionSet) { view.setTag(children); } } // Set icon and listen for clicks final CharSequence descrip = mResolveCache.getDescription(firstInfo); final Drawable icon = mResolveCache.getIcon(firstInfo); view.setChecked(false); view.setContentDescription(descrip); view.setImageDrawable(icon); view.setOnClickListener(this); return view; }
/** * Gets the itemLinked attribute of the ActionItemLogList class * * @param db Description of the Parameter * @param linkItemId Description of the Parameter * @param type Description of the Parameter * @return The itemLinked value * @throws SQLException Description of the Exception */ public static ActionList isItemLinked(Connection db, int linkItemId, int type) throws SQLException { ActionList thisList = null; int actionListId = -1; PreparedStatement pst = db.prepareStatement( "SELECT action_id " + "FROM action_item ai, action_item_log al " + "WHERE al.link_item_id = ? AND al." + DatabaseUtils.addQuotes(db, "type") + " = ? AND ai.item_id = al.item_id "); pst.setInt(1, linkItemId); pst.setInt(2, type); ResultSet rs = pst.executeQuery(); if (rs.next()) { actionListId = rs.getInt("action_id"); } rs.close(); pst.close(); if (actionListId > 0) { thisList = new ActionList(); thisList.queryRecord(db, actionListId); } return thisList; }
public void setActionListener(ActionListener listener) { ActionList actionList = getActionList(); int nActions = actionList.size(); for (int n = 0; n < nActions; n++) { Action action = actionList.getAction(n); action.setActionListener(listener); } }
private void collect(String mimeType, Action info) { // Create list for this MIME-type when needed ActionList collectList = get(mimeType); if (collectList == null) { collectList = new ActionList(); put(mimeType, collectList); } collectList.add(info); }
public Action getAction(String actionName) { ActionList actionList = getActionList(); int nActions = actionList.size(); for (int n = 0; n < nActions; n++) { Action action = actionList.getAction(n); String name = action.getName(); if (name == null) continue; if (name.equals(actionName) == true) return action; } return null; }
void updateActionList(TreeNode parentNode, Service service) { ActionList actionList = service.getActionList(); int nActions = actionList.size(); for (int n = 0; n < nActions; n++) { Action action = actionList.getAction(n); String actionName = action.getName(); TreeNode actionNode = new TreeNode(actionName); actionNode.setUserData(action); parentNode.add(actionNode); updateArgumentList(actionNode, action); } }
public ActionList getActionList() { ActionList actionList = new ActionList(); Node scdpNode = getSCPDNode(); if (scdpNode == null) return actionList; Node actionListNode = scdpNode.getNode(ActionList.ELEM_NAME); if (actionListNode == null) return actionList; int nNode = actionListNode.getNNodes(); for (int n = 0; n < nNode; n++) { Node node = actionListNode.getNode(n); if (Action.isActionNode(node) == false) continue; Action action = new Action(serviceNode, node); actionList.add(action); } return actionList; }
/** * Adds a list of {@link Action}s. * * @param actionList the actions to add */ public void addActions(ActionList actionList) { int actions = actionList.size(); for (int i = 0; i < actions; i++) { addAction(actionList.get(i)); } }