-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed table update in eft preferences (#9051)
- Loading branch information
Showing
7 changed files
with
185 additions
and
101 deletions.
There are no files selected for viewing
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
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
68 changes: 68 additions & 0 deletions
68
...main/java/org/jabref/gui/preferences/externalfiletypes/ExternalFileTypeItemViewModel.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,68 @@ | ||
package org.jabref.gui.preferences.externalfiletypes; | ||
|
||
import javafx.beans.property.ObjectProperty; | ||
import javafx.beans.property.SimpleObjectProperty; | ||
import javafx.beans.property.SimpleStringProperty; | ||
import javafx.beans.property.StringProperty; | ||
|
||
import org.jabref.gui.externalfiletype.CustomExternalFileType; | ||
import org.jabref.gui.externalfiletype.ExternalFileType; | ||
import org.jabref.gui.icon.IconTheme; | ||
import org.jabref.gui.icon.JabRefIcon; | ||
|
||
public class ExternalFileTypeItemViewModel { | ||
private final ObjectProperty<JabRefIcon> icon = new SimpleObjectProperty<>(); | ||
private final StringProperty name = new SimpleStringProperty(); | ||
private final StringProperty extension = new SimpleStringProperty(); | ||
private final StringProperty mimetype = new SimpleStringProperty(); | ||
private final StringProperty application = new SimpleStringProperty(); | ||
|
||
public ExternalFileTypeItemViewModel(ExternalFileType fileType) { | ||
this.icon.setValue(fileType.getIcon()); | ||
this.name.setValue(fileType.getName()); | ||
this.extension.setValue(fileType.getExtension()); | ||
this.mimetype.setValue(fileType.getMimeType()); | ||
this.application.setValue(fileType.getOpenWithApplication()); | ||
} | ||
|
||
public ExternalFileTypeItemViewModel() { | ||
this(new CustomExternalFileType("", "", "", "", "new", IconTheme.JabRefIcons.FILE)); | ||
} | ||
|
||
public ObjectProperty<JabRefIcon> iconProperty() { | ||
return icon; | ||
} | ||
|
||
/** | ||
* Used for sorting in the table | ||
*/ | ||
public String getName() { | ||
return name.get(); | ||
} | ||
|
||
public StringProperty nameProperty() { | ||
return name; | ||
} | ||
|
||
public StringProperty extensionProperty() { | ||
return extension; | ||
} | ||
|
||
public StringProperty mimetypeProperty() { | ||
return mimetype; | ||
} | ||
|
||
public StringProperty applicationProperty() { | ||
return application; | ||
} | ||
|
||
public ExternalFileType toExternalFileType() { | ||
return new CustomExternalFileType( | ||
this.name.get(), | ||
this.extension.get(), | ||
this.mimetype.get(), | ||
this.application.get(), | ||
this.icon.get().name(), | ||
this.icon.get()); | ||
} | ||
} |
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.