Added popup menu and fixed NPE
This commit is contained in:
parent
90617b8120
commit
faa9cf856d
2 changed files with 13 additions and 1 deletions
source/pro/litvinovg/libreoffice/metadata/views
|
@ -245,6 +245,17 @@ public class EditorGUI extends JFrame {
|
|||
.addComponent(btnOutlineSave)
|
||||
.addGap(43))
|
||||
);
|
||||
|
||||
JPopupMenu popupMenu = new JPopupMenu();
|
||||
addPopup(tableOutline, popupMenu);
|
||||
|
||||
JMenuItem menuItem = new JMenuItem("Добавить строку");
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
outlineTableModel.addRow(new Object[] {null, null});
|
||||
}
|
||||
});
|
||||
popupMenu.add(menuItem);
|
||||
panelOutline.setLayout(groupLayoutOutlineMetadata);
|
||||
tabbedPane.addTab(element.getName(), null, panelOutline, null);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,8 @@ public class MetadataTableModel extends DefaultTableModel {
|
|||
Vector row = (Vector) elements.nextElement();
|
||||
String name = (String) row.get(0);
|
||||
String value = (String) row.get(1);
|
||||
if (!name.isEmpty() && !value.isEmpty()) {
|
||||
|
||||
if (name != null && !name.isEmpty() && value != null && !value.isEmpty()) {
|
||||
metadata.add(new MetadataElement(name, value));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue