-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GUI tweaks in the equipment search tab, naval gauss flag fix
- Loading branch information
Showing
10 changed files
with
251 additions
and
120 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
megamek/src/megamek/client/ui/advancedsearch/EquipmentCostRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. | ||
* | ||
* This file is part of MegaMek. | ||
* | ||
* MegaMek is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* MegaMek is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with MegaMek. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package megamek.client.ui.advancedsearch; | ||
|
||
import javax.swing.*; | ||
import javax.swing.table.DefaultTableCellRenderer; | ||
import java.awt.*; | ||
|
||
public class EquipmentCostRenderer extends DefaultTableCellRenderer { | ||
|
||
public EquipmentCostRenderer() { | ||
super(); | ||
setHorizontalAlignment(SwingConstants.RIGHT); | ||
} | ||
|
||
@Override | ||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { | ||
if (value instanceof Double number) { | ||
if (number < 0) { | ||
value = "variable"; | ||
} else { | ||
value = "%,d".formatted(Math.round(number)); | ||
} | ||
} | ||
return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
megamek/src/megamek/client/ui/advancedsearch/EquipmentDataRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. | ||
* | ||
* This file is part of MegaMek. | ||
* | ||
* MegaMek is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* MegaMek is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with MegaMek. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package megamek.client.ui.advancedsearch; | ||
|
||
import javax.swing.*; | ||
import javax.swing.table.DefaultTableCellRenderer; | ||
import java.awt.*; | ||
|
||
public class EquipmentDataRenderer extends DefaultTableCellRenderer { | ||
|
||
public EquipmentDataRenderer() { | ||
super(); | ||
setHorizontalAlignment(SwingConstants.CENTER); | ||
} | ||
|
||
@Override | ||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { | ||
|
||
if (value instanceof Integer number && number < 0) { | ||
value = "var."; | ||
} | ||
if (value instanceof Double number && number < 0) { | ||
value = "var."; | ||
} | ||
return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
megamek/src/megamek/client/ui/advancedsearch/NoSelectionModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
megamek/src/megamek/client/ui/advancedsearch/TechBaseRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. | ||
* | ||
* This file is part of MegaMek. | ||
* | ||
* MegaMek is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* MegaMek is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with MegaMek. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package megamek.client.ui.advancedsearch; | ||
|
||
import javax.swing.*; | ||
import javax.swing.table.DefaultTableCellRenderer; | ||
import java.awt.*; | ||
|
||
public class TechBaseRenderer extends DefaultTableCellRenderer { | ||
|
||
public TechBaseRenderer() { | ||
super(); | ||
setHorizontalAlignment(SwingConstants.CENTER); | ||
} | ||
|
||
@Override | ||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { | ||
if (value.equals("Inner Sphere")) { | ||
value = "IS"; | ||
} | ||
return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
megamek/src/megamek/client/ui/advancedsearch/WeaponClassFT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.