Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

40
LINES

< > BotCompany Repo | #1026288 // DynMultiComm

JavaX fragment (include)

!include once #1026287 // Multi-Comm Concepts

abstract sclass DynMultiComm > DynModule {
  transient ConceptTable<Customer> ct;
  transient bool considerAllActive;
  
  start {
    dbIndexing(Customer, 'cookie, Customer, 'active, Message, 'customer);
  }
  
  visualize {
    ct = new ConceptTable(Customer);
    if (!considerAllActive) ct.filter = c -> c.active();
    IF1<Customer, Map> renderer = defaultConceptRendererForTable(Customer);
    ct.renderer = c -> {
      Map map = renderer.get(c);
      map.remove("lastPing");
      transformValueInPlace str(map, "botConversationID");
      map.put("Last activity", iround(toSeconds(elapsedMS_timestamp(c.lastPing))));
      Message msg = c.lastMessage();
      map.put("Last message", msg == null ? "" : msg.text);
      ret map;
    };
    awtEvery(ct.getTable(), 5.0, r { ct.update() });

    ret jhsplit(
      jCenteredSection("Active Customers", ct.getTable()),
      jCenteredSection("Messages", makeConceptsTable(Message)));
  }

  // API
  
  L<Customer> activeCustomers() {
    ret cloneList(conceptsWhere Customer(active := true));
  }
  
  L<Message> messagesForCustomer(Customer c) {
    ret cloneList(conceptsWhere Message(customer := c));
  }
}

Author comment

Began life as a copy of #1026276

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1026288
Snippet name: DynMultiComm
Eternal ID of this version: #1026288/5
Text MD5: 21374929de81ef9259990e92550de8f1
Author: stefan
Category: javax / comm
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-12-11 19:30:56
Source code size: 1253 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 237 / 536
Version history: 4 change(s)
Referenced in: [show references]