/** Creates an instance <tt>PropertiesEditorPanel</tt>. */ public PropertiesEditorPanel() { super(new BorderLayout()); /** * Instantiates the properties table and adds selection model and listener and adds a row sorter * to the table model */ ResourceManagementService r = PropertiesEditorActivator.getResourceManagementService(); String[] columnNames = new String[] {r.getI18NString("service.gui.NAME"), r.getI18NString("service.gui.VALUE")}; propsTable = new JTable(new PropsTableModel(initTableModel(), columnNames)); propsTable.setRowSorter(new TableRowSorter<TableModel>(propsTable.getModel())); propsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); PropsListSelectionListener selectionListener = new PropsListSelectionListener(); propsTable.getSelectionModel().addListSelectionListener(selectionListener); propsTable.getColumnModel().getSelectionModel().addListSelectionListener(selectionListener); JScrollPane scrollPane = new JScrollPane(propsTable); SearchField searchField = new SearchField("", propsTable); buttonsPanel = new ButtonsPanel(propsTable, searchField); centerPanel = new TransparentPanel(new BorderLayout()); centerPanel.add(scrollPane, BorderLayout.CENTER); centerPanel.add(buttonsPanel, BorderLayout.EAST); JLabel needRestart = new JLabel(r.getI18NString("plugin.propertieseditor.NEED_RESTART")); needRestart.setForeground(Color.RED); TransparentPanel searchPanel = new TransparentPanel(new BorderLayout(5, 0)); searchPanel.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5)); searchPanel.add(searchField, BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8)); add(searchPanel, BorderLayout.NORTH); add(centerPanel, BorderLayout.CENTER); add(needRestart, BorderLayout.SOUTH); }
/** * Initializes the contact list. * * @param contactListService The MetaContactListService which will be used for a contact list data * model. */ public void initList(MetaContactListService contactListService) { this.contactList = new TreeContactList(mainFrame); // We should first set the contact list to the GuiActivator, so that // anybody could get it from there. GuiActivator.setContactList(contactList); // By default we set the current filter to be the presence filter. contactList.applyFilter(TreeContactList.presenceFilter); TransparentPanel transparentPanel = new TransparentPanel(new BorderLayout()); transparentPanel.add(contactList, BorderLayout.NORTH); this.setViewportView(transparentPanel); transparentPanel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); this.contactList.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.contactList.addContactListListener(this); this.addMouseListener( new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0) { commonRightButtonMenu = new CommonRightButtonMenu(mainFrame); commonRightButtonMenu.setInvoker(ContactListPane.this); commonRightButtonMenu.setLocation( e.getX() + mainFrame.getX() + 5, e.getY() + mainFrame.getY() + 105); commonRightButtonMenu.setVisible(true); } } }); }