| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package jalview.gui; |
| 22 |
|
|
| 23 |
|
import java.awt.BorderLayout; |
| 24 |
|
import java.awt.FlowLayout; |
| 25 |
|
import java.awt.event.ActionEvent; |
| 26 |
|
import java.awt.event.ActionListener; |
| 27 |
|
import java.awt.event.ItemEvent; |
| 28 |
|
import java.awt.event.ItemListener; |
| 29 |
|
|
| 30 |
|
import javax.swing.JCheckBox; |
| 31 |
|
import javax.swing.JPanel; |
| 32 |
|
|
| 33 |
|
import jalview.api.AlignExportSettingsI; |
| 34 |
|
import jalview.api.AlignViewportI; |
| 35 |
|
import jalview.bin.Jalview; |
| 36 |
|
import jalview.io.FileFormatI; |
| 37 |
|
import jalview.util.MessageManager; |
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
@SuppressWarnings("serial") |
| |
|
| 2.6% |
Uncovered Elements: 74 (76) |
Complexity: 15 |
Complexity Density: 0.25 |
|
| 45 |
|
public class AlignExportOptions extends JPanel |
| 46 |
|
{ |
| 47 |
|
protected JCheckBox chkHiddenSeqs = new JCheckBox(); |
| 48 |
|
|
| 49 |
|
protected JCheckBox chkHiddenCols = new JCheckBox(); |
| 50 |
|
|
| 51 |
|
protected JCheckBox chkExportAnnots = new JCheckBox(); |
| 52 |
|
|
| 53 |
|
protected JCheckBox chkExportFeats = new JCheckBox(); |
| 54 |
|
|
| 55 |
|
protected JCheckBox chkExportGrps = new JCheckBox(); |
| 56 |
|
|
| 57 |
|
protected AlignExportSettingsI settings; |
| 58 |
|
|
| 59 |
|
private boolean isComplexAlignFile; |
| 60 |
|
|
| 61 |
|
JvOptionPane dialog; |
| 62 |
|
|
| 63 |
|
|
| 64 |
|
|
| 65 |
|
|
| 66 |
|
|
| 67 |
|
|
| 68 |
|
|
| 69 |
|
@param |
| 70 |
|
@param |
| 71 |
|
@return |
| 72 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 73 |
120 |
public static boolean isNeeded(AlignViewportI viewport,... |
| 74 |
|
FileFormatI format) |
| 75 |
|
{ |
| 76 |
120 |
return !Jalview.getInstance().isHeadlessMode() |
| 77 |
|
&& (viewport.hasHiddenColumns() || viewport.hasHiddenRows() |
| 78 |
|
|| format.isComplexAlignFile()); |
| 79 |
|
} |
| 80 |
|
|
| 81 |
|
|
| 82 |
|
|
| 83 |
|
|
| 84 |
|
|
| 85 |
|
|
| 86 |
|
|
| 87 |
|
@param |
| 88 |
|
@param |
| 89 |
|
@param |
| 90 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 91 |
0 |
public AlignExportOptions(AlignViewportI viewport, FileFormatI format,... |
| 92 |
|
AlignExportSettingsI defaults) |
| 93 |
|
{ |
| 94 |
0 |
this.settings = defaults; |
| 95 |
0 |
this.isComplexAlignFile = format.isComplexAlignFile(); |
| 96 |
0 |
init(viewport.hasHiddenRows(), viewport.hasHiddenColumns()); |
| 97 |
0 |
dialog = JvOptionPane.newOptionDialog(Desktop.desktop); |
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| 103 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 104 |
0 |
public void showDialog()... |
| 105 |
|
{ |
| 106 |
0 |
Object[] options = new Object[] { MessageManager.getString("action.ok"), |
| 107 |
|
MessageManager.getString("action.cancel") }; |
| 108 |
0 |
dialog.showInternalDialog(this, |
| 109 |
|
MessageManager.getString("label.export_settings"), |
| 110 |
|
JvOptionPane.OK_CANCEL_OPTION, JvOptionPane.PLAIN_MESSAGE, null, |
| 111 |
|
options, MessageManager.getString("action.ok")); |
| 112 |
|
} |
| 113 |
|
|
| 114 |
|
|
| 115 |
|
|
| 116 |
|
|
| 117 |
|
|
| 118 |
|
@param |
| 119 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 120 |
0 |
public void setResponseAction(Object response, Runnable action)... |
| 121 |
|
{ |
| 122 |
0 |
dialog.setResponseHandler(response, action); |
| 123 |
|
} |
| 124 |
|
|
| 125 |
|
|
| 126 |
|
|
| 127 |
|
|
| 128 |
|
|
| 129 |
|
@param |
| 130 |
|
|
| |
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
|
| 131 |
0 |
void checkAllAction(boolean isSelected)... |
| 132 |
|
{ |
| 133 |
0 |
boolean set = chkHiddenSeqs.isEnabled() && isSelected; |
| 134 |
0 |
chkHiddenSeqs.setSelected(set); |
| 135 |
0 |
settings.setExportHiddenSequences(set); |
| 136 |
|
|
| 137 |
0 |
set = chkHiddenCols.isEnabled() && isSelected; |
| 138 |
0 |
chkHiddenCols.setSelected(set); |
| 139 |
0 |
settings.setExportHiddenColumns(set); |
| 140 |
|
|
| 141 |
0 |
set = isComplexAlignFile && chkExportAnnots.isEnabled() && isSelected; |
| 142 |
0 |
chkExportAnnots.setSelected(set); |
| 143 |
0 |
settings.setExportAnnotations(set); |
| 144 |
|
|
| 145 |
0 |
set = isComplexAlignFile && chkExportFeats.isEnabled() && isSelected; |
| 146 |
0 |
chkExportFeats.setSelected(set); |
| 147 |
0 |
settings.setExportFeatures(set); |
| 148 |
|
|
| 149 |
0 |
set = isComplexAlignFile && chkExportGrps.isEnabled() && isSelected; |
| 150 |
0 |
chkExportGrps.setSelected(set); |
| 151 |
0 |
settings.setExportGroups(set); |
| 152 |
|
} |
| 153 |
|
|
| 154 |
|
|
| 155 |
|
|
| 156 |
|
|
| 157 |
|
@param |
| 158 |
|
@param |
| 159 |
|
|
| |
|
| 0% |
Uncovered Elements: 35 (35) |
Complexity: 4 |
Complexity Density: 0.13 |
|
| 160 |
0 |
private void init(boolean hasHiddenSeq, boolean hasHiddenCols)... |
| 161 |
|
{ |
| 162 |
0 |
chkHiddenSeqs.setText( |
| 163 |
|
MessageManager.getString("action.export_hidden_sequences")); |
| 164 |
0 |
chkHiddenSeqs.addActionListener(new ActionListener() |
| 165 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 166 |
0 |
@Override... |
| 167 |
|
public void actionPerformed(ActionEvent e) |
| 168 |
|
{ |
| 169 |
0 |
settings.setExportHiddenSequences(chkHiddenSeqs.isSelected()); |
| 170 |
|
} |
| 171 |
|
}); |
| 172 |
|
|
| 173 |
0 |
chkHiddenCols.setText( |
| 174 |
|
MessageManager.getString("action.export_hidden_columns")); |
| 175 |
0 |
chkHiddenCols.addActionListener(new ActionListener() |
| 176 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 177 |
0 |
@Override... |
| 178 |
|
public void actionPerformed(ActionEvent e) |
| 179 |
|
{ |
| 180 |
0 |
settings.setExportHiddenColumns(chkHiddenCols.isSelected()); |
| 181 |
|
} |
| 182 |
|
}); |
| 183 |
|
|
| 184 |
0 |
chkExportAnnots |
| 185 |
|
.setText(MessageManager.getString("action.export_annotations")); |
| 186 |
0 |
chkExportAnnots.addActionListener(new ActionListener() |
| 187 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 188 |
0 |
@Override... |
| 189 |
|
public void actionPerformed(ActionEvent e) |
| 190 |
|
{ |
| 191 |
0 |
settings.setExportAnnotations(chkExportAnnots.isSelected()); |
| 192 |
|
} |
| 193 |
|
}); |
| 194 |
|
|
| 195 |
0 |
chkExportFeats |
| 196 |
|
.setText(MessageManager.getString("action.export_features")); |
| 197 |
0 |
chkExportFeats.addActionListener(new ActionListener() |
| 198 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 199 |
0 |
@Override... |
| 200 |
|
public void actionPerformed(ActionEvent e) |
| 201 |
|
{ |
| 202 |
0 |
settings.setExportFeatures(chkExportFeats.isSelected()); |
| 203 |
|
} |
| 204 |
|
}); |
| 205 |
|
|
| 206 |
0 |
chkExportGrps.setText(MessageManager.getString("action.export_groups")); |
| 207 |
0 |
chkExportGrps.addActionListener(new ActionListener() |
| 208 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 209 |
0 |
@Override... |
| 210 |
|
public void actionPerformed(ActionEvent e) |
| 211 |
|
{ |
| 212 |
0 |
settings.setExportGroups(chkExportGrps.isSelected()); |
| 213 |
|
} |
| 214 |
|
}); |
| 215 |
|
|
| 216 |
0 |
JCheckBox chkAll = new JCheckBox( |
| 217 |
|
MessageManager.getString("action.select_all")); |
| 218 |
|
|
| 219 |
0 |
JPanel hiddenRegionConfPanel = new JPanel(new BorderLayout()); |
| 220 |
0 |
JPanel complexExportPanel = new JPanel(new BorderLayout()); |
| 221 |
0 |
this.setLayout(new BorderLayout()); |
| 222 |
|
|
| 223 |
0 |
chkAll.addItemListener(new ItemListener() |
| 224 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 225 |
0 |
@Override... |
| 226 |
|
public void itemStateChanged(ItemEvent e) |
| 227 |
|
{ |
| 228 |
0 |
checkAllAction(chkAll.isSelected()); |
| 229 |
|
} |
| 230 |
|
}); |
| 231 |
|
|
| 232 |
0 |
hiddenRegionConfPanel.add(chkHiddenSeqs, BorderLayout.CENTER); |
| 233 |
0 |
hiddenRegionConfPanel.add(chkHiddenCols, BorderLayout.SOUTH); |
| 234 |
0 |
chkHiddenSeqs.setEnabled(hasHiddenSeq); |
| 235 |
0 |
chkHiddenCols.setEnabled(hasHiddenCols); |
| 236 |
|
|
| 237 |
0 |
complexExportPanel.add(chkExportAnnots, BorderLayout.NORTH); |
| 238 |
0 |
complexExportPanel.add(chkExportFeats, BorderLayout.CENTER); |
| 239 |
0 |
complexExportPanel.add(chkExportGrps, BorderLayout.SOUTH); |
| 240 |
|
|
| 241 |
0 |
JPanel actionPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); |
| 242 |
0 |
actionPanel.add(chkAll); |
| 243 |
|
|
| 244 |
0 |
JPanel optionsPanel = new JPanel(); |
| 245 |
0 |
if (this.isComplexAlignFile) |
| 246 |
|
{ |
| 247 |
0 |
optionsPanel.add(complexExportPanel); |
| 248 |
|
} |
| 249 |
|
|
| 250 |
0 |
if (hasHiddenSeq || hasHiddenCols) |
| 251 |
|
{ |
| 252 |
0 |
optionsPanel.add(hiddenRegionConfPanel); |
| 253 |
|
} |
| 254 |
|
|
| 255 |
0 |
add(optionsPanel, BorderLayout.NORTH); |
| 256 |
0 |
add(actionPanel, BorderLayout.SOUTH); |
| 257 |
|
} |
| 258 |
|
} |