Return-Path: X-Original-To: apmail-pivot-user-archive@www.apache.org Delivered-To: apmail-pivot-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B631384A6 for ; Mon, 8 Aug 2011 14:09:24 +0000 (UTC) Received: (qmail 61984 invoked by uid 500); 8 Aug 2011 14:09:24 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 61867 invoked by uid 500); 8 Aug 2011 14:09:23 -0000 Mailing-List: contact user-help@pivot.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@pivot.apache.org Delivered-To: mailing list user@pivot.apache.org Received: (qmail 61859 invoked by uid 99); 8 Aug 2011 14:09:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Aug 2011 14:09:23 +0000 X-ASF-Spam-Status: No, hits=2.0 required=5.0 tests=FREEMAIL_FROM,SPF_NEUTRAL,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: 216.139.236.26 is neither permitted nor denied by domain of roger.varley@googlemail.com) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Aug 2011 14:09:16 +0000 Received: from ben.nabble.com ([192.168.236.152]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1QqQVj-0007DJ-MZ for user@pivot.apache.org; Mon, 08 Aug 2011 07:08:55 -0700 Date: Mon, 8 Aug 2011 07:08:55 -0700 (PDT) From: "B.L. Zeebub" To: user@pivot.apache.org Message-ID: <1312812535694-3235662.post@n3.nabble.com> Subject: Binding Issues (converting from 1.5 to 2.0) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Ok, I'm slowly getting there. I've now got the bindable interface working - partially. The initialize() method is being called and my ImageViews are being populated and displayed. However, if I change the image in my ImageView, this is not being reflected in the display. Similarly, I've got a List messages assigned to a TableView but as I add to the list, the table view is not updating. What have I missed now? Regards public class Example extends Frame implements Application, MessageBusListener, Bindable,Serializable { private static String host; private static String port; private Window window; private Display display; private GenesisClient service; private List messages = new ArrayList(); @BXML private ActivityIndicator activityIndicator = new ActivityIndicator(); @BXML private ImageView tx = new ImageView(); @BXML private ImageView rx = new ImageView(); @BXML private ImageView car = new ImageView(); @BXML private ImageView vci_status = new ImageView(); @BXML private ImageView pc = new ImageView(); @BXML private ImageView pc_status = new ImageView(); @BXML private ImageView server = new ImageView(); @BXML private TableView tv = new TableView(); private static String TX_ON = "/com/blackbox/x/client/images/TxOn.png"; private static String RX_ON = "/com/blackbox/x/client/images/RxOn.png"; private static String TX_OFF = "/com/blackbox/x/client/images/TxOff.png"; private static String RX_OFF = "/com/blackbox/x/client/images/RxOff.png"; private static String CAR = "/com/blackbox/x/client/images/transportation_car_32.png"; private static String VCI_STATUS_OFF = "/com/blackbox/x/client/images/cross.png"; private static String VCI_STATUS_ON = "/com/blackbox/x/client/images/tick.png"; private static String PC = "/com/blackbox/x/client/images/generic_pc.png"; private static String PC_STATUS_OFF = "/com/blackbox/x/client/images/cross.png"; private static String PC_STATUS_ON = "/com/blackbox/x/client/images/tick.png"; private static String SERVER = "/com/blackbox/x/client/images/redhat_network_server.png"; private String VERSION ="Pivot Client : Version 0.95.0.3"; private static final Logger logger = Logger .getLogger(Example.class.getName()); public void resume() throws Exception { } public boolean shutdown(boolean optional) throws Exception { if (window != null) { window.close(); } return false; } @SuppressWarnings("unchecked") public void startup(final Display display, Map<String, String> properties) throws Exception { this.display = display; registerEventListeners(); BXMLSerializer wtkxSerializer = new BXMLSerializer(); window = (Window) wtkxSerializer.readObject(Example.class, "Example.wtkx"); window.open(display); TaskListener taskListener = new TaskListener() { public void taskExecuted(Task task) { activityIndicator.setActive(false); vci_status.setImage(VCI_STATUS_ON); window.setEnabled(true); } public void executeFailed(Task task) { // activityIndicator.setActive(false); window.setEnabled(true); Exception e = (Exception) task.getFault().getCause(); if (e instanceof VciNotFoundException) { Alert.alert(MessageType.ERROR,"No VCI device found. Please check that your" + " Vci device is connected securely to your car and PC. Please ensure that the" + " ignition is turned on and re-try running this program.", window, new DialogCloseListener() { public void dialogClosed(Dialog dialog, boolean modal) { try { display.getHostWindow().dispose(); shutdown(true); } catch (Exception e) { e.printStackTrace(); } } }); } } }; //activityIndicator.setActive(true); window.setEnabled(false); new ClientTask().execute(new TaskAdapter(taskListener)); } @SuppressWarnings("unchecked") private void registerEventListeners() { MessageBus.subscribe(LogEvent.class, this); MessageBus.subscribe(DataWriteEvent.class, this); MessageBus.subscribe(DataReadEvent.class, this); MessageBus.subscribe(ServerCloseEvent.class, this); MessageBus.subscribe(ErrorEvent.class, this); MessageBus.subscribe(ConnectEvent.class, this); MessageBus.subscribe(ContactEvent.class, this); } public void suspend() throws Exception { } public static void main(String[] args) { if (args[0] == null) { host = "localhost"; } else { host = args[0]; } DesktopApplicationContext.main(Example.class, args); } private void sleep(int interval) { try { Thread.sleep(interval); } catch (InterruptedException e) { e.printStackTrace(); } } private class ClientTask extends Task { @Override public String execute() throws TaskExecutionException { messages.add(new LogEvent(VERSION)); service = new GenesisClient(host); try { DataEventListener listener = new PivotDataEventListener(); service.setListener(listener); service.start(); } catch (IOException e) { logger.error("GenesisClient throws IOException during startup"); } catch (VciNotFoundException e) { logger.error("GenesisClient cannot find Vci device during startup"); throw new TaskExecutionException(e); } return "Done"; } } public void messageSent(Object message) { if (message instanceof LogEvent) { messages.add((LogEvent) message); return; } if (message instanceof ServerCloseEvent) { pc_status.setImage(PC_STATUS_OFF); Alert.alert(MessageType.ERROR,"The Faultmate Genesis server has closed the connection. ", window, new DialogCloseListener() { public void dialogClosed(Dialog dialog, boolean modal) { try { window.close(); shutdown(true); } catch (Exception e) { e.printStackTrace(); } } }); } if (message instanceof ErrorEvent) { vci_status.setImage(VCI_STATUS_OFF); Alert.alert(MessageType.ERROR,((ErrorEvent) message).getMessage(), window, new DialogCloseListener() { public void dialogClosed(Dialog dialog, boolean modal) { try { window.close(); shutdown(true); } catch (Exception e) { e.printStackTrace(); } } }); } if (message instanceof ContactEvent) { vci_status.setImage(VCI_STATUS_OFF); messages.add(new LogEvent(((ContactEvent) message).getMessage())); Alert.alert(MessageType.ERROR,((ContactEvent) message).getMessage(), window, new DialogCloseListener() { public void dialogClosed(Dialog dialog, boolean modal) { try { window.close(); shutdown(true); } catch (Exception e) { e.printStackTrace(); } } }); } if (message instanceof ConnectEvent) { messages.add(new LogEvent(((ConnectEvent) message).getMessage())); if (((ConnectEvent) message).isConnected()) { pc_status.setImage(PC_STATUS_ON); } else { pc_status.setImage(PC_STATUS_OFF); } } } @Override public void initialize(Map<String, Object> namespace, URL location, Resources resources) { messages = new ArrayList(); tv.setTableData(messages); /* Set the initial Modem light position */ tx.setImage(TX_OFF); rx.setImage(RX_OFF); /* Set the initial "Connection" icon status.*/ car.setImage(CAR); vci_status.setImage(VCI_STATUS_OFF); pc.setImage(PC); pc_status.setImage(PC_STATUS_OFF); server.setImage(SERVER); } } -- View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Binding-Issues-converting-from-1-5-to-2-0-tp3235662p3235662.html Sent from the Apache Pivot - Users mailing list archive at Nabble.com.