src/net/java/sip/communicator/impl/neomedia/MediaConfigurationImpl.java
/**
     * Creates Component for the encodings of type(AUDIO or VIDEO).
     *
     * @param type the type, either DeviceConfigurationComboBoxModel.AUDIO or
     * DeviceConfigurationComboBoxModel.AUDIO
     * @param encodingConfiguration The <tt>EncodingConfiguration</tt> instance
     * to use. If null, it will use the current encoding configuration from
     * the media service.
     * @return the component.
     */
Creates Component for the encodings of type(AUDIO or VIDEO).
@param type the type, either DeviceConfigurationComboBoxModel.AUDIO or
DeviceConfigurationComboBoxModel.AUDIO
@param encodingConfiguration The EncodingConfiguration instance
to use. If null, it will use the current encoding configuration from
the media service.
@return the component.
Creates Component for the encodings of type ( AUDIO or VIDEO ) . @param type the type either DeviceConfigurationComboBoxModel . AUDIO or DeviceConfigurationComboBoxModel . AUDIO @param encodingConfiguration The EncodingConfiguration instance to use . If null it will use the current encoding configuration from the media service . @return the component .
private Component createEncodingControls(int type,
            EncodingConfiguration encodingConfiguration)
    {
        boolean isEncodingConfigurationNull = false;
        if(encodingConfiguration == null)
        {
            isEncodingConfigurationNull = true;
            encodingConfiguration
                    = mediaService.getCurrentEncodingConfiguration();
        }
        ResourceManagementService resources = NeomediaActivator.getResources();
        String key;
        final JTable table = new JTable();
        table.setShowGrid(false);
        table.setTableHeader(null);
        table.setDefaultRenderer(Object.class, new DefaultTableCellRenderer()
        {
            @Override
            public Component getTableCellRendererComponent(JTable rtable,
                Object value, boolean isSelected, boolean hasFocus, int row,
                int column)
            {
                Component component = super.getTableCellRendererComponent(
                    rtable, value, isSelected, hasFocus, row, column);
                component.setEnabled(rtable != null && rtable.isEnabled());
                return component;
            }
        });
        key = "impl.media.configform.UP";
        final JButton upButton = new JButton(resources.getI18NString(key));
        upButton.setMnemonic(resources.getI18nMnemonic(key));
        upButton.setOpaque(false);
        key = "impl.media.configform.DOWN";
        final JButton downButton = new JButton(resources.getI18NString(key));
        downButton.setMnemonic(resources.getI18nMnemonic(key));
        downButton.setOpaque(false);
        Container buttonBar = new TransparentPanel(new GridLayout(0, 1));
        buttonBar.add(upButton);
        buttonBar.add(downButton);
        Container parentButtonBar = new TransparentPanel(new BorderLayout());
        parentButtonBar.add(buttonBar, BorderLayout.NORTH);
        table.setModel(new EncodingConfigurationTableModel(type,
                encodingConfiguration));
        /*
         * The first column contains the check boxes which enable/disable their
         * associated encodings and it doesn't make sense to make it wider than
         * the check boxes.
         */
        TableColumnModel tableColumnModel = table.getColumnModel();
        TableColumn tableColumn = tableColumnModel.getColumn(0);
        tableColumn.setMaxWidth(tableColumn.getMinWidth());
        final ListSelectionListener tableSelectionListener =
            new ListSelectionListener()
            {
                public void valueChanged(ListSelectionEvent event)
                {
                    if (table.getSelectedRowCount() == 1)
                    {
                        int selectedRow = table.getSelectedRow();
                        if (selectedRow > -1)
                        {
                            upButton.setEnabled(selectedRow > 0);
                            downButton.setEnabled(selectedRow < (table
                                .getRowCount() - 1));
                            return;
                        }
                    }
                    upButton.setEnabled(false);
                    downButton.setEnabled(false);
                }
            };
        table.getSelectionModel().addListSelectionListener(
            tableSelectionListener);
        tableSelectionListener.valueChanged(null);
        ActionListener buttonListener = new ActionListener()
        {
            public void actionPerformed(ActionEvent event)
            {
                Object source = event.getSource();
                boolean up;
                if (source == upButton)
                    up = true;
                else if (source == downButton)
                    up = false;
                else
                    return;
                move(table, up);
            }
        };
        upButton.addActionListener(buttonListener);
        downButton.addActionListener(buttonListener);
        Container container = new TransparentPanel(new BorderLayout())
        {
            @Override
            public void setEnabled(boolean enabled)
            {
                super.setEnabled(enabled);
                table.setEnabled(enabled);
                if (enabled)
                {
                    tableSelectionListener.valueChanged(null);
                }
                else
                {
                    upButton.setEnabled(false);
                    downButton.setEnabled(false);
                }
            }
        };
        container.setPreferredSize(new Dimension(WIDTH, 100));
        container.setMaximumSize(new Dimension(WIDTH, 100));
        container.add(new JScrollPane(table), BorderLayout.CENTER);
        container.add(parentButtonBar, BorderLayout.EAST);
        if (type == DeviceConfigurationComboBoxModel.VIDEO
            && isEncodingConfigurationNull
            && (OSUtils.IS_MAC || OSUtils.IS_WINDOWS))
        {
            container.add(
                OpenH264Retriever.getConfigPanel(), BorderLayout.SOUTH);
        }
        return container;
    }
private Component createEncodingControls ( int type , EncodingConfiguration encodingConfiguration ) { boolean isEncodingConfigurationNull = false ; if ( encodingConfiguration == null ) { isEncodingConfigurationNull = true ; encodingConfiguration = mediaService . getCurrentEncodingConfiguration ( ) ; } ResourceManagementService resources = NeomediaActivator . getResources ( ) ; String key ; final JTable table = new JTable ( ) ; table . setShowGrid ( false ) ; table . setTableHeader ( null ) ; table . setDefaultRenderer ( Object . class , new DefaultTableCellRenderer ( ) { @ Override public Component getTableCellRendererComponent ( JTable rtable , Object value , boolean isSelected , boolean hasFocus , int row , int column ) { Component component = super . getTableCellRendererComponent ( rtable , value , isSelected , hasFocus , row , column ) ; component . setEnabled ( rtable != null && rtable . isEnabled ( ) ) ; return component ; } } ) ; key = "impl.media.configform.UP" ; final JButton upButton = new JButton ( resources . getI18NString ( key ) ) ; upButton . setMnemonic ( resources . getI18nMnemonic ( key ) ) ; upButton . setOpaque ( false ) ; key = "impl.media.configform.DOWN" ; final JButton downButton = new JButton ( resources . getI18NString ( key ) ) ; downButton . setMnemonic ( resources . getI18nMnemonic ( key ) ) ; downButton . setOpaque ( false ) ; Container buttonBar = new TransparentPanel ( new GridLayout ( 0 , 1 ) ) ; buttonBar . add ( upButton ) ; buttonBar . add ( downButton ) ; Container parentButtonBar = new TransparentPanel ( new BorderLayout ( ) ) ; parentButtonBar . add ( buttonBar , BorderLayout . NORTH ) ; table . setModel ( new EncodingConfigurationTableModel ( type , encodingConfiguration ) ) ; /*
         * The first column contains the check boxes which enable/disable their
         * associated encodings and it doesn't make sense to make it wider than
         * the check boxes.
         */ TableColumnModel tableColumnModel = table . getColumnModel ( ) ; TableColumn tableColumn = tableColumnModel . getColumn ( 0 ) ; tableColumn . setMaxWidth ( tableColumn . getMinWidth ( ) ) ; final ListSelectionListener tableSelectionListener = new ListSelectionListener ( ) { public void valueChanged ( ListSelectionEvent event ) { if ( table . getSelectedRowCount ( ) == 1 ) { int selectedRow = table . getSelectedRow ( ) ; if ( selectedRow > - 1 ) { upButton . setEnabled ( selectedRow > 0 ) ; downButton . setEnabled ( selectedRow < ( table . getRowCount ( ) - 1 ) ) ; return ; } } upButton . setEnabled ( false ) ; downButton . setEnabled ( false ) ; } } ; table . getSelectionModel ( ) . addListSelectionListener ( tableSelectionListener ) ; tableSelectionListener . valueChanged ( null ) ; ActionListener buttonListener = new ActionListener ( ) { public void actionPerformed ( ActionEvent event ) { Object source = event . getSource ( ) ; boolean up ; if ( source == upButton ) up = true ; else if ( source == downButton ) up = false ; else return ; move ( table , up ) ; } } ; upButton . addActionListener ( buttonListener ) ; downButton . addActionListener ( buttonListener ) ; Container container = new TransparentPanel ( new BorderLayout ( ) ) { @ Override public void setEnabled ( boolean enabled ) { super . setEnabled ( enabled ) ; table . setEnabled ( enabled ) ; if ( enabled ) { tableSelectionListener . valueChanged ( null ) ; } else { upButton . setEnabled ( false ) ; downButton . setEnabled ( false ) ; } } } ; container . setPreferredSize ( new Dimension ( WIDTH , 100 ) ) ; container . setMaximumSize ( new Dimension ( WIDTH , 100 ) ) ; container . add ( new JScrollPane ( table ) , BorderLayout . CENTER ) ; container . add ( parentButtonBar , BorderLayout . EAST ) ; if ( type == DeviceConfigurationComboBoxModel . VIDEO && isEncodingConfigurationNull && ( OSUtils . IS_MAC || OSUtils . IS_WINDOWS ) ) { container . add ( OpenH264Retriever . getConfigPanel ( ) , BorderLayout . SOUTH ) ; } return container ; }
Creates Component for the encodings of type(AUDIO or VIDEO).
Creates Component for the encodings of type ( AUDIO or VIDEO ) .
// encodingConfiguration is null when it is loaded // from the general config // show openh264 panel on mac & windows, only for video and only in // general video encodings