コード例 #1
0
 private String getSelectedUserName() {
   final IBeanProxy<IUser> selectedUser = table.getModel().getFirstSelectedBean();
   if (selectedUser != null) {
     final IUser user = selectedUser.getBean();
     return user.getName() + " " + user.getLastName();
   } else {
     return "Nothing";
   }
 }
コード例 #2
0
 private void fillDynamicMenuModel(
     final IMenuModel menuModel, final Random random, final ITableCellPopupEvent event) {
   menuModel.removeAllItems();
   menuModel.addActionItem(
       "Clicked row '" + event.getRowIndex() + "' and column '" + event.getColumnIndex() + "'");
   menuModel.addActionItem(
       "Clicked value '"
           + table.getModel().getValue(event.getRowIndex(), event.getColumnIndex())
           + "'");
   menuModel.addActionItem("Its " + (new Date()));
   menuModel.addActionItem(getSelectedUserName() + " is selected");
   final int count = random.nextInt(5) + 1;
   for (int i = 0; i < count; i++) {
     menuModel.addActionItem("Random item " + i);
   }
 }