예제 #1
0
 /*
  * (non-Javadoc)
  *
  * @see org.ozsoft.texasholdem.Client#act(java.util.Set)
  */
 public Action act(Set<Action> allowedActions) {
   boardPanel.setMessage("Please select an action.");
   Action action = controlPanel.getUserInput(allowedActions);
   controlPanel.waitForUserInput();
   this.pack();
   return action;
 }
 private void setRates() {
   I01.put(colorA, controlPanel.getA());
   I01.put(colorB, controlPanel.getB());
   I01.put(colorC, controlPanel.getC());
   I02 = 0;
   for (int L01 : I01.values()) {
     I02 += L01;
   }
 }
예제 #3
0
 UserInterface(ControlPanel controlPanel) {
   super(
       new DefaultControlEnvironment(controlPanel.getCoreInterface()),
       controlPanel.getCoreInterface().i18n().getStaticStr("CpUserInterfaceGeneral"));
   NullCheck.notNull(controlPanel, "controlPanel");
   this.controlPanel = controlPanel;
   this.luwrain = controlPanel.getCoreInterface();
   this.sett = Settings.createUserInterface(luwrain.getRegistry());
   fillForm();
 }
 @Override
 // Method for actionPerformed by Random Listener
 public void actionPerformed(ActionEvent e) {
   // Stop the simulation
   listener.stopSimulation();
   // Clear the grid
   cp.getFrame().clearGrid();
   // Clear the generation count
   cp.getFrame().clearGenCount();
   // Make the grid a random initialization
   cp.getFrame().randomGrid();
   // Makes the grid NOT editable
   cp.getFrame().setGridChangeable(false);
 }
예제 #5
0
 // removeAll on hide!!!
 public void show(Component invoker, int x, int y) {
   ControlPanel panel = (ControlPanel) invoker.getParent();
   control = (LawControl) panel.getControl();
   removeAll();
   String[] names = control.getPresetNames();
   if (names == null) return;
   for (int i = 0; i < names.length; i++) {
     JMenuItem item = new JMenuItem(names[i]);
     add(item);
     item.addActionListener(this);
   }
   // create dynamic menu here
   super.show(invoker, x, y);
 }
예제 #6
0
파일: Console.java 프로젝트: xanax/scratch
  /** @param f */
  void loadParameters(File f) {
    try {
      parameters = new ParameterDatabase(f, clArgs);
    } catch (FileNotFoundException ex) {
      Output.initialError(
          "A File Not Found Exception was generated upon "
              + "reading the parameter file \""
              + f.getPath()
              + "\".\nHere it is:\n"
              + ex);
    } catch (IOException ex) {
      Output.initialError(
          "An IO Exception was generated upon reading the "
              + "parameter file \""
              + f.getPath()
              + "\".\nHere it is:\n"
              + ex);
    }

    if (parameters == null) {
      Output.initialError("No parameter file was loaded");
    } else {
      paramPanel.loadParameters();
      conPanel.loadParameters();
    }
  }
예제 #7
0
파일: Console.java 프로젝트: xanax/scratch
 void restoreFromCheckpoint(File checkpoint) {
   try {
     state = Checkpoint.restoreFromCheckpoint(checkpoint.getCanonicalPath());
     parameters = state.parameters;
     paramPanel.loadParameters();
     conPanel.loadParameters();
     paused = true;
     setStep(false);
     spawnPlayThread(true);
     stopButton.setEnabled(true);
   } catch (OptionalDataException e) {
     Output.initialError(
         "A ClassNotFoundException was generated upon"
             + "starting up from a checkpoint."
             + "\nHere it is:\n"
             + e);
   } catch (ClassNotFoundException e) {
     Output.initialError(
         "A ClassNotFoundException was generated upon"
             + "starting up from a checkpoint."
             + "\nHere it is:\n"
             + e);
   } catch (IOException e) {
     Output.initialError(
         "An IO Exception was generated upon"
             + "starting up, probably in setting up a log"
             + "\nHere it is:\n"
             + e);
   }
 }
예제 #8
0
 public void disconnect() {
   transmitting = false;
   receiverThread.shutDown();
   channel.disconnect();
   control.disconnected();
   setTitle("Not connected");
 }
예제 #9
0
  public MainApp() {
    canvas = new Canvas(5);
    controlPanel = new ControlPanel();

    controlPanel.setCanvas(canvas);

    add(canvas);
    add(controlPanel);
  }
예제 #10
0
  /**
   * Constructs the popup menu that will be injected into the popup menu of the node
   *
   * @param nodeView the node view that was clicked on in the graph view
   */
  protected JMenu getPopupMenu(NodeView nodeView) {
    /* Get a handle to the control panel. If the control panel is not shown yet,
     * we don't put anything in the context menu */
    ControlPanel panel = ControlPanel.getShownInstance();
    if (panel == null) return null;

    JMenu menu = new JMenu(ClusterONE.applicationName);
    menu.add(new GrowClusterAction(nodeView.getNode()));
    menu.add(GrowClusterAction.getGlobalInstance());

    return menu;
  }
예제 #11
0
파일: Console.java 프로젝트: xanax/scratch
 /**
  * This method initializes jTabbedPane
  *
  * @return javax.swing.JTabbedPane
  */
 JTabbedPane getJTabbedPane() {
   if (jTabbedPane == null) {
     jTabbedPane = new JTabbedPane();
     conPanel = new ControlPanel(this);
     conPanel.disableControls();
     jTabbedPane.add("Control", conPanel);
     paramPanel = new ParametersPanel(this);
     jTabbedPane.add("Parameters", paramPanel);
     jTabbedPane.addTab("Statistics", null, getStatisticsPane(), null);
     jTabbedPane.addTab("Inspection", null, getInspectionPane(), null);
   }
   return jTabbedPane;
 }
예제 #12
0
 public void connect() {
   try {
     channel.connect("TOTAL_TOKEN_DEMO_GROUP");
   } catch (ChannelException e) {
     e.printStackTrace();
   }
   receiverThread = new ReceiverThread();
   receiverThread.start();
   Address a = channel.getAddress();
   if (a != null) setTitle(a.toString());
   else setTitle("Not connected");
   control.connected();
 }
예제 #13
0
  App() {
    game = new Game();
    view = new View(game, game.getImage());
    controlPanel = new ControlPanel(view, game);

    setTitle("Zap 'em");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    add(view, BorderLayout.CENTER);
    add(controlPanel, BorderLayout.SOUTH);

    Dimension dimension =
        new Dimension(Game.IMAGE_SIZE, Game.IMAGE_SIZE + controlPanel.getHeight());
    setSize(dimension);
    setPreferredSize(dimension);
    setVisible(true);
  }
 @After
 public void finilize() {
   cp.tearDown();
 }
예제 #15
0
 @Override
 public boolean onEnvironmentEvent(EnvironmentEvent event) {
   NullCheck.notNull(event, "event");
   if (controlPanel.onEnvironmentEvent(event)) return true;
   return super.onEnvironmentEvent(event);
 }
예제 #16
0
 @Override
 public boolean onKeyboardEvent(KeyboardEvent event) {
   NullCheck.notNull(event, "event");
   if (controlPanel.onKeyboardEvent(event)) return true;
   return super.onKeyboardEvent(event);
 }
예제 #17
0
  public void postState(int newState, int oldState) {
    if (newState == Player.STATE_DISCONNECTED) {
      frame.setTitle("RDV");

      controlAction.setEnabled(false);
      disconnectAction.setEnabled(false);
      saveAction.setEnabled(false);
      importAction.setEnabled(false);
      exportAction.setEnabled(false);

      controlPanel.setEnabled(false);
      markerSubmitPanel.setEnabled(false);

      ActionFactory.getInstance().getOfflineAction().setSelected(false);
    } else if (oldState == Player.STATE_DISCONNECTED) {
      frame.setTitle(rbnb.getServerName() + " - RDV");

      controlAction.setEnabled(true);
      disconnectAction.setEnabled(true);

      LocalServer localServer = LocalServer.getInstance();
      boolean offline =
          rbnb.getRBNBHostName().equals(localServer.getHost())
              && rbnb.getRBNBPortNumber() == localServer.getPort();
      saveAction.setEnabled(!offline);
      importAction.setEnabled(offline);
      exportAction.setEnabled(true);

      controlPanel.setEnabled(true);
      markerSubmitPanel.setEnabled(true);
    }

    if (newState == Player.STATE_LOADING
        || newState == Player.STATE_PLAYING
        || newState == Player.STATE_MONITORING) {
      startThrobber();
    } else if (oldState == Player.STATE_LOADING
        || oldState == Player.STATE_PLAYING
        || oldState == Player.STATE_MONITORING) {
      stopThrobber();
    }

    if (newState == Player.STATE_LOADING) {
      setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

      loadingDialog = new LoadingDialog(frame);

      new Thread() {
        public void run() {
          synchronized (loadingMonitor) {
            if (loadingDialog == null) {
              return;
            }

            try {
              loadingMonitor.wait(1000);
            } catch (InterruptedException e) {
            }

            if (loadingDialog != null) {
              loadingDialog.setVisible(true);
              loadingDialog.start();
            }
          }
        }
      }.start();
    } else if (oldState == Player.STATE_LOADING) {
      setCursor(null);

      synchronized (loadingMonitor) {
        loadingMonitor.notify();

        if (loadingDialog != null) {
          loadingDialog.close();
          loadingDialog = null;
        }
      }
    }
  }
 @Test
 public void checkShowOnDashboardOption() throws InterruptedException {
   cp.clickControlPanelSetupLink();
   cps.clickDisplayOnDashboardCheckBox("New account", true);
 }
 @Before
 public void initialize() {
   cp.setUp();
   cp.MainLogin("testhome", "homemoney");
 }
예제 #20
0
 @Override
 public Action act(int minBet, int currentBet, Set<Action> allowedActions) {
   boardPanel.setMessage("Please select an action:");
   return controlPanel.getUserInput(minBet, humanPlayer.getCash(), allowedActions);
 }
예제 #21
0
  public void readNetwork() {
    ControlPanel cp_1 = new ControlPanel(this.network, "Data Selection", 1);
    this.network.addPanel(cp_1);

    ToggleNode Toggle_1 = new ToggleNode(this.network, "Toggle", 1, "Toggle");
    this.network.addElement((Object) Toggle_1);

    SelectionNode Selector_1 = new SelectionNode(this.network, "Selector", 1, "Selector");
    this.network.addElement((Object) Selector_1);

    RadioGroup pdown_Selector_1 = new RadioGroup();
    Selector_1.addInteractor(pdown_Selector_1);
    pdown_Selector_1.setStyle(1);
    pdown_Selector_1.setLabelLines(1);
    pdown_Selector_1.setLabel("Main Plot");
    pdown_Selector_1.setVertical();
    Selector_1.setBounds(pdown_Selector_1, 0, 0, 204, 108);
    pdown_Selector_1.setOutputType(BinaryInstance.INTEGER);
    cp_1.addInteractor(pdown_Selector_1);
    Vector Selector_1_vn = new Vector(3);
    Vector Selector_1_vo = new Vector(3);
    Selector_1_vn.addElement("food group");
    Selector_1_vo.addElement("0");
    Selector_1_vn.addElement("item");
    Selector_1_vo.addElement("1");
    Selector_1_vn.addElement("unit");
    Selector_1_vo.addElement("3");
    Selector_1.setValues(Selector_1_vn, Selector_1_vo);
    Selector_1.selectOption(1);

    PickNode Pick_1 = new PickNode(this.network, "Pick", 1, "Pick_1");
    this.network.addElement((Object) Pick_1);

    WebOptionsNode WebOptions_10 = new WebOptionsNode(this.network, "WebOptions", 10, "WebOptions");
    this.network.addElement((Object) WebOptions_10);

    ImageNode Image_2 = new ImageNode(this.network, "Image", 2, "Image");
    this.network.addElement((Object) Image_2);
    Image_2.setInputValueString(5, "[1.92754 1.8494 0]");
    Image_2.setInputValueString(6, "[1.92754 1.8494 27.9747]");
    Image_2.setInputValueString(7, "14.9916");
    Image_2.setInputValueString(10, "[0 1 0]");
    Image_2.setInputValueString(41, "pick");
    Image_2.setInputValueString(42, "Pickable Plot");
    Image_2.addInputArc(49, WebOptions_10, 1);

    WebOptionsNode WebOptions_11 = new WebOptionsNode(this.network, "WebOptions", 11, "WebOptions");
    this.network.addElement((Object) WebOptions_11);

    ImageNode Image_3 = new ImageNode(this.network, "Image", 3, "Image");
    this.network.addElement((Object) Image_3);
    Image_3.setInputValueString(5, "[6.92754 4.52749 0]");
    Image_3.setInputValueString(6, "[6.92754 4.52749 56.3749]");
    Image_3.setInputValueString(7, "30.2113");
    Image_3.setInputValueString(10, "[0 1 0]");
    Image_3.setInputValueString(41, "none");
    Image_3.addInputArc(49, WebOptions_11, 1);

    WebOptionsNode WebOptions_12 = new WebOptionsNode(this.network, "WebOptions", 12, "WebOptions");
    this.network.addElement((Object) WebOptions_12);

    ImageNode Image_4 = new ImageNode(this.network, "Image", 4, "Image");
    this.network.addElement((Object) Image_4);
    Image_4.setInputValueString(5, "[3.07962 8.15925 2.74122]");
    Image_4.setInputValueString(6, "[36.347 -19.6507 26.44]");
    Image_4.setInputValueString(7, "26.481");
    Image_4.setInputValueString(10, "[-0.387822 0.283476 0.877061]");
    Image_4.setInputValueString(41, "none");
    Image_4.addInputArc(49, WebOptions_12, 1);
  }
예제 #22
0
        public void connectionChanged(AsyncVehicleServer vehicle) {

          // When the connection is changed, update all subcomponents
          _cmdPanel.setVehicle(vehicle);
          _ctrlPanel.setVehicle(vehicle);
        }