Exemplo n.º 1
0
  public void checkAvailablity(WebDriver driver, String ip) {
    // System.out.print("Checking " + ip + " controller");
    driver.get(ip);

    // Check if Login page is up
    if (driver.getTitle().equalsIgnoreCase(osLogin)) {
      action.clickById(driver, "id_username", "admin");
      action.clickById(driver, "id_password", "admin");
      action.clickElement(driver, submit);
      // System.out.println(ip + " controller is UP");
      // System.out.println("logged");
    } else {
      // System.out.println("unable to log in -- ");
      // System.out.println(ip + " controller is DOWN");
    }

    // Check if Title page is showing after login
    if (driver.getTitle().equalsIgnoreCase(osTitle)) {
      System.out.println(ip + " controller is UP");
      action.clickLinkText(driver, "Sign Out");

    } else {
      System.out.println(ip + " controller is DOWN");
    }
  }
Exemplo n.º 2
0
  public void addActionItem(ActionItem action) {

    String title = action.getTitle();
    Drawable icon = action.getIcon();

    View container = (View) inflater.inflate(R.layout.action_item, null);

    ImageView img = (ImageView) container.findViewById(R.id.iv_icon);
    TextView text = (TextView) container.findViewById(R.id.tv_title);

    if (icon != null) img.setImageDrawable(icon);
    else img.setVisibility(View.GONE);

    if (title != null) text.setText(title);
    else text.setVisibility(View.GONE);

    final int pos = mChildPos;

    container.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            if (mListener != null) mListener.onItemClick(pos);

            dismiss();
          }
        });

    container.setFocusable(true);
    container.setClickable(true);

    mTrack.addView(container, mChildPos + 1);

    mChildPos++;
  }
  private static boolean itemsHaveMnemonics(final List<ActionItem> items) {
    for (ActionItem item : items) {
      if (item.getAction().getTemplatePresentation().getMnemonic() != 0) return true;
    }

    return false;
  }
 public void setClusterItemEnabled(int id, boolean enabled) {
   for (ActionItem item : sClusterItems) {
     if (item.action == id) {
       item.enabled = enabled;
       return;
     }
   }
 }
 public void setClusterItemVisibility(int id, boolean visible) {
   for (ActionItem item : sClusterItems) {
     if (item.action == id) {
       item.visible = visible;
       return;
     }
   }
 }
Exemplo n.º 6
0
  /**
   * Add action item
   *
   * @param action {@link ActionItem}
   */
  public void addActionItem(ActionItem action) {
    mActionItemList.add(action);

    String title = action.getTitle();
    Drawable icon = action.getIcon();

    View container = (View) inflater.inflate(R.layout.action_item, null);

    ImageView img = (ImageView) container.findViewById(R.id.iv_icon);
    TextView text = (TextView) container.findViewById(R.id.tv_title);

    if (icon != null) {
      img.setImageDrawable(icon);
    } else {
      img.setVisibility(View.GONE);
    }

    if (title != null) {
      text.setText(title);
    } else {
      text.setVisibility(View.GONE);
    }

    final int pos = mChildPos;
    final int actionId = action.getActionId();

    container.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            if (mItemClickListener != null) {
              mItemClickListener.onItemClick(QuickAction.this, pos, actionId);
            }

            if (!getActionItem(pos).isSticky()) {
              mDidAction = true;

              // workaround for transparent background bug
              // thx to Roman Wozniak <*****@*****.**>
              v.post(
                  new Runnable() {
                    @Override
                    public void run() {
                      dismiss();
                    }
                  });
            }
          }
        });

    container.setFocusable(true);
    container.setClickable(true);

    mTrack.addView(container, mChildPos + 1);

    mChildPos++;
  }
Exemplo n.º 7
0
  public void setSuggestions(List<SnippetArticle> suggestions, @CategoryStatusEnum int status) {
    copyThumbnails(suggestions);

    int itemCountBefore = getItemCount();
    setStatusInternal(status);

    mSuggestions.clear();
    mSuggestions.addAll(suggestions);

    if (mMoreButton != null) {
      mMoreButton.setPosition(mSuggestions.size());
      mMoreButton.setDismissable(mSuggestions.isEmpty());
    }
    resetChildren();
    notifySectionChanged(itemCountBefore);
  }
    @Override
    public PopupStep onChosen(
        ActionItem actionChoice, boolean finalChoice, final int eventModifiers) {
      if (!actionChoice.isEnabled()) return FINAL_CHOICE;
      final AnAction action = actionChoice.getAction();
      DataManager mgr = DataManager.getInstance();

      final DataContext dataContext =
          myContext != null ? mgr.getDataContext(myContext) : mgr.getDataContext();

      if (action instanceof ActionGroup
          && (!finalChoice || !((ActionGroup) action).canBePerformed(dataContext))) {
        return createActionsStep(
            (ActionGroup) action,
            dataContext,
            myEnableMnemonics,
            true,
            myShowDisabledActions,
            null,
            myContext,
            false,
            myPreselectActionCondition,
            false);
      } else {
        myFinalRunnable =
            new Runnable() {
              @Override
              public void run() {
                action.actionPerformed(
                    new AnActionEvent(
                        null,
                        dataContext,
                        ActionPlaces.UNKNOWN,
                        action.getTemplatePresentation().clone(),
                        ActionManager.getInstance(),
                        eventModifiers));
              }
            };
        return FINAL_CHOICE;
      }
    }
Exemplo n.º 9
0
  public void removeSuggestion(SnippetArticle suggestion) {
    int removedIndex = mSuggestions.indexOf(suggestion);
    if (removedIndex == -1) return;

    mSuggestions.remove(removedIndex);
    if (mMoreButton != null) mMoreButton.setDismissable(!hasSuggestions());

    resetChildren();

    // Note: Keep this coherent with getItems()
    int globalRemovedIndex = removedIndex + 1; // Header has index 0 in the section.
    notifyItemRemoved(globalRemovedIndex);

    // If we still have some suggestions, we are done. Otherwise, we'll have to notify about the
    // status-related items that are now present.
    if (hasSuggestions()) return;
    notifyItemInserted(globalRemovedIndex); // Status card.
    if (!mCategoryInfo.hasMoreButton()) {
      notifyItemInserted(globalRemovedIndex + 1); // Action card.
    }
    notifyItemInserted(globalRemovedIndex + 2); // Progress indicator.
  }
Exemplo n.º 10
0
  /**
   * Add action item
   *
   * @param action {@link ActionItem}
   */
  public void addActionItem(ActionItem action) {
    actionItems.add(action);

    String title = action.getTitle();
    Drawable icon = action.getIcon();

    View container = mInflater.inflate(R.layout.action_item_vertical, null);

    if (mOrientation == HORIZONTAL) {
      // container = mInflater.inflate(R.layout.action_item_horizontal, null);
    } else {

    }

    ImageView img = (ImageView) container.findViewById(R.id.iv_icon);
    TextView text = (TextView) container.findViewById(R.id.tv_title);

    if (icon != null) {
      img.setImageDrawable(icon);
    } else {
      img.setVisibility(View.GONE);
    }

    if (title != null) {
      text.setText(title);
    } else {
      text.setVisibility(View.GONE);
    }

    final int pos = mChildPos;
    final int actionId = action.getActionId();

    container.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            if (mItemClickListener != null) {
              mItemClickListener.onItemClick(QuickAction.this, pos, actionId);
            }

            if (!getActionItem(pos).isSticky()) {
              mDidAction = true;

              dismiss();
            }
          }
        });

    container.setFocusable(true);
    container.setClickable(true);

    if (mOrientation == HORIZONTAL && mChildPos != 0) {
      View separator = mInflater.inflate(R.layout.horiz_separator, null);

      RelativeLayout.LayoutParams params =
          new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT);

      separator.setLayoutParams(params);
      separator.setPadding(5, 0, 5, 0);

      mTrack.addView(separator, mInsertPos);

      mInsertPos++;
    }

    mTrack.addView(container, mInsertPos);

    mChildPos++;
    mInsertPos++;
  }
Exemplo n.º 11
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    ActionItem nextItem =
        new ActionItem(ID_DOWN, "Next", getResources().getDrawable(R.drawable.menu_down_arrow));
    ActionItem prevItem =
        new ActionItem(ID_UP, "Prev", getResources().getDrawable(R.drawable.menu_up_arrow));
    ActionItem searchItem =
        new ActionItem(ID_SEARCH, "Find", getResources().getDrawable(R.drawable.menu_search));
    ActionItem infoItem =
        new ActionItem(ID_INFO, "Info", getResources().getDrawable(R.drawable.menu_info));
    ActionItem eraseItem =
        new ActionItem(ID_ERASE, "Clear", getResources().getDrawable(R.drawable.menu_eraser));
    ActionItem okItem = new ActionItem(ID_OK, "OK", getResources().getDrawable(R.drawable.menu_ok));

    // use setSticky(true) to disable QuickAction dialog being dismissed after an item is clicked
    prevItem.setSticky(true);
    nextItem.setSticky(true);

    // create QuickAction. Use QuickAction.VERTICAL or QuickAction.HORIZONTAL param to define layout
    // orientation
    final QuickAction quickAction = new QuickAction(this, QuickAction.VERTICAL);

    // add action items into QuickAction
    quickAction.addActionItem(nextItem);
    quickAction.addActionItem(prevItem);
    quickAction.addActionItem(searchItem);
    quickAction.addActionItem(infoItem);
    quickAction.addActionItem(eraseItem);
    quickAction.addActionItem(okItem);

    // Set listener for action item clicked
    quickAction.setOnActionItemClickListener(
        new QuickAction.OnActionItemClickListener() {
          // @Override
          public void onItemClick(QuickAction source, int pos, int actionId) {
            ActionItem actionItem = quickAction.getActionItem(pos);

            // here we can filter which action item was clicked with pos or actionId parameter
            if (actionId == ID_SEARCH) {
              Toast.makeText(
                      getApplicationContext(), "Let's do some search action", Toast.LENGTH_SHORT)
                  .show();
            } else if (actionId == ID_INFO) {
              Toast.makeText(
                      getApplicationContext(), "I have no info this time", Toast.LENGTH_SHORT)
                  .show();
            } else {
              Toast.makeText(
                      getApplicationContext(),
                      actionItem.getTitle() + " selected",
                      Toast.LENGTH_SHORT)
                  .show();
            }
          }
        });

    // set listnener for on dismiss event, this listener will be called only if QuickAction dialog
    // was dismissed
    // by clicking the area outside the dialog.
    quickAction.setOnDismissListener(
        new QuickAction.OnDismissListener() {
          // @Override
          public void onDismiss() {
            Toast.makeText(getApplicationContext(), "Dismissed", Toast.LENGTH_SHORT).show();
          }
        });

    // show on btn1
    Button btn1 = (Button) this.findViewById(R.id.btn1);
    btn1.setOnClickListener(
        new View.OnClickListener() {
          // @Override
          public void onClick(View v) {
            // quickAction.show(v);
          }
        });

    Button btn2 = (Button) this.findViewById(R.id.btn2);
    btn2.setOnClickListener(
        new OnClickListener() {
          // @Override
          public void onClick(View v) {
            // quickAction.show(v);
          }
        });

    Button btn3 = (Button) this.findViewById(R.id.btn3);
    btn3.setOnClickListener(
        new OnClickListener() {
          // @Override
          public void onClick(View v) {
            // quickAction.show(v);
            quickAction.setAnimStyle(QuickAction.ANIM_REFLECT);
          }
        });
  }
 @Override
 public boolean hasSubstep(final ActionItem selectedValue) {
   return selectedValue != null
       && selectedValue.isEnabled()
       && selectedValue.getAction() instanceof ActionGroup;
 }
 @Override
 public ListSeparator getSeparatorAbove(final ActionItem value) {
   return value.isPrependWithSeparator() ? new ListSeparator(value.getSeparatorText()) : null;
 }
 @Override
 @NotNull
 public String getTextFor(final ActionItem value) {
   return value.getText();
 }
 @Override
 public Icon getIconFor(final ActionItem aValue) {
   return aValue.getIcon();
 }
 @Override
 public boolean isSelectable(final ActionItem value) {
   return value.isEnabled();
 }
  @Override
  public ActionItem deserialize(JsonParser jp, DeserializationContext ctxt)
      throws IOException, JsonProcessingException {
    ObjectNode objectNode = jp.readValueAsTree();
    JsonNode wrapped = objectNode.get("actionItemType");
    JsonParser parser = wrapped.traverse();
    parser.setCodec(jp.getCodec());
    ActionItemType actionItemType = parser.readValueAs(ActionItemType.class);

    wrapped = objectNode.get("actionItemId");
    parser = wrapped.traverse();
    parser.setCodec(jp.getCodec());
    Long actionItemId = parser.getValueAsLong();

    wrapped = objectNode.get("actionItemCreateDate");
    parser = wrapped.traverse();
    parser.setCodec(jp.getCodec());
    Date actionItemCreateDate = new Date(parser.getValueAsLong());

    wrapped = objectNode.get("actionItemName");
    parser = wrapped.traverse();
    parser.setCodec(jp.getCodec());
    String actionItemName = parser.getValueAsString();

    wrapped = objectNode.get("actionItemDueDate");
    parser = wrapped.traverse();
    parser.setCodec(jp.getCodec());
    Date actionItemDueDate = new Date(parser.getValueAsLong());

    wrapped = objectNode.get("discussionId");
    parser = wrapped.traverse();
    parser.setCodec(jp.getCodec());
    Long discussionId = parser.getValueAsLong();

    wrapped = objectNode.get("owner");
    parser = wrapped.traverse();
    parser.setCodec(jp.getCodec());
    MmrActionItemUser owner = parser.readValueAs(MmrActionItemUser.class);

    wrapped = objectNode.get("assignees");
    parser = wrapped.traverse();
    parser.setCodec(jp.getCodec());
    List<MmrActionItemUser> assignees =
        parser.readValueAs(new TypeReference<List<MmrActionItemUser>>() {});

    wrapped = objectNode.get("actionItemStatus");
    parser = wrapped.traverse();
    parser.setCodec(jp.getCodec());
    ActionItemStatus actionItemStatus = parser.readValueAs(ActionItemStatus.class);

    ActionItem actionItem = new UntypedActionItem();
    actionItem.setActionItemType(actionItemType);
    actionItem.setActionItemId(actionItemId);
    actionItem.setActionItemStatus(actionItemStatus);
    actionItem.setAssignees(assignees);
    actionItem.setActionItemCreateDate(actionItemCreateDate);
    actionItem.setActionItemDueDate(actionItemDueDate);
    actionItem.setActionItemName(actionItemName);
    actionItem.setDiscussionId(discussionId);
    actionItem.setOwner(owner);

    return actionItem;
  }
Exemplo n.º 18
0
 public OutboxItem(ActionItem actionItem) {
   this.setActionRequestCd(actionItem.getActionRequestCd());
   this.setActionRequestId(actionItem.getActionRequestId());
   this.setDateAssigned(actionItem.getDateAssigned());
   this.setDelegationType(actionItem.getDelegationType());
   this.setDelegatorPrincipalId(actionItem.getDelegatorPrincipalId());
   this.setDelegatorGroupId(actionItem.getDelegatorGroupId());
   this.setDocHandlerURL(actionItem.getDocHandlerURL());
   this.setDocLabel(actionItem.getDocLabel());
   this.setDocName(actionItem.getDocName());
   this.setDocTitle(actionItem.getDocTitle());
   this.setResponsibilityId(actionItem.getResponsibilityId());
   this.setRoleName(actionItem.getRoleName());
   this.setDocumentId(actionItem.getDocumentId());
   this.setPrincipalId(actionItem.getPrincipalId());
   this.setGroupId(actionItem.getGroupId());
   this.setRequestLabel(actionItem.getRequestLabel());
 }