MASON-INTEREST-L Archives

June 2014

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Tue, 10 Jun 2014 12:25:08 -0400
MIME-version:
1.0 (Mac OS X Mail 7.2 \(1874\))
Reply-To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Content-type:
text/plain; charset=us-ascii
Subject:
From:
Sean Luke <[log in to unmask]>
In-Reply-To:
Content-Transfer-Encoding:
8bit
Parts/Attachments:
text/plain (18 lines)
On Jun 10, 2014, at 11:40 AM, Joey Harrison <[log in to unmask]> wrote:

> I've got several models in the same directory and I'd like to have their "About" tabs populated with different info. However, GUIState is hard-coded to load up index.html, so there's no obvious way to have them use separate files.

Sure there is!  If you override the GUIState's getInfo() method with your own static version, MASON won't hunt for the index.html file.  

public static Object getInfo() { return "Check this out!"; }

public static Object getInfo() { return "<html><b>Check this out, now in HTML!</b>"; }

You can load HTML files too.  Let's say your GUIState subclass is called Joey, and you want to load a file called "joey.html" located in the same directory as the Joey.class file:

public static Object getInfo() { return Joey.class.getResource("joey.html"); }

Not that I'm saying having multiple models in the same directory is a good idea.  It seems unclean.  I'm sure there's something else in MASON you'll have to override further down the line.  

Sean

ATOM RSS1 RSS2