Example #1
0
    public TestList() {
      setLayout(new BorderLayout());

      final JList list = new JList(C2dTests.getNames());
      final JButton button = new JButton("Run Test");
      JScrollPane pane = new JScrollPane(list);

      DefaultListSelectionModel m = new DefaultListSelectionModel();
      m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      m.setLeadAnchorNotificationEnabled(false);
      list.setSelectionModel(m);

      list.addMouseListener(
          new MouseAdapter() {
            public void mouseClicked(MouseEvent event) {
              if (event.getClickCount() == 2) button.doClick();
            }
          });

      final Preferences prefs =
          new LwjglPreferences(
              new FileHandle(new LwjglFiles().getExternalStoragePath() + ".prefs/c2d-tests"));
      list.setSelectedValue(prefs.getString("last", null), true);

      button.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              String testName = (String) list.getSelectedValue();
              Engine test = C2dTests.newTest(testName);
              LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
              config.fullscreen = false;
              config.width = (int) Engine.getWidth();
              config.height = (int) Engine.getHeight();
              config.title = testName;
              config.vSyncEnabled = true;

              prefs.putString("last", testName);
              prefs.flush();

              new LwjglApplication(test, config);
            }
          });

      add(pane, BorderLayout.CENTER);
      add(button, BorderLayout.SOUTH);
    }
Example #2
0
 public PermanentSingleSelectionModel() {
   super.setSelectionMode(SINGLE_SELECTION);
 }
Example #3
0
  public void init() {

    // <Begin_init>
    if (getParameter("RESOURCE_PROPERTIES") != null) {
      localePropertiesFileName = getParameter("RESOURCE_PROPERTIES");
    }
    resourceBundle =
        com.adventnet.apiutils.Utility.getBundle(
            localePropertiesFileName, getParameter("RESOURCE_LOCALE"), applet);
    if (initialized) return;
    this.setSize(getPreferredSize().width + 495, getPreferredSize().height + 480);
    setTitle(resourceBundle.getString("ViewConfig"));
    Container container = getContentPane();
    container.setLayout(new BorderLayout());
    try {
      initVariables();
      setUpGUI(container);
      setUpProperties();
      setUpConnections();
    } catch (Exception ex) {
      showStatus(resourceBundle.getString("Error in init method"), ex);
    }
    // let us set the initialized variable to true so
    // we dont initialize again even if init is called
    initialized = true;

    // <End_init>
    setTitle(resourceBundle.getString("View Configuration"));
    setIconImage(AuthMain.getBuilderUiIfInstance().getFrameIcon());
    JLabel1.setIcon(AuthMain.getBuilderUiIfInstance().getImage("viewconfig.png"));
    com.adventnet.security.ui.ViewListCellRenderer ViewListCellRenderer1 =
        new com.adventnet.security.ui.ViewListCellRenderer();
    JTable1.setDefaultRenderer(JTable1.getColumnClass(0), ViewListCellRenderer1);

    JLabel2.setIcon(AuthMain.getBuilderUiIfInstance().getImage("addview1.png"));
    JTable1.getCellEditor(0, 0)
        .getTableCellEditorComponent(JTable1, null, true, 0, 0)
        .setEnabled(false);
    DefaultCellEditor te = (DefaultCellEditor) JTable1.getCellEditor(0, 0);
    te.setClickCountToStart(10);
    JTable1.setCellEditor(te);

    JViewport vp = new JViewport();
    JLabel lab = new JLabel(resourceBundle.getString("List of available views"));
    lab.setHorizontalAlignment((int) JLabel.CENTER_ALIGNMENT);
    lab.setForeground(Color.black);
    vp.setView(lab);

    AuthMain.getBuilderUiIfInstance().centerWindow(this);
    setData();

    viewc = this;

    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent we) {
            close();
          }
        });

    /*
    TableColumn col2  = JTable1.getColumnModel().getColumn(1);
    DefaultTableCellRenderer ren = new DefaultTableCellRenderer();
    ren.setIcon(AuthMain.getBuilderUiIfInstance().getImage("task1.png"));
    	col2.setCellRenderer(ren);
     	col2.setMaxWidth(30);
    */

    DefaultListSelectionModel selModel = new DefaultListSelectionModel();
    selModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JTable1.setSelectionModel(selModel);
  }
Example #4
0
 @Override
 public void setSelectionMode(int selectionMode) {
   delegate.setSelectionMode(selectionMode);
 }