mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-12-21 15:29:30 +00:00
Fixed sheet-related issues in outlaw editor
This commit is contained in:
parent
6130ac3de1
commit
8776d9010b
@ -24,7 +24,7 @@
|
||||
<plugin>
|
||||
<groupId>com.gluonhq</groupId>
|
||||
<artifactId>gluonfx-maven-plugin</artifactId>
|
||||
<version>1.0.19</version>
|
||||
<version>1.0.24</version>
|
||||
<configuration>
|
||||
<mainClass>${mainClass}</mainClass>
|
||||
<options>
|
||||
@ -56,12 +56,12 @@
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
<version>3.11.0</version>
|
||||
<version>3.13.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>jaxb2-maven-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>xjc</id>
|
||||
@ -78,7 +78,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.8.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
@ -109,17 +109,17 @@
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
<version>4.0.1</version>
|
||||
<version>4.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>4.0.3</version>
|
||||
<version>4.0.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.controlsfx</groupId>
|
||||
<artifactId>controlsfx</artifactId>
|
||||
<version>11.2.0</version>
|
||||
<version>11.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
|
@ -39,7 +39,7 @@ import org.badvision.outlaweditor.ui.SheetEditorController;
|
||||
import org.badvision.outlaweditor.ui.UIAction;
|
||||
import org.controlsfx.control.spreadsheet.GridBase;
|
||||
import org.controlsfx.control.spreadsheet.SpreadsheetCell;
|
||||
import org.controlsfx.control.spreadsheet.SpreadsheetCellBase;
|
||||
import org.controlsfx.control.spreadsheet.SpreadsheetCellType;
|
||||
|
||||
import jakarta.xml.bind.JAXBException;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
@ -70,6 +70,7 @@ public class SheetEditorControllerImpl extends SheetEditorController {
|
||||
super.initialize();
|
||||
tableData = table.getGrid().getRows();
|
||||
table.setEditable(true);
|
||||
|
||||
table.getContextMenu().getItems().addAll(
|
||||
createMenuItem("Insert Row", () -> insertRow(new Row(), getSelectedRow())),
|
||||
createMenuItem("Clone Row", () -> cloneRow(editor.getSheet().getRows().getRow().get(getSelectedRow()))),
|
||||
@ -153,11 +154,16 @@ public class SheetEditorControllerImpl extends SheetEditorController {
|
||||
public void addColumnAction(ActionEvent event) {
|
||||
String newColName = UIAction.getText("Enter new column name", "new");
|
||||
if (newColName != null && !newColName.isEmpty()) {
|
||||
// If the column exists with that name, show an error instead
|
||||
UserType col = new UserType();
|
||||
col.setName(newColName);
|
||||
if (editor.getSheet().getColumns() == null) {
|
||||
editor.getSheet().setColumns(new Columns());
|
||||
} else if (editor.getSheet().getColumns().getColumn().stream().anyMatch(c -> c.getName().equals(newColName))) {
|
||||
UIAction.alert("A column with that name already exists. Please choose a different name.");
|
||||
return;
|
||||
}
|
||||
|
||||
insertColumn(col);
|
||||
rebuildGridUI();
|
||||
}
|
||||
@ -276,8 +282,7 @@ public class SheetEditorControllerImpl extends SheetEditorController {
|
||||
tableData.add(rowUi);
|
||||
for (UserType col : editor.getSheet().getColumns().getColumn()) {
|
||||
String value = getValue(row.getOtherAttributes(), col.getName());
|
||||
SpreadsheetCellBase cell = new SpreadsheetCellBase(rowNum, colNum, 1, 1);
|
||||
cell.setItem(value);
|
||||
SpreadsheetCell cell = SpreadsheetCellType.STRING.createCell(rowNum, colNum, 1, 1, value);
|
||||
cell.itemProperty().addListener((ObservableValue<? extends Object> val, Object oldVal, Object newVal) -> {
|
||||
setValue(row.getOtherAttributes(), col.getName(), String.valueOf(newVal));
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user