diff options
author | Ingo Bauersachs <ingo@jitsi.org> | 2013-01-23 15:56:46 +0000 |
---|---|---|
committer | Ingo Bauersachs <ingo@jitsi.org> | 2013-01-23 15:56:46 +0000 |
commit | 8672123c4f526e239dd3c38b395922155515d934 (patch) | |
tree | 22059e7d3e660fd8080257e2fd56dffd64a437c9 /src | |
parent | 7f0815b7590915a4ac31c2858e585f5e1ca9ff8a (diff) | |
download | jitsi-8672123c4f526e239dd3c38b395922155515d934.zip jitsi-8672123c4f526e239dd3c38b395922155515d934.tar.gz jitsi-8672123c4f526e239dd3c38b395922155515d934.tar.bz2 |
Disable encodings table in account settings when override is not checked
Diffstat (limited to 'src')
-rw-r--r-- | src/net/java/sip/communicator/impl/neomedia/MediaConfigurationImpl.java | 45 | ||||
-rw-r--r-- | src/net/java/sip/communicator/util/plugin/wizard/EncodingsPanel.java | 21 |
2 files changed, 57 insertions, 9 deletions
diff --git a/src/net/java/sip/communicator/impl/neomedia/MediaConfigurationImpl.java b/src/net/java/sip/communicator/impl/neomedia/MediaConfigurationImpl.java index 3ac2e10..01e6508 100644 --- a/src/net/java/sip/communicator/impl/neomedia/MediaConfigurationImpl.java +++ b/src/net/java/sip/communicator/impl/neomedia/MediaConfigurationImpl.java @@ -688,6 +688,19 @@ public class MediaConfigurationImpl 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)); @@ -706,13 +719,6 @@ public class MediaConfigurationImpl Container parentButtonBar = new TransparentPanel(new BorderLayout()); parentButtonBar.add(buttonBar, BorderLayout.NORTH); - Container container = new TransparentPanel(new BorderLayout()); - container.setPreferredSize(new Dimension(WIDTH, 100)); - container.setMaximumSize(new Dimension(WIDTH, 100)); - - container.add(new JScrollPane(table), BorderLayout.CENTER); - container.add(parentButtonBar, BorderLayout.EAST); - table.setModel(new EncodingConfigurationTableModel(type, encodingConfiguration)); /* @@ -724,7 +730,7 @@ public class MediaConfigurationImpl TableColumn tableColumn = tableColumnModel.getColumn(0); tableColumn.setMaxWidth(tableColumn.getMinWidth()); - ListSelectionListener tableSelectionListener = + final ListSelectionListener tableSelectionListener = new ListSelectionListener() { public void valueChanged(ListSelectionEvent event) @@ -767,6 +773,29 @@ public class MediaConfigurationImpl 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); return container; } diff --git a/src/net/java/sip/communicator/util/plugin/wizard/EncodingsPanel.java b/src/net/java/sip/communicator/util/plugin/wizard/EncodingsPanel.java index 52e0117..b11831a 100644 --- a/src/net/java/sip/communicator/util/plugin/wizard/EncodingsPanel.java +++ b/src/net/java/sip/communicator/util/plugin/wizard/EncodingsPanel.java @@ -10,6 +10,8 @@ import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; +import javax.swing.event.*; + import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.swing.*; @@ -96,7 +98,14 @@ public class EncodingsPanel extends TransparentPanel overrideCheckBox = new SIPCommCheckBox(resourceService. getI18NString("plugin.jabberaccregwizz.OVERRIDE_ENCODINGS"), false); - + overrideCheckBox.addChangeListener(new ChangeListener() + { + public void stateChanged(ChangeEvent e) + { + updateTableState(); + } + }); + mediaConfiguration = UtilActivator.getMediaConfiguration(); @@ -204,5 +213,15 @@ public class EncodingsPanel extends TransparentPanel audioPanel.add(audioControls); videoPanel.add(videoControls); + updateTableState(); + } + + /** + * Enables or disables the encodings tables based on the override checkbox. + */ + private void updateTableState() + { + audioControls.setEnabled(overrideCheckBox.isSelected()); + videoControls.setEnabled(overrideCheckBox.isSelected()); } } |