All files / webview-app/src/lib swingTypeLabels.ts

100% Statements 4/4
75% Branches 3/4
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 311x                                               17x 3x     14x    
export const SWING_TYPE_LABELS: Readonly<Record<string, string>> = {
  Panel: "JPanel",
  Button: "JButton",
  Label: "JLabel",
  TextField: "JTextField",
  PasswordField: "JPasswordField",
  TextArea: "JTextArea",
  CheckBox: "JCheckBox",
  RadioButton: "JRadioButton",
  ComboBox: "JComboBox",
  List: "JList",
  ProgressBar: "JProgressBar",
  Slider: "JSlider",
  Spinner: "JSpinner",
  Separator: "JSeparator",
  MenuBar: "JMenuBar",
  JMenuBar: "JMenuBar",
  Menu: "JMenu",
  JMenu: "JMenu",
  MenuItem: "JMenuItem",
  JMenuItem: "JMenuItem",
};
 
export function toSwingTypeLabel(type: string): string {
  if (type in SWING_TYPE_LABELS) {
    return SWING_TYPE_LABELS[type];
  }
 
  return type.startsWith("J") ? type : `J${type}`;
}