Package framework

Examples of framework.IPlaneUpdateObject


                    public void actionPerformed(ActionEvent e) {
                        String oC = selectedPlane.getActiveController();
                        String nC = "???";
                        selectedPlane.setActiveController(nC);
                        IPlaneUpdateObject tmp = new PlaneUpdateObject(selectedPlane);
                        atmcModel.handlePlaneUpdate(selectedPlane, oC, nC);
                        atmcModel.sendObject(tmp);
                        flightListModel.fireTableDataChanged();
                    }
                });
                this.add(tmp);
                for (int i = 0; i < functions.length; i++) {
                    if (!functions[i].equals("Pilot") && !functions[i].equals("-no function-")) {
                        final int k = i;
                        tmp = new JMenuItem(functions[i]);
                        tmp.addActionListener(new ActionListener() {

                            public void actionPerformed(ActionEvent e) {
                                String oC = selectedPlane.getActiveController();
                                String nC = functions[k];
                                selectedPlane.setActiveController(nC);
                                IPlaneUpdateObject tmp = new PlaneUpdateObject(selectedPlane);
                                atmcModel.handlePlaneUpdate(selectedPlane, oC, nC);
                                atmcModel.sendObject(tmp);
                                flightListModel.fireTableDataChanged();
                            }
                        });
                        this.add(tmp);
                    }

                }
            } else {
                JMenuItem tmp = new JMenuItem("Myself");
                tmp.addActionListener(new ActionListener() {

                    public void actionPerformed(ActionEvent e) {
                        String oC = selectedPlane.getActiveController();
                        String nC = atmcModel.getFunction();
                        selectedPlane.setActiveController(nC);
                        IPlaneUpdateObject tmp = new PlaneUpdateObject(selectedPlane);
                        atmcModel.handlePlaneUpdate(selectedPlane, oC, nC);
                        atmcModel.sendObject(tmp);
                        flightListModel.fireTableDataChanged();
                    }
                    });
View Full Code Here


    }

    public void setUpdates() {
        Iterator<IPlaneUpdateObject> uit = pul.iterator();
        while (uit.hasNext()) {
            IPlaneUpdateObject puo = uit.next();
            if (radarPlaneList.containsKey(puo.getIp())) {
                IRadarPlaneObject current = radarPlaneList.get(puo.getIp());
                handlePlaneUpdate(current, current.getActiveController(), puo.getActiveController());
                current.update(puo);

            } else {
                this.addPlane(puo);
            }
View Full Code Here

                model.getClient().setUserList(so.getUserList());
            }else if (so.isTag(ServiceTags.chatMessage)) {
                model.getClient().addChatMessage(so.getSenderName()+":"+so.getValue());
            }
        } else if(o instanceof IPlaneUpdateObject){
            IPlaneUpdateObject puo = (IPlaneUpdateObject)o;
            model.addPlaneUpdate(puo);
        } else if(o instanceof IPlaneDataObject){
            IPlaneDataObject pdo = (IPlaneDataObject)o;
            model.addPlaneData(pdo);
        }
View Full Code Here

    public synchronized void sendUpdateList(IUserInfo ui) {
        Iterator it = updateList.iterator();
        while (it.hasNext()) {
            try {
                IPlaneUpdateObject puo = (IPlaneUpdateObject) it.next();
                ui.getOOS().writeObject(puo);
            } catch (IOException ex) {
                Logger.getLogger(ATMSModel.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
View Full Code Here

    public synchronized void addPlaneUpdate(IPlaneUpdateObject puo, IUserInfo senderUi) {
        System.out.println("update received");
        Iterator<IPlaneUpdateObject> it = updateList.iterator();
        while (it.hasNext()) {
            IPlaneUpdateObject current = it.next();
            if (current.getIp().equals(puo.getIp())) {
                it.remove();
            }
        }
        updateList.add(puo);
        server.broadcast(puo, senderUi);
View Full Code Here

    public synchronized void resetPlanes(String func) {
        if (func != null && !(func.equals("Pilot") || func.equals("-no function-"))) {
            System.out.println("resetting planes from " + func);
            Iterator<IPlaneUpdateObject> it = updateList.iterator();
            while (it.hasNext()) {
                IPlaneUpdateObject current = it.next();
//            System.out.println(current.getActiveController()+" - "+func);
                if (current.getActiveController().equals(func)) {
                    current.setController("???");
                    System.out.println(func + " deleted, new " + current.getActiveController());
                    server.broadcast(current);
                }
            }
        }
    }
View Full Code Here

                        if (System.currentTimeMillis() - time > 5000) {
                            System.out.println("client without signal since 5 seconds");
                            activityList.remove(ip);
                            Iterator it = updateList.iterator();
                            while (it.hasNext()) {
                                IPlaneUpdateObject puo = (IPlaneUpdateObject) it.next();
                                if (ip.equals(puo.getIp())) {
                                    System.out.println("client removed");
                                    it.remove();
                                }
                            }
                        }
View Full Code Here

TOP

Related Classes of framework.IPlaneUpdateObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.