Exemplo n.º 1
0
  @Override
  public void initManageContactMenu(Protocol protocol, MenuModel menu) {
    if (protocol.isConnected()) {
      if (isOnline()) {
        menu.addItem("adhoc", USER_MENU_ADHOC);
      }
      if (isTemp()) {
        menu.addItem("add_user", USER_MENU_ADD_USER);

      } else {
        if (protocol.getGroupItems().size() > 1) {
          menu.addItem("move_to_group", USER_MENU_MOVE);
        }
        if (!isAuth()) {
          menu.addItem("requauth", USER_MENU_REQU_AUTH);
        }
      }
      if (!isTemp()) {
        menu.addItem("rename", USER_MENU_RENAME);
      }
    }
    if (protocol.isConnected() || (isTemp() && protocol.hasContact(this))) {
      menu.addSeparator();
      if (protocol.isConnected()) {
        menu.addItem("remove_me", USER_MENU_REMOVE_ME);
      }
      if (protocol.hasContact(this)) {
        menu.addItem("remove", USER_MENU_USER_REMOVE);
      }
    }
  }
Exemplo n.º 2
0
 /**
  * Deselects <code>RadioOptionModel</code> items in a group when a selection is made within that
  * group. Operates by recursively searching <code>MenuModel</code>s for <code>RadioOptionModel
  * </code>s with a specific group id.
  *
  * @param menuModel the <code>MenuModel</code> to search
  * @param groupId the id of the group to deselect
  * @param newSelectionId the id of the new selection in the group
  */
 private void deselectGroup(MenuModel menuModel, Object groupId, Object newSelectionId) {
   int count = menuModel.getItemCount();
   for (int i = 0; i < count; ++i) {
     ItemModel itemModel = menuModel.getItem(i);
     if (itemModel instanceof MenuModel) {
       deselectGroup((MenuModel) itemModel, groupId, newSelectionId);
     } else if (itemModel instanceof RadioOptionModel) {
       RadioOptionModel radioOptionModel = (RadioOptionModel) itemModel;
       if (radioOptionModel.getGroupId() != null
           && radioOptionModel.getGroupId().equals(groupId)) {
         getStateModel().setSelected(radioOptionModel.getId(), false);
       }
     }
   }
 }
Exemplo n.º 3
0
 public void addChatMenuItems(MenuModel model) {
   if (isOnline() && !(this instanceof XmppServiceContact)) {
     if (Options.getBoolean(Options.OPTION_ALARM)) {
       model.addItem("wake", USER_MENU_WAKE);
     }
   }
 }
Exemplo n.º 4
0
  @Override
  public void initContextMenu(Protocol protocol, MenuModel contactMenu) {
    addChatItems(contactMenu);

    if (0 < subContacts.size()) {
      contactMenu.addItem("list_of_connections", USER_MENU_CONNECTIONS);
    }
    addGeneralItems(protocol, contactMenu);
  }
Exemplo n.º 5
0
 public final void showMenu(MenuModel m) {
   if ((null != m) && (0 < m.count())) {
     UIBuilder.createMenu(m).show();
   }
 }
Exemplo n.º 6
0
 public final void select(Select select, MenuModel model, int cmd) {
   String resource = model.getItemText(cmd);
   setActiveResource(resource);
   Jimm.getJimm().getDisplay().closeMenus();
 }