use of de.alpharogroup.bundle.app.table.model.StringBundleNamesTableModel in project bundle-app-ui by astrapi69.
the class OverviewOfAllResourceBundlesPanel method onInitializeComponents.
@Override
protected void onInitializeComponents() {
super.onInitializeComponents();
lblHeaderOverview = new javax.swing.JLabel();
lblBundleName = new javax.swing.JLabel();
srcBundles = new javax.swing.JScrollPane();
btnCreateBundle = new javax.swing.JButton();
btnCreateBundle.addActionListener(e -> onCreateBundle(e));
btnToDashboard = new javax.swing.JButton();
btnToDashboard.setText("Return to Dashboard");
btnToDashboard.addActionListener(ReturnToDashboardAction.of());
tableModel = new StringBundleNamesTableModel();
tableModel.addList(getTableModelList());
tblBundles = new GenericJXTable<>(tableModel);
final TableColumn valueColumn = tblBundles.getColumn("Action");
valueColumn.setCellRenderer(new TableCellButtonRenderer(null, null) {
private static final long serialVersionUID = 1L;
@Override
public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) {
if (isSelected) {
setForeground(newSelectionForeground(table));
setBackground(newSelectionBackround(table));
} else {
setForeground(newForeground(table));
setBackground(newBackround(table));
}
final String text = "Choose";
setText(text);
return this;
}
});
valueColumn.setCellEditor(new TableCellButtonEditor(new JCheckBox()) {
private static final long serialVersionUID = 1L;
@Override
public Object getCellEditorValue() {
final BundleNames selectedBundleName = (BundleNames) this.getValue();
final Model<ApplicationDashboardBean> baModel = MainFrame.getInstance().getSelectedBundleApplicationPropertyModel();
MainFrame.getInstance().getModelObject().getSelectedBundleApplication().setSelectedBundleName(selectedBundleName);
final OverviewResourceBundleAddEntryPanel component = new OverviewResourceBundleAddEntryPanel(baModel);
MainFrame.getInstance().replaceInternalFrame("Values of resource bundle " + selectedBundleName.getBaseName().getName() + " with locale " + selectedBundleName.getLocale().getLocale() + "", component);
final String text = "Choose";
return text;
}
@Override
public Component getTableCellEditorComponent(final JTable table, final Object value, final boolean isSelected, final int row, final int column) {
setRow(row);
setColumn(column);
setValue(value);
if (isSelected) {
getButton().setForeground(table.getSelectionForeground());
getButton().setBackground(table.getSelectionBackground());
} else {
getButton().setForeground(table.getForeground());
getButton().setBackground(table.getBackground());
}
final String text = "Choose";
getButton().setText(text);
setClicked(true);
return getButton();
}
});
lblHeaderOverview.setText("Overview of all resource bundles");
lblBundleName.setText("Bundle count");
srcBundles.setViewportView(tblBundles);
btnCreateBundle.setText("Create new resource bundle");
}
Aggregations