Esempio n. 1
0
 @SuppressWarnings("unchecked") // FIXME in Java7
 private void updateDetailView() {
   cellRenderer = getCellRenderer();
   buildQueueList.setCellRenderer(cellRenderer);
   buildingList.setCellRenderer(cellRenderer);
   unitList.setCellRenderer(cellRenderer);
 }
Esempio n. 2
0
  private void actualizarReferencias() {
    if (petList != null) {
      petList.setCellRenderer(null);
    }

    petList = new JList();
    petList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    paleta = imagen.getPaleta();

    // Elementos iniciales
    elementosMuestra = new DefaultListModel<String>();
    for (int i = 0; i < paleta.getValores().size(); i++) {
      elementosMuestra.addElement("" + i);
    }

    //		System.out.println("Referencias: " + paleta.getValores().size());
    petList.setModel(elementosMuestra);
    petList.setSelectedIndex(0);
    ColorListRenderer elem = new ColorListRenderer(this, imagen.getPaleta());
    elem.setPreferredSize(new Dimension(150, 30));
    petList.setCellRenderer(elem);
    //		panel_1.add(petList);
    scrollPane.setViewportView(petList);

    petList.updateUI();
  }
Esempio n. 3
0
  public static void updateTables() {
    // System.out.println("Updating tables");
    if (!((DrawPanel) Main.drawPanel).getGraph().getTransitions().isEmpty()
        && !((DrawPanel) Main.drawPanel).getGraph().getPlaces().isEmpty()) {
      Integer[][] inMatrix = ((DrawPanel) Main.drawPanel).getGraph().buildIMatrix();
      Integer[][] outMatrix = ((DrawPanel) Main.drawPanel).getGraph().buildQMatrix();

      Object[] columnHeaders = createColumnHeaders(inMatrix);
      Object[] rowHeaders = createRowHeaders(outMatrix);
      Main.jtI.setModel(new DefaultTableModel(inMatrix, columnHeaders));
      Main.jtO.setModel(new DefaultTableModel(outMatrix, columnHeaders));

      JList rowHeadersI = new JList(rowHeaders);
      JList rowHeadersO = new JList(rowHeaders);

      // rowHeadersI.setFixedCellWidth(40);
      rowHeadersI.setFixedCellHeight(16);
      rowHeadersI.setCellRenderer(new RowHeaderRenderer(Main.jtI));
      rowHeadersI.setBackground(Main.jtI.getParent().getBackground());

      // rowHeadersO.setFixedCellWidth(40);
      rowHeadersO.setFixedCellHeight(16);
      rowHeadersO.setCellRenderer(new RowHeaderRenderer(Main.jtO));
      rowHeadersO.setBackground(Main.jtO.getParent().getBackground());

      JScrollPane scrollI = (JScrollPane) Main.jtI.getParent().getParent();
      JScrollPane scrollO = (JScrollPane) Main.jtO.getParent().getParent();
      scrollI.setRowHeaderView(rowHeadersI);
      scrollO.setRowHeaderView(rowHeadersO);

      Main.jtI.repaint();
      Main.jtO.repaint();
    }
  }
  protected void listMouseClicked(EventObject e) {
    for (ListLevel listLevelTuple : depthLists) {
      listLevelTuple.list.setCellRenderer(new SceneDepthListCellRender());
    }

    JList list = (JList) e.getSource();
    selectedScene = (Scene) list.getSelectedValue();
    jumpToBt.setEnabled(true);
    jumpToBt.setText("Jump to [" + selectedScene.getName() + "]");

    int idx = depthLists.indexOf(new ListLevel(-1, list));
    assert idx != -1 : "Should have found a scenesList";

    if (idx == 0) {
      JList startList = depthLists.get(1).list;
      startList.setCellRenderer(new ToCellRenderer(selectedScene));
      Util.showComponent(startList);
    } else if (idx > 0) {
      JList fromList = depthLists.get(idx - 1).list;
      logger.debug("Before: " + fromList.getSelectedValue());

      fromList.setCellRenderer(new FromCellRenderer(selectedScene));
      Util.showComponent(fromList);

      if (idx + 1 < depthLists.size()) {
        JList afterList = depthLists.get(idx + 1).list;
        logger.debug("After: " + afterList.getSelectedValue());

        afterList.setCellRenderer(new ToCellRenderer(selectedScene));
        Util.showComponent(afterList);
      }
    }

    Util.showComponent(panel);
  }
  private void updateRenderers(boolean isStructure) {
    if (isStructure) {
      if (mDefaultRenderer == null) mDefaultRenderer = mList.getCellRenderer();

      ChemistryCellRenderer renderer = new ChemistryCellRenderer();
      renderer.setAlternatingRowBackground(DetailTableCellRenderer.TOGGLE_ROW_BACKGROUND);
      mList.setCellRenderer(renderer);
      mList.setFixedCellHeight(80);
    } else {
      if (mDefaultRenderer != null) {
        mList.setCellRenderer(mDefaultRenderer);
        mList.setFixedCellHeight(-1);
      }
    }
  }
  public FeedbackViewerUI(
      DefaultListModel<AbstractFeedbackType> questionListModel,
      DefaultListModel<FeedbackViewerUserEntry> userListModel) {
    super();
    setTitle("Feedback Viewer");
    setIconImage(Loader.getImageIcon(Loader.IMAGE_STURESY).getImage());

    // Button Panel containing download/upload/etc. buttons
    JPanel buttonPanel = createButtonPanel();

    JPanel leftPanel = new JPanel();
    leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS));

    questionList = new JList<>(questionListModel);
    questionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    questionList.setCellRenderer(new NumberedListCellRenderer());
    userList = new JList<>(userListModel);
    userList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JScrollPane questionListScrollPane = new JScrollPane(questionList);
    JScrollPane userListScrollPane = new JScrollPane(userList);

    // Populate left panel of SplitPane
    leftPanel.add(new JLabel("Select by Question:"));
    leftPanel.add(questionListScrollPane);
    leftPanel.add(new JLabel("Select by User:"));
    leftPanel.add(userListScrollPane);

    splitPane = new JSplitPane();
    splitPane.setLeftComponent(leftPanel);

    add(splitPane, BorderLayout.CENTER);
    add(buttonPanel, BorderLayout.PAGE_END);

    setRightPanel(new JPanel());
  }
  private void createCopiesPanel(JPanel pnMainPanel) {
    pnCopies = new JPanel();
    pnMainPanel.add(pnCopies, BorderLayout.CENTER);
    pnCopies.setLayout(new BorderLayout(0, 0));

    JPanel pnCopiesOverview = new JPanel();
    pnCopies.add(pnCopiesOverview, BorderLayout.CENTER);
    pnCopiesOverview.setLayout(new BorderLayout(0, 0));

    listCopies = new JList<Copy>();
    listCopies.setModel(listModelCopies);
    listCopies.setCellRenderer(new CopiesListCellRenderer());
    pnCopiesOverview.add(new JScrollPane(listCopies));

    JPanel pnCopiesAction = new JPanel();
    pnCopiesAction.setLayout(new FlowLayout(FlowLayout.RIGHT));
    Condition[] options = new Condition[Condition.values().length + 1];
    options[0] = null;
    for (int i = 1; i <= options.length - 1; i++) {
      options[i] = Condition.values()[i - 1];
    }
    options[1] = Condition.LOST;
    comboCondition = new JComboBox<Condition>(new ConditionComboBoxModel());
    comboCondition.setRenderer(new ConditionListCellRenderer());
    comboCondition.setEnabled(false);
    pnCopiesAction.add(comboCondition);
    btnSetCondition = new JButton();
    btnSetCondition.setEnabled(false);
    btnSetCondition.setMnemonic('t');
    pnCopiesAction.add(btnSetCondition);

    pnCopies.add(pnCopiesAction, BorderLayout.SOUTH);
  }
Esempio n. 8
0
  public TasksPanelBase() {
    setLayout(new BorderLayout(0, 0));

    panel = new JPanel();
    panel.setBorder(
        new TitledBorder(null, "Tasks", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panel, BorderLayout.CENTER);
    panel.setOpaque(false);
    panel.setLayout(new BorderLayout(0, 0));

    scrollPane = new JScrollPane();
    scrollPane.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panel.add(scrollPane, BorderLayout.CENTER);

    taskList = new JList();
    taskList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    taskList.setCellRenderer(new TaskListRenderer());
    scrollPane.setViewportView(taskList);

    buttonPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) buttonPanel.getLayout();
    flowLayout.setVgap(0);
    flowLayout.setHgap(0);
    flowLayout.setAlignment(FlowLayout.RIGHT);
    panel.add(buttonPanel, BorderLayout.SOUTH);

    deleteButton = new JButton("");
    deleteButton.setActionCommand("delete");
    deleteButton.setIcon(
        new ImageIcon(TasksPanelBase.class.getResource("/resources/icons/delete.png")));
    buttonPanel.add(deleteButton);
  }
  public FPGACommanderListWindow(
      String Title, Color fg, boolean count, FPGACommanderListModel model) {
    super((count) ? Title + " (0)" : Title);
    this.Title = Title;
    setResizable(true);
    setAlwaysOnTop(false);
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    Color bg = Color.black;

    textArea.setBackground(bg);
    textArea.setForeground(fg);
    textArea.setSelectionBackground(fg);
    textArea.setSelectionForeground(bg);
    textArea.setFont(new Font("monospaced", Font.PLAIN, FontSize));
    textArea.setModel(model);
    textArea.setCellRenderer(model.getMyRenderer(count));
    textArea.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    model.addListDataListener(this);

    JScrollPane textMessages = new JScrollPane(textArea);
    textMessages.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    textMessages.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    add(textMessages);
    setLocationRelativeTo(null);
    textArea.addKeyListener(this);
    pack();
    addWindowListener(this);
    this.count = count;
    this.model = model;
  }
 private void jbInit() throws Exception {
   this.setSize(new Dimension(560, 293));
   setTitle("Please select a contact to send");
   _scrollPaneContactList.setBounds(15, 10, 530, 237);
   _listContactList.setOpaque(false);
   _listContactList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   _listContactList.setCellRenderer(new ContactListRenderer());
   _listContactList.addListSelectionListener(
       new ListSelectionListener() {
         public void valueChanged(ListSelectionEvent listSelectionEvent) {
           _listContactList_valueChanged(listSelectionEvent);
         }
       });
   _listContactList.setVisibleRowCount(JLIST_VISIBLE_ROW_COUNT);
   _scrollPaneContactList.addScrollUpButtonActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent actionEvent) {
           _scrollPaneContactList_scrollUp(actionEvent);
         }
       });
   _scrollPaneContactList.addScrollDownButtonActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent actionEvent) {
           _scrollPaneContactList_scrollDown(actionEvent);
         }
       });
   _scrollPaneContactList.addToViewport(_listContactList);
   _panelContent.add(_scrollPaneContactList, null);
 }
Esempio n. 11
0
    public void navigate(final Project project) {
      DefaultPsiElementListCellRenderer renderer = new DefaultPsiElementListCellRenderer();

      final JList list = new JList(myPsiFiles);
      list.setCellRenderer(renderer);

      renderer.installSpeedSearch(list);

      final Runnable runnable =
          new Runnable() {
            public void run() {
              int[] ids = list.getSelectedIndices();
              if (ids == null || ids.length == 0) return;
              Object[] selectedElements = list.getSelectedValues();
              for (Object element : selectedElements) {
                Navigatable descriptor = EditSourceUtil.getDescriptor((PsiElement) element);
                if (descriptor != null && descriptor.canNavigate()) {
                  descriptor.navigate(true);
                }
              }
            }
          };

      final Editor editor =
          PlatformDataKeys.EDITOR.getData(DataManager.getInstance().getDataContext());

      new PopupChooserBuilder(list)
          .setTitle("Choose file")
          .setItemChoosenCallback(runnable)
          .createPopup()
          .showInBestPositionFor(editor);
    }
  private static boolean doChooseLanguageToInject(Editor editor, final Processor<String> onChosen) {
    final String[] langIds = InjectedLanguage.getAvailableLanguageIDs();
    Arrays.sort(langIds);

    final JList list = new JBList(langIds);
    list.setCellRenderer(
        new ListCellRendererWrapper<String>(list.getCellRenderer()) {
          @Override
          public void customize(
              JList list, String value, int index, boolean selected, boolean hasFocus) {
            final Language language = InjectedLanguage.findLanguageById(value);
            assert language != null;
            final FileType ft = language.getAssociatedFileType();
            setIcon(ft != null ? ft.getIcon() : EmptyIcon.ICON_16);
            setText(
                language.getDisplayName() + (ft != null ? " (" + ft.getDescription() + ")" : ""));
          }
        });
    new PopupChooserBuilder(list)
        .setItemChoosenCallback(
            new Runnable() {
              public void run() {
                final String string = (String) list.getSelectedValue();
                onChosen.process(string);
              }
            })
        .setFilteringEnabled(new Function.Self<Object, String>())
        .createPopup()
        .showInBestPositionFor(editor);
    return true;
  }
Esempio n. 13
0
 public NodeSelectionDialog(Frame owner, NodeLibrary library, NodeLibraryManager manager) {
   super(owner, "New Node", true);
   getRootPane().putClientProperty("Window.style", "small");
   JPanel panel = new JPanel(new BorderLayout());
   this.library = library;
   this.manager = manager;
   filteredNodeListModel = new FilteredNodeListModel(library, manager);
   searchField = new JTextField();
   searchField.putClientProperty("JTextField.variant", "search");
   EscapeListener escapeListener = new EscapeListener();
   searchField.addKeyListener(escapeListener);
   ArrowKeysListener arrowKeysListener = new ArrowKeysListener();
   searchField.addKeyListener(arrowKeysListener);
   SearchFieldChangeListener searchFieldChangeListener = new SearchFieldChangeListener();
   searchField.getDocument().addDocumentListener(searchFieldChangeListener);
   nodeList = new JList(filteredNodeListModel);
   DoubleClickListener doubleClickListener = new DoubleClickListener();
   nodeList.addMouseListener(doubleClickListener);
   nodeList.addKeyListener(escapeListener);
   nodeList.addKeyListener(arrowKeysListener);
   nodeList.setSelectedIndex(0);
   nodeList.setCellRenderer(new NodeRenderer());
   JScrollPane nodeScroll =
       new JScrollPane(
           nodeList,
           JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
           JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
   nodeScroll.setBorder(null);
   panel.add(searchField, BorderLayout.NORTH);
   panel.add(nodeScroll, BorderLayout.CENTER);
   setContentPane(panel);
   setSize(500, 400);
   SwingUtils.centerOnScreen(this);
 }
  public LayerDesignPanel(MainFrame father) {
    this.father = father;

    this.setLayout(null);

    jsp.setBounds(10, 10, 800, 600);
    this.add(jsp);

    jspL.setBounds(820, 10, 140, 200);
    this.add(jspL);
    jl.setCellRenderer(new MyCellRenderer());

    jbSaveLayer.setBounds(820, 220, 140, 20);
    this.add(jbSaveLayer);
    jbSaveLayer.addActionListener(this);

    jbLoadLayer.setBounds(820, 250, 140, 20);
    this.add(jbLoadLayer);
    jbLoadLayer.addActionListener(this);

    jbCreate.setBounds(820, 280, 140, 20);
    this.add(jbCreate);
    jbCreate.addActionListener(this);

    jbLoadAll.setBounds(820, 310, 140, 20);
    this.add(jbLoadAll);
    jbLoadAll.addActionListener(this);

    jtfCengMing.setBounds(820, 340, 140, 20);
    this.add(jtfCengMing);
  }
Esempio n. 15
0
  /** Creates a new QuestionImportUI */
  public QuestionImportUI() {
    _dialog = new JDialog();
    _dialog.setIconImage(Loader.getImageIcon(Loader.IMAGE_STURESY).getImage());

    _dialog.setLayout(new BorderLayout());

    _loadButton = new JButton(Localize.getString("button.load"));
    _cancelButton = new JButton(Localize.getString("button.cancel"));

    _list = new JList(new DefaultListModel());
    _list.setCellRenderer(new QuestionListCellRenderer(35));
    JScrollPane pane = new JScrollPane(_list);

    JLabel label = new JLabel(Localize.getString("label.select.questions"));

    _dialog.add(label, BorderLayout.NORTH);
    _dialog.add(pane, BorderLayout.CENTER);

    JPanel southpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    southpanel.add(_loadButton);
    southpanel.add(_cancelButton);

    _dialog.add(southpanel, BorderLayout.SOUTH);
    _dialog.setSize(300, 350);
  }
  public ReadOnlyStatusDialog(Project project, final FileInfo[] files) {
    super(project);
    myFiles = files;
    initFileList();

    ActionListener listener =
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            myChangelist.setEnabled(myUsingVcsRadioButton.isSelected());
          }
        };
    myUsingVcsRadioButton.addActionListener(listener);
    myUsingFileSystemRadioButton.addActionListener(listener);

    if (myUsingVcsRadioButton.isEnabled()) {
      myUsingVcsRadioButton.setSelected(true);
    } else {
      myUsingFileSystemRadioButton.setSelected(true);
    }
    myChangelist.setEnabled(myUsingVcsRadioButton.isSelected());
    myFileList.setCellRenderer(new FileListRenderer());
    setTitle(VcsBundle.message("dialog.title.clear.read.only.file.status"));

    init();
  }
Esempio n. 17
0
  /** Initializes the config list. */
  private void initList() {
    configList.setModel(new DefaultListModel());
    configList.setCellRenderer(new ConfigListCellRenderer());
    configList.addListSelectionListener(this);
    configList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    JScrollPane configScrollList = new JScrollPane();

    configScrollList.getVerticalScrollBar().setUnitIncrement(30);

    configScrollList.getViewport().add(configList);

    add(configScrollList, BorderLayout.WEST);

    String osgiFilter =
        "(" + ConfigurationForm.FORM_TYPE + "=" + ConfigurationForm.ADVANCED_TYPE + ")";
    ServiceReference[] confFormsRefs = null;
    try {
      confFormsRefs =
          AdvancedConfigActivator.bundleContext.getServiceReferences(
              ConfigurationForm.class.getName(), osgiFilter);
    } catch (InvalidSyntaxException ex) {
    }

    if (confFormsRefs != null) {
      for (int i = 0; i < confFormsRefs.length; i++) {
        ConfigurationForm form =
            (ConfigurationForm) AdvancedConfigActivator.bundleContext.getService(confFormsRefs[i]);

        if (form.isAdvanced()) this.addConfigForm(form);
      }
    }
  }
Esempio n. 18
0
  /** @return */
  protected void createList() {
    listModel = createListDataModel();

    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    ListCellRenderer cellRenderer = getListCellRenderer();
    if (cellRenderer != null) {
      list.setCellRenderer(cellRenderer);
    }

    list.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
              updateUIEnabled();
            }
          }
        });

    list.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            super.mouseClicked(e);
            if (e.getClickCount() == 2) {
              editItem(list.getSelectedValue(), false);
            }
          }
        });
  }
Esempio n. 19
0
  /** Initializes GUI components */
  public void init() {
    this.setLayout(new BorderLayout());

    nodeListModel = new DefaultListModel();

    nodeList = new JList(nodeListModel);
    nodeList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
    nodeList.setCellRenderer(new NodeCellRenderer(main));
    nodeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    nodeList.addMouseListener(new PopupListener(new NodeOptions(main)));

    listPane = new JScrollPane(nodeList);

    // Build the clear button
    clearButton = new JButton("Clear");
    clearButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            clearButtonPressed();
          }
        });
    clearButton.setMnemonic(KeyEvent.VK_K);
    add(listPane, BorderLayout.CENTER);
    add(clearButton, BorderLayout.SOUTH);
  }
Esempio n. 20
0
  private void buildLayout(String hostProgramTitle) {
    DefaultFormBuilder b = new DefaultFormBuilder(new FormLayout("fill:p:grow"));

    b.append(
        "<html>The following programs are needed for full functionality of "
            + hostProgramTitle
            + ".<br>"
            + "Install the external program first, then click 'relocate'.<br>"
            + "If the program is installed but cannot be found, double-click on the program to assign its location manually.</html>");

    model = new DefaultListModel();
    for (Binary bin : binaries) model.addElement(bin);
    list = new JList(model);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setFont(list.getFont().deriveFont(Font.PLAIN));
    list.setVisibleRowCount(4);
    list.setCellRenderer(
        new DefaultListCellRenderer() {
          @Override
          public Component getListCellRendererComponent(
              JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            JLabel l =
                (JLabel)
                    super.getListCellRendererComponent(
                        list, value, index, isSelected, cellHasFocus);
            Binary b = (Binary) value;
            String found = "";
            if (b.isFound()) {
              l.setIcon(ImageLoader.getImage(ImageLoader.Image.ok));
              found = b.getLocation();
            } else {
              l.setIcon(ImageLoader.getImage(ImageLoader.Image.error));
              found = "<b>Not found</b>";
            }
            l.setText(
                "<html><b>"
                    + b.getDescription()
                    + "</b><br><table><tr><td>Program:</td><td>"
                    + b.getCommand()
                    + "</td></tr><tr><td>Location:</td><td>"
                    + found
                    + "</td></tr></html>");

            l.setBorder(new EmptyBorder(5, 0, 5, 0));

            return l;
          }
        });
    b.append(new JScrollPane(list));

    close = new JButton("Close");
    relocate = new JButton("Relocate program automatically.");
    JPanel buttons = ButtonBarFactory.buildRightAlignedBar(relocate, close);
    b.append(buttons);

    b.setBorder(new EmptyBorder(10, 10, 10, 10));

    setLayout(new BorderLayout());
    add(b.getPanel());
  }
Esempio n. 21
0
  private void GetTasksForAsset(Asset SelectedAsset) {
    AssetTasks.clear();
    taskList.repaint();

    ResultSet tasksOnAssetListResultSet = null;
    Statement statement;
    try {
      statement = connection.createStatement();
      Asset asset = (Asset) assetList.getSelectedValue();
      tasksOnAssetListResultSet =
          statement.executeQuery("SELECT * FROM Task WHERE assetID = " + asset.getAssetID() + ";");

      randSQL.loadAllUsers();
      SetOfUsers allusers = randSQL.getAllUsers();

      while (tasksOnAssetListResultSet.next()) {
        int taskID;
        int projectID;
        User responsible = null;
        int taskPriority;
        String status;
        String taskName;
        String taskType;

        taskID = tasksOnAssetListResultSet.getInt("taskID");
        projectID = tasksOnAssetListResultSet.getInt("projectID");

        for (int i = 0; i < allusers.size(); i++) {
          if (tasksOnAssetListResultSet.getInt("responsiblePerson") == allusers.get(i).getUserID())
            ;
          {
            responsible = allusers.get(i);
            break;
          }
        }

        taskPriority = tasksOnAssetListResultSet.getInt("taskPriority");
        status = tasksOnAssetListResultSet.getString("status");
        taskName = tasksOnAssetListResultSet.getString("taskName");
        taskType = tasksOnAssetListResultSet.getString("type");

        Task newTask =
            new Task(
                taskID, responsible, taskName, taskPriority, status, projectID, asset, taskType);

        AssetTasks.add(newTask);
        taskList.setListData(AssetTasks);
        TasksListCellRenderer renderer =
            new TasksListCellRenderer(); // custom cell renderer to display property rather than
        // useless object.toString()
        taskList.setCellRenderer(renderer);
      }

      asset.setSetOfTasks(AssetTasks);

    } catch (SQLException ex) {
      Logger.getLogger(ManagerUI.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
Esempio n. 22
0
    public ToolsDlgPatient(String command, Point pt) {
      Map<Object, ImageIcon> icons = new HashMap<Object, ImageIcon>();
      icons.put(
          "Patientenbezogene Nachricht erstellen", SystemConfig.hmSysIcons.get("patnachrichten"));
      icons.put("(e)Mail für Patient erstellen (Alt+M)", SystemConfig.hmSysIcons.get("email"));
      icons.put("SMS für Patient erstellen (Alt+S)", SystemConfig.hmSysIcons.get("sms"));
      icons.put(
          "Zusatzinformationen zum aktuellen Patient (Alt+I)", SystemConfig.hmSysIcons.get("info"));
      // create a list with some test data
      JList list =
          new JList(
              new Object[] {
                "Patientenbezogene Nachricht erstellen",
                "(e)Mail für Patient erstellen (Alt+M)",
                "SMS für Patient erstellen (Alt+S)",
                "Zusatzinformationen zum aktuellen Patient (Alt+I)"
              });
      list.setCellRenderer(new IconListRenderer(icons));
      Reha.toolsDlgRueckgabe = -1;
      ToolsDialog tDlg = new ToolsDialog(Reha.thisFrame, "Werkzeuge: aktueller Patient", list);
      tDlg.setPreferredSize(
          new Dimension(
              300,
              200
                  + ((Boolean) SystemConfig.hmPatientenWerkzeugDlgIni.get("ToolsDlgShowButton")
                      ? 25
                      : 0)));
      tDlg.setLocation(pt.x - 200, pt.y + 30);
      tDlg.pack();
      tDlg.setModal(true);
      tDlg.activateListener();
      tDlg.setVisible(true);
      switch (Reha.toolsDlgRueckgabe) {
        case 0:
          doPatNachricht();
          return;
        case 1:
          if (!Rechte.hatRecht(Rechte.Patient_email, true)) {
            return;
          }
          break;
        case 2:
          if (!Rechte.hatRecht(Rechte.Patient_sms, true)) {
            return;
          }
          // new SMS(null);
          break;
        case 3:
          doPatFragebogen();
          if (!Rechte.hatRecht(Rechte.Patient_zusatzinfo, true)) {

            return;
          }
          break;
        case 4:
          break;
      }
      tDlg = null;
    }
Esempio n. 23
0
 /**
  * Adds a player and their face to the list.
  *
  * @param name The player name.
  */
 public void addPlayer(String name) {
   BufferedImage skin;
   BufferedImage face;
   try {
     skin = ImageIO.read(new URL("http://www.minecraft.net/skin/" + name + ".png"));
     face = skin.getSubimage(8, 8, 8, 8);
     face = resize(face, 23, 23, true);
   } catch (Exception ex) {
     onlinePlayers.put(name, new ImageIcon());
     playerList.setCellRenderer(new IconListRenderer(onlinePlayers, true));
     getListModel().addElement(name);
     return;
   }
   onlinePlayers.put(name, new ImageIcon(face));
   playerList.setCellRenderer(new IconListRenderer(onlinePlayers, true));
   getListModel().addElement(name);
 }
Esempio n. 24
0
 private void setupUI(int size) {
   setLayout(new BorderLayout());
   model = new BoundedListModel<>(size);
   list = new JList<>(model);
   list.setCellRenderer(new LogItemRenderer());
   scroller = new JScrollPane(list);
   add(scroller);
 }
 protected Component buildMainPanel() {
   JList list = SwingComponentFactory.buildList(this.primaryKeysModel);
   list.setSelectionModel(this.primaryKeysSelectionModel);
   list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
   list.setCellRenderer(this.buildListCellRenderer());
   list.addMouseListener(buildListMouseListener());
   return new JScrollPane(list);
 }
Esempio n. 26
0
  @Override
  protected JComponent createCenterPanel() {
    final JPanel panel = new JPanel(new BorderLayout());
    JTextArea area =
        new JTextArea(
            "The imported language extends other languages.\n"
                + "It might be useful to import all or some of them.");
    area.setEditable(false);
    area.setBackground(this.getContentPane().getBackground());
    area.setBorder(BorderFactory.createEmptyBorder(5, 5, 3, 5));
    panel.add(area, BorderLayout.NORTH);

    JPanel center = new JPanel(new GridBagLayout());
    JTextArea label = new JTextArea("Select additional languages to import:");
    label.setEditable(false);
    label.setBackground(getContentPane().getBackground());
    label.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    center.add(
        label,
        new GridBagConstraints(
            0,
            GridBagConstraints.RELATIVE,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));

    myList = new JBList(myCandidates.toArray());

    myList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    myList.setSelectionInterval(0, myList.getModel().getSize() - 1);
    myList.setCellRenderer(new MyDefaultListCellRenderer());
    myList.setBorder(BorderFactory.createEtchedBorder());
    center.add(
        ScrollPaneFactory.createScrollPane(myList),
        new GridBagConstraints(
            0,
            GridBagConstraints.RELATIVE,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));

    panel.add(center, BorderLayout.CENTER);
    panel.setPreferredSize(new Dimension(400, 250));

    return panel;
  }
Esempio n. 27
0
  public ErrorListDialog(
      Frame frame, String title, String caption, Vector messages, boolean showPluginMgrButton) {
    super(frame, title, true);

    JPanel content = new JPanel(new BorderLayout(12, 12));
    content.setBorder(new EmptyBorder(12, 12, 12, 12));
    setContentPane(content);

    Box iconBox = new Box(BoxLayout.Y_AXIS);
    iconBox.add(new JLabel(UIManager.getIcon("OptionPane.errorIcon")));
    iconBox.add(Box.createGlue());
    content.add(BorderLayout.WEST, iconBox);

    JPanel centerPanel = new JPanel(new BorderLayout());

    JLabel label = new JLabel(caption);
    label.setBorder(new EmptyBorder(0, 0, 6, 0));
    centerPanel.add(BorderLayout.NORTH, label);

    JList errors = new JList(messages);
    errors.setCellRenderer(new ErrorListCellRenderer());
    errors.setVisibleRowCount(Math.min(messages.size(), 4));

    JScrollPane scrollPane =
        new JScrollPane(
            errors, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    Dimension size = scrollPane.getPreferredSize();
    size.width = Math.min(size.width, 400);
    scrollPane.setPreferredSize(size);

    centerPanel.add(BorderLayout.CENTER, scrollPane);

    content.add(BorderLayout.CENTER, centerPanel);

    Box buttons = new Box(BoxLayout.X_AXIS);
    buttons.add(Box.createGlue());

    ok = new JButton(jEdit.getProperty("common.ok"));
    ok.addActionListener(new ActionHandler());

    if (showPluginMgrButton) {
      pluginMgr = new JButton(jEdit.getProperty("error-list.plugin-manager"));
      pluginMgr.addActionListener(new ActionHandler());
      buttons.add(pluginMgr);
      buttons.add(Box.createHorizontalStrut(6));
    }

    buttons.add(ok);

    buttons.add(Box.createGlue());
    content.add(BorderLayout.SOUTH, buttons);

    getRootPane().setDefaultButton(ok);

    pack();
    setLocationRelativeTo(frame);
    show();
  }
  private JPanel createOpenMapPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.setBorder(BorderFactory.createTitledBorder("Open map"));

    List<MapLoader> maps = MapList.getDefaultList().getFreshMaps().getItems();
    Collections.sort(
        maps,
        new Comparator<MapLoader>() {
          @Override
          public int compare(MapLoader mapLoader1, MapLoader mapLoader2) {
            int nameComp = mapLoader1.getMapName().compareTo(mapLoader2.getMapName());
            if (nameComp != 0) {
              return nameComp;
            } else {
              return mapLoader1.toString().compareTo(mapLoader2.toString());
            }
          }
        });

    final JList<MapLoader> mapList = new JList<MapLoader>(maps.toArray(new MapLoader[maps.size()]));
    mapList.setCellRenderer(
        new DefaultListCellRenderer() {
          private static final long serialVersionUID = 648829725137437178L;

          @Override
          public Component getListCellRendererComponent(
              JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            IMapDefinition map = (IMapDefinition) value;
            String longMapId = map.getMapId();
            String shortMapId =
                longMapId == null
                    ? "no map id"
                    : longMapId.substring(0, Math.min(longMapId.length(), 8));
            String displayName =
                map.getMapName()
                    + " \t   ("
                    + shortMapId
                    + ")      created: "
                    + map.getCreationDate();
            return super.getListCellRendererComponent(
                mapList, displayName, index, isSelected, cellHasFocus);
          }
        });
    panel.add(mapList);

    JButton button = new JButton("Open");
    button.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            loadMap(mapList.getSelectedValue());
          }
        });
    panel.add(button, BorderLayout.SOUTH);

    return panel;
  }
Esempio n. 29
0
 public Logger() {
   if (backGC == null) {
     backGC = new ArrayList<Color>();
   }
   if (foreGC == null) {
     foreGC = new ArrayList<Color>();
   }
   logText.setCellRenderer(render);
 }
Esempio n. 30
0
 public TestListPanel() {
   try {
     jbInit();
   } catch (Exception ex) {
     ex.printStackTrace();
   }
   list.setCellRenderer(new TestListCellRenderer());
   registerListSelectionListener();
 }