All Downloads are FREE. Search and download functionalities are using the official Maven repository.

convex.gui.actor.ActorInvokePanel Maven / Gradle / Ivy

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();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy