Skip to content

Commit

Permalink
[3920] Fix DateTime widget default style not set
Browse files Browse the repository at this point in the history
Bug: #3920
Signed-off-by: Michaël Charfadi <[email protected]>
  • Loading branch information
mcharfadi authored and sbegaudeau committed Sep 2, 2024
1 parent 07993b3 commit 17e77fd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ As a result, the following maven modules have been deleted: `sirius-web-sample-a
- https://github.com/eclipse-sirius/sirius-web/issues/3899[#3899] [diagram] Fix an issue when using alt-tab shortcut and trying to drag a node afterwards
- https://github.com/eclipse-sirius/sirius-web/issues/3911[#3911] [diagram] Fix overflow issue with labels, ensuring proper wrapping and ellipsis.
- https://github.com/eclipse-sirius/sirius-web/issues/3933[#3933] [vs-code] Fix explorer in vscode extension
- https://github.com/eclipse-sirius/sirius-web/issues/3920[#3920] [form] Fix DateTime widget default style not set

=== New Features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.eclipse.sirius.components.view.form.ButtonDescriptionStyle;
import org.eclipse.sirius.components.view.form.CheckboxDescription;
import org.eclipse.sirius.components.view.form.CheckboxDescriptionStyle;
import org.eclipse.sirius.components.view.form.DateTimeDescriptionStyle;
import org.eclipse.sirius.components.view.form.FormElementFor;
import org.eclipse.sirius.components.view.form.FormElementIf;
import org.eclipse.sirius.components.view.form.FormPackage;
Expand Down Expand Up @@ -52,6 +53,9 @@
*/
public class FormColorAdapter extends EContentAdapter {

private static final String TRANSPARENT = "transparent";

private static final String TEXT_PRIMARY = "theme.palette.text.primary";

private FormStyleSwitch formStyleSwitch;

Expand Down Expand Up @@ -149,34 +153,34 @@ public Void caseCheckboxDescriptionStyle(CheckboxDescriptionStyle object) {
@Override
public Void caseLabelDescriptionStyle(LabelDescriptionStyle object) {
if (object.getColor() == null) {
object.setColor(this.colorPaletteService.getColorFromPalette(object, "theme.palette.text.primary"));
object.setColor(this.colorPaletteService.getColorFromPalette(object, TEXT_PRIMARY));
}
return null;
}

@Override
public Void caseLinkDescriptionStyle(LinkDescriptionStyle object) {
if (object.getColor() == null) {
object.setColor(this.colorPaletteService.getColorFromPalette(object, "theme.palette.text.primary"));
object.setColor(this.colorPaletteService.getColorFromPalette(object, TEXT_PRIMARY));
}
return null;
}

@Override
public Void caseListDescriptionStyle(ListDescriptionStyle object) {
if (object.getColor() == null) {
object.setColor(this.colorPaletteService.getColorFromPalette(object, "theme.palette.text.primary"));
object.setColor(this.colorPaletteService.getColorFromPalette(object, TEXT_PRIMARY));
}
return null;
}

@Override
public Void caseMultiSelectDescriptionStyle(MultiSelectDescriptionStyle object) {
if (object.getBackgroundColor() == null) {
object.setBackgroundColor(this.colorPaletteService.getColorFromPalette(object, "transparent"));
object.setBackgroundColor(this.colorPaletteService.getColorFromPalette(object, TRANSPARENT));
}
if (object.getForegroundColor() == null) {
object.setForegroundColor(this.colorPaletteService.getColorFromPalette(object, "theme.palette.text.primary"));
object.setForegroundColor(this.colorPaletteService.getColorFromPalette(object, TEXT_PRIMARY));
}
return null;
}
Expand All @@ -192,32 +196,43 @@ public Void caseRadioDescriptionStyle(RadioDescriptionStyle object) {
@Override
public Void caseSelectDescriptionStyle(SelectDescriptionStyle object) {
if (object.getBackgroundColor() == null) {
object.setBackgroundColor(this.colorPaletteService.getColorFromPalette(object, "transparent"));
object.setBackgroundColor(this.colorPaletteService.getColorFromPalette(object, TRANSPARENT));
}
if (object.getForegroundColor() == null) {
object.setForegroundColor(this.colorPaletteService.getColorFromPalette(object, "theme.palette.text.primary"));
object.setForegroundColor(this.colorPaletteService.getColorFromPalette(object, TEXT_PRIMARY));
}
return null;
}

@Override
public Void caseTextareaDescriptionStyle(TextareaDescriptionStyle object) {
if (object.getBackgroundColor() == null) {
object.setBackgroundColor(this.colorPaletteService.getColorFromPalette(object, "transparent"));
object.setBackgroundColor(this.colorPaletteService.getColorFromPalette(object, TRANSPARENT));
}
if (object.getForegroundColor() == null) {
object.setForegroundColor(this.colorPaletteService.getColorFromPalette(object, "theme.palette.text.primary"));
object.setForegroundColor(this.colorPaletteService.getColorFromPalette(object, TEXT_PRIMARY));
}
return null;
}

@Override
public Void caseTextfieldDescriptionStyle(TextfieldDescriptionStyle object) {
if (object.getBackgroundColor() == null) {
object.setBackgroundColor(this.colorPaletteService.getColorFromPalette(object, "transparent"));
object.setBackgroundColor(this.colorPaletteService.getColorFromPalette(object, TRANSPARENT));
}
if (object.getForegroundColor() == null) {
object.setForegroundColor(this.colorPaletteService.getColorFromPalette(object, TEXT_PRIMARY));
}
return null;
}

@Override
public Void caseDateTimeDescriptionStyle(DateTimeDescriptionStyle object) {
if (object.getBackgroundColor() == null) {
object.setBackgroundColor(this.colorPaletteService.getColorFromPalette(object, TRANSPARENT));
}
if (object.getForegroundColor() == null) {
object.setForegroundColor(this.colorPaletteService.getColorFromPalette(object, "theme.palette.text.primary"));
object.setForegroundColor(this.colorPaletteService.getColorFromPalette(object, TEXT_PRIMARY));
}
return null;
}
Expand Down

0 comments on commit 17e77fd

Please sign in to comment.