forked from adobe/adobe-dx
-
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.
- Loading branch information
Showing
18 changed files
with
344 additions
and
77 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
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
34 changes: 34 additions & 0 deletions
34
bundles/core/src/main/java/com/adobe/dx/img/ImageModel.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,34 @@ | ||
/******************************************************************************* | ||
* | ||
* ADOBE CONFIDENTIAL | ||
* __________________ | ||
* | ||
* Copyright 2019 Adobe | ||
* All Rights Reserved. | ||
* | ||
* NOTICE: All information contained herein is, and remains | ||
* the property of Adobe and its suppliers, if any. The intellectual | ||
* and technical concepts contained herein are proprietary to Adobe | ||
* and its suppliers and are protected by all applicable intellectual | ||
* property laws, including trade secret and copyright laws. | ||
* Dissemination of this information or reproduction of this material | ||
* is strictly forbidden unless prior written permission is obtained | ||
* from Adobe. | ||
******************************************************************************/ | ||
|
||
package com.adobe.dx.img; | ||
|
||
import java.util.Map; | ||
|
||
import org.apache.sling.api.SlingHttpServletRequest; | ||
import org.apache.sling.models.annotations.Model; | ||
import org.apache.sling.models.annotations.injectorspecific.ScriptVariable; | ||
|
||
@Model(adaptables = SlingHttpServletRequest.class) | ||
public class ImageModel { | ||
|
||
@ScriptVariable | ||
Map<String, Object> resprops; | ||
|
||
|
||
} |
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
70 changes: 70 additions & 0 deletions
70
bundles/core/src/main/java/com/adobe/dx/style/internal/Background.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,70 @@ | ||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
~ Copyright 2020 Adobe | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ | ||
package com.adobe.dx.style.internal; | ||
|
||
import static com.adobe.dx.utils.RequestUtil.getFromRespProps; | ||
|
||
import com.adobe.dx.responsive.Breakpoint; | ||
import com.adobe.dx.style.StyleWorker; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.apache.commons.lang.StringUtils; | ||
import org.apache.sling.api.SlingHttpServletRequest; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.ConfigurationPolicy; | ||
|
||
@Component(configurationPolicy = ConfigurationPolicy.REQUIRE) | ||
public class Background implements StyleWorker { | ||
private static final String KEY = "background"; | ||
private static final String PN_BACKGROUNDCOLOR = "backgroundColor"; | ||
private static final String PN_GRADIENT = "gradient"; | ||
private static final String PN_IMAGE = "fileReference"; | ||
private static final String PN_FOCUSX = "focusX"; | ||
private static final String PN_FOCUSY = "focusY"; | ||
private static final String COLOR_FORMAT = "background-color: %s"; | ||
|
||
@Override | ||
public String getKey() { | ||
return KEY; | ||
} | ||
|
||
@Override | ||
public @Nullable String getDeclaration(@Nullable Breakpoint breakpoint, SlingHttpServletRequest request) { | ||
String bgColor = getFromRespProps(request, breakpoint, PN_BACKGROUNDCOLOR, String.class); | ||
String gradient = getFromRespProps(request, breakpoint, PN_GRADIENT, String.class); | ||
String backgroundImage = getFromRespProps(request, breakpoint, PN_IMAGE, String.class); | ||
if (bgColor != null || gradient != null || backgroundImage != null) { | ||
List<String> declarations = new ArrayList<>(); | ||
if (StringUtils.isNotBlank(bgColor)) { | ||
declarations.add(COLOR_FORMAT.format(bgColor)); | ||
} | ||
if (StringUtils.isNotBlank(gradient)) { | ||
|
||
} | ||
|
||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public @Nullable String getRule(@Nullable Breakpoint breakpoint, @Nullable String id, | ||
SlingHttpServletRequest request) { | ||
return null; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
bundles/core/src/main/java/com/adobe/dx/style/internal/Color.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,56 @@ | ||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
~ Copyright 2020 Adobe | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ | ||
|
||
package com.adobe.dx.style.internal; | ||
|
||
import static com.adobe.dx.utils.RequestUtil.getFromRespProps; | ||
|
||
import com.adobe.dx.responsive.Breakpoint; | ||
import com.adobe.dx.style.StyleWorker; | ||
|
||
import org.apache.commons.lang.StringUtils; | ||
import org.apache.sling.api.SlingHttpServletRequest; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.ConfigurationPolicy; | ||
|
||
@Component(configurationPolicy = ConfigurationPolicy.REQUIRE) | ||
public class Color implements StyleWorker { | ||
private final static String KEY = "color"; | ||
|
||
private final static String PN_COLOR = "foregroundColor"; | ||
private final static String FORMAT = "color: %s"; | ||
|
||
@Override | ||
public String getKey() { | ||
return KEY; | ||
} | ||
|
||
@Override | ||
public @Nullable String getDeclaration(@Nullable Breakpoint breakpoint, SlingHttpServletRequest request) { | ||
String color = getFromRespProps(request, breakpoint, PN_COLOR, String.class); | ||
if (StringUtils.isNotBlank(color)) { | ||
return String.format(FORMAT, color); | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public @Nullable String getRule(@Nullable Breakpoint breakpoint, @Nullable String id, | ||
SlingHttpServletRequest request) { | ||
return null; | ||
} | ||
} |
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.