Merge pull request #1546 from SiboVG/issue-1516
[#1516] Keep preset highlight after favorites checkbox action
This commit is contained in:
commit
f784e00ecb
@ -2099,7 +2099,7 @@ ComponentPresetChooserDialog.menu.sortDesc = Sort Descending
|
||||
ComponentPresetChooserDialog.menu.units = Units
|
||||
ComponentPresetChooserDialog.checkbox.showAllCompatible = Show all compatible
|
||||
ComponentPresetChooserDialog.checkbox.showLegacyCheckBox = Show Legacy Database
|
||||
ComponentPresetChooserDialog.lbl.favorites = Check to add preset to the preset drop-down menu in the component edit dialog
|
||||
ComponentPresetChooserDialog.lbl.favorites = Check to add preset to the preset drop-down menu in the component edit dialog<br>Directly apply a preset by double-clicking it or by selecting it and closing this window.
|
||||
table.column.Favorite = Favorite
|
||||
table.column.Legacy = Legacy
|
||||
table.column.Manufacturer = Manufacturer
|
||||
|
@ -25,6 +25,7 @@ import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableModel;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import net.sf.openrocket.gui.components.StyledLabel;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
@ -152,7 +153,7 @@ public class ComponentPresetChooserDialog extends JDialog {
|
||||
scrollpane.setViewportView(componentSelectionTable);
|
||||
panel.add(scrollpane, "grow, width 700lp, height 300lp, pushy, spanx, wrap rel");
|
||||
|
||||
panel.add(new JLabel(Chars.UP_ARROW + " " + trans.get("lbl.favorites")), "spanx, gapleft 5px, wrap para");
|
||||
panel.add(new StyledLabel(String.format("<html>%s %s</html>", Chars.UP_ARROW, trans.get("lbl.favorites")), -1), "spanx, gapleft 5px, wrap para");
|
||||
|
||||
|
||||
// Close buttons
|
||||
|
@ -77,9 +77,11 @@ public class ComponentPresetTable extends JTable {
|
||||
if ( columnIndex != 0 ) {
|
||||
return;
|
||||
}
|
||||
int selectedRow = ComponentPresetTable.this.getSelectedRow();
|
||||
ComponentPreset preset = ComponentPresetTable.this.presets.get(rowIndex);
|
||||
Application.getComponentPresetDao().setFavorite(preset, presetType, (Boolean) aValue);
|
||||
ComponentPresetTable.this.updateFavorites();
|
||||
ComponentPresetTable.this.setRowSelectionInterval(selectedRow, selectedRow);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,7 +33,7 @@ public abstract class ComponentPresetTableColumn extends TableColumn {
|
||||
|
||||
@Override
|
||||
public Object getValueFromPreset( Set<String> favorites, ComponentPreset preset ) {
|
||||
return Boolean.valueOf(favorites.contains(preset.preferenceKey()));
|
||||
return favorites.contains(preset.preferenceKey());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user