Exemplo n.º 1
0
  @Override
  public Action[] getActions(Object target, Object sender) {
    if (target == null) {
      return new Action[] {};
    }

    List<AbstractAction> visibleActions = new LinkedList<>();
    visibleActions.add(new StockSellAction(((StockGood) target), view));
    visibleActions.add(new StockMoveAction(((StockGood) target), view));
    visibleActions.add(new StockOrderedAction(((StockGood) target), view));
    visibleActions.add(new StockBestsellerAction(((StockGood) target), view));
    visibleActions.add(new StockAttentionAction(((StockGood) target), view));
    visibleActions.add(new StockWarrantyAction(((StockGood) target), view));
    visibleActions.add(new StockHistoryAction(((StockGood) target), view));

    Iterator<AbstractAction> iter = visibleActions.iterator();
    while (iter.hasNext()) {
      AbstractAction action = iter.next();
      if (!action.show()) {
        iter.remove();
      }
    }
    return visibleActions.toArray(new Action[visibleActions.size()]);
  }
Exemplo n.º 2
0
 @Override
 public void handleAction(Action action, Object sender, Object target) {
   ((AbstractAction) action).execute();
   view.refreshView();
 }