convex.gui.actor.ActorInvokePanel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of convex-gui Show documentation
Show all versions of convex-gui Show documentation
Convex desktop GUI and test applications
The newest version!
package convex.gui.actor;
import javax.swing.DefaultListModel;
import javax.swing.JPanel;
import convex.api.Convex;
import convex.core.State;
import convex.core.data.ASet;
import convex.core.data.AccountStatus;
import convex.core.data.Address;
import convex.core.data.Symbol;
import convex.gui.components.ScrollyList;
import convex.gui.components.account.AccountChooserPanel;
import convex.gui.models.StateModel;
import net.miginfocom.swing.MigLayout;
@SuppressWarnings("serial")
public class ActorInvokePanel extends JPanel {
protected Address contract;
AccountChooserPanel execPanel;
DefaultListModel exportList = new DefaultListModel();
private StateModel model;
public ActorInvokePanel(Convex convex,StateModel model, Address contract) {
this.contract = contract;
this.model=model;
setLayout(new MigLayout());
execPanel=new AccountChooserPanel(convex);
add(execPanel, "dock north");
AccountStatus as = model.getValue().getAccount(contract);
ASet exports = as.getCallableFunctions();
for (Symbol s : exports) {
System.err.println(s);
exportList.addElement(s);
}
ScrollyList scrollyList = new ScrollyList(exportList,
sym -> new SmartOpComponent(this, contract, sym));
add(scrollyList, "dock center");
}
public State getLatestState() {
return model.getValue();
}
}