forked from eclipse-sirius/sirius-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1233] Handle Form Description Widgets styles
Handle the styling of the Select, MultiSelect, Textarea, Radio, Checkbox widgets from View DSL. Bug: eclipse-sirius#1233 Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
- Loading branch information
1 parent
f1ea560
commit 2d030f0
Showing
102 changed files
with
9,826 additions
and
229 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
48 changes: 48 additions & 0 deletions
48
...-emf/src/main/java/org/eclipse/sirius/components/emf/view/form/CheckboxStyleProvider.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,48 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.components.emf.view.form; | ||
|
||
import java.util.Objects; | ||
import java.util.function.Function; | ||
|
||
import org.eclipse.sirius.components.forms.CheckboxStyle; | ||
import org.eclipse.sirius.components.forms.CheckboxStyle.Builder; | ||
import org.eclipse.sirius.components.representations.VariableManager; | ||
import org.eclipse.sirius.components.view.CheckboxDescriptionStyle; | ||
|
||
/** | ||
* The style provider for the Checkbox Description widget of the View DSL. | ||
* | ||
* @author arichard | ||
*/ | ||
public class CheckboxStyleProvider implements Function<VariableManager, CheckboxStyle> { | ||
|
||
private final CheckboxDescriptionStyle viewStyle; | ||
|
||
public CheckboxStyleProvider(CheckboxDescriptionStyle viewStyle) { | ||
this.viewStyle = Objects.requireNonNull(viewStyle); | ||
} | ||
|
||
@Override | ||
public CheckboxStyle apply(VariableManager variableManager) { | ||
Builder checkboxStyleBuilder = CheckboxStyle.newCheckboxStyle(); | ||
|
||
String color = this.viewStyle.getColor(); | ||
if (color != null && !color.isBlank()) { | ||
checkboxStyleBuilder.color(color); | ||
} | ||
|
||
return checkboxStyleBuilder.build(); | ||
} | ||
|
||
} |
65 changes: 65 additions & 0 deletions
65
...f/src/main/java/org/eclipse/sirius/components/emf/view/form/MultiSelectStyleProvider.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,65 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.components.emf.view.form; | ||
|
||
import java.util.Objects; | ||
import java.util.function.Function; | ||
|
||
import org.eclipse.sirius.components.forms.MultiSelectStyle; | ||
import org.eclipse.sirius.components.forms.MultiSelectStyle.Builder; | ||
import org.eclipse.sirius.components.representations.VariableManager; | ||
import org.eclipse.sirius.components.view.MultiSelectDescriptionStyle; | ||
|
||
/** | ||
* The style provider for the MultiSelect Description widget of the View DSL. | ||
* | ||
* @author arichard | ||
*/ | ||
public class MultiSelectStyleProvider implements Function<VariableManager, MultiSelectStyle> { | ||
|
||
private final MultiSelectDescriptionStyle viewStyle; | ||
|
||
public MultiSelectStyleProvider(MultiSelectDescriptionStyle viewStyle) { | ||
this.viewStyle = Objects.requireNonNull(viewStyle); | ||
} | ||
|
||
@Override | ||
public MultiSelectStyle apply(VariableManager variableManager) { | ||
Builder multiSelectStyleBuilder = MultiSelectStyle.newMultiSelectStyle(); | ||
|
||
String backgroundColor = this.viewStyle.getBackgroundColor(); | ||
if (backgroundColor != null && !backgroundColor.isBlank()) { | ||
multiSelectStyleBuilder.backgroundColor(backgroundColor); | ||
} | ||
String foregroundColor = this.viewStyle.getForegroundColor(); | ||
if (foregroundColor != null && !foregroundColor.isBlank()) { | ||
multiSelectStyleBuilder.foregroundColor(foregroundColor); | ||
} | ||
int fontSize = this.viewStyle.getFontSize(); | ||
boolean italic = this.viewStyle.isItalic(); | ||
boolean bold = this.viewStyle.isBold(); | ||
boolean underline = this.viewStyle.isUnderline(); | ||
boolean strikeThrough = this.viewStyle.isStrikeThrough(); | ||
|
||
// @formatter:off | ||
return multiSelectStyleBuilder | ||
.fontSize(fontSize) | ||
.italic(italic) | ||
.bold(bold) | ||
.underline(underline) | ||
.strikeThrough(strikeThrough) | ||
.build(); | ||
// @formatter:on | ||
} | ||
|
||
} |
61 changes: 61 additions & 0 deletions
61
...nts-emf/src/main/java/org/eclipse/sirius/components/emf/view/form/RadioStyleProvider.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,61 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.components.emf.view.form; | ||
|
||
import java.util.Objects; | ||
import java.util.function.Function; | ||
|
||
import org.eclipse.sirius.components.forms.RadioStyle; | ||
import org.eclipse.sirius.components.forms.RadioStyle.Builder; | ||
import org.eclipse.sirius.components.representations.VariableManager; | ||
import org.eclipse.sirius.components.view.RadioDescriptionStyle; | ||
|
||
/** | ||
* The style provider for the Radio Description widget of the View DSL. | ||
* | ||
* @author arichard | ||
*/ | ||
public class RadioStyleProvider implements Function<VariableManager, RadioStyle> { | ||
|
||
private final RadioDescriptionStyle viewStyle; | ||
|
||
public RadioStyleProvider(RadioDescriptionStyle viewStyle) { | ||
this.viewStyle = Objects.requireNonNull(viewStyle); | ||
} | ||
|
||
@Override | ||
public RadioStyle apply(VariableManager variableManager) { | ||
Builder radioStyleBuilder = RadioStyle.newRadioStyle(); | ||
|
||
String color = this.viewStyle.getColor(); | ||
if (color != null && !color.isBlank()) { | ||
radioStyleBuilder.color(color); | ||
} | ||
int fontSize = this.viewStyle.getFontSize(); | ||
boolean italic = this.viewStyle.isItalic(); | ||
boolean bold = this.viewStyle.isBold(); | ||
boolean underline = this.viewStyle.isUnderline(); | ||
boolean strikeThrough = this.viewStyle.isStrikeThrough(); | ||
|
||
// @formatter:off | ||
return radioStyleBuilder | ||
.fontSize(fontSize) | ||
.italic(italic) | ||
.bold(bold) | ||
.underline(underline) | ||
.strikeThrough(strikeThrough) | ||
.build(); | ||
// @formatter:on | ||
} | ||
|
||
} |
Oops, something went wrong.