-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/finished/iia 1112 image data type (#247)
* Update version to start feature: IIA-1112-Image-Data-Type * Feature/IIA-1112: Add Image Data Type to Komet without fetching from the Database * Update version to finish feature: IIA-1112-Image-Data-Type * Feature/IIA-1437: compare public ids rather than Nids AND fix Image only showing on first time * Feature/IIA-1437: add missing call to add readonly image control * Feature/IIA-1112: Typo in getDescription method * Feature/IIA-1112: remove file name from UI
- Loading branch information
Showing
7 changed files
with
123 additions
and
35 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
33 changes: 33 additions & 0 deletions
33
kview/src/main/java/dev/ikm/komet/kview/klfields/imagefield/DefaultKlImageField.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,33 @@ | ||
package dev.ikm.komet.kview.klfields.imagefield; | ||
|
||
import dev.ikm.komet.framework.observable.ObservableField; | ||
import dev.ikm.komet.framework.view.ObservableView; | ||
import dev.ikm.komet.kview.controls.KLImageControl; | ||
import dev.ikm.komet.kview.controls.KLReadOnlyImageControl; | ||
import dev.ikm.komet.kview.klfields.BaseDefaultKlField; | ||
import dev.ikm.komet.layout.component.version.field.KlImageField; | ||
import javafx.scene.Node; | ||
import javafx.scene.image.Image; | ||
|
||
public class DefaultKlImageField extends BaseDefaultKlField<Image> implements KlImageField { | ||
// TODO: For now we are using only one instance of each Image Data type control so we can bind them together | ||
private static KLImageControl imageControl = new KLImageControl(); | ||
private static KLReadOnlyImageControl readOnlyImageControl = new KLReadOnlyImageControl(); | ||
|
||
public DefaultKlImageField(ObservableField<Image> observableFloatField, ObservableView observableView, boolean isEditable) { | ||
super(observableFloatField, observableView, isEditable); | ||
|
||
Node node; | ||
if (isEditable) { | ||
imageControl.setTitle("Image"); //TODO: for now the title is hardcoded but we need to get it from the ObservableField | ||
|
||
node = imageControl; | ||
} else { | ||
readOnlyImageControl.setTitle("Image"); //TODO: for now the title is hardcoded but we need to get it from the ObservableField | ||
readOnlyImageControl.imageFileProperty().bind(imageControl.imageFileProperty()); //TODO: this should later be bound to the ObservableField | ||
|
||
node = readOnlyImageControl; | ||
} | ||
setKlWidget(node); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
kview/src/main/java/dev/ikm/komet/kview/klfields/imagefield/KlImageFieldFactory.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,36 @@ | ||
package dev.ikm.komet.kview.klfields.imagefield; | ||
|
||
import dev.ikm.komet.framework.observable.ObservableField; | ||
import dev.ikm.komet.framework.view.ObservableView; | ||
import dev.ikm.komet.layout.component.version.field.KlField; | ||
import dev.ikm.komet.layout.component.version.field.KlFieldFactory; | ||
import dev.ikm.komet.layout.component.version.field.KlImageField; | ||
import javafx.scene.image.Image; | ||
|
||
public class KlImageFieldFactory implements KlFieldFactory<Image> { | ||
|
||
@Override | ||
public KlField<Image> create(ObservableField<Image> observableField, ObservableView observableView, boolean editable) { | ||
return new DefaultKlImageField(observableField, observableView, editable); | ||
} | ||
|
||
@Override | ||
public Class<? extends KlField<Image>> getFieldInterface() { | ||
return KlImageField.class; | ||
} | ||
|
||
@Override | ||
public Class<? extends KlField<Image>> getFieldImplementation() { | ||
return DefaultKlImageField.class; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "Image Field Factory"; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "An Image field"; | ||
} | ||
} |
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