Skip to content

Commit

Permalink
adobeGH-24 add getRule API
Browse files Browse the repository at this point in the history
  • Loading branch information
npeltier committed Sep 14, 2020
1 parent 16fffdb commit fd3dbdf
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,13 @@ public interface StyleWorker {
*/
@Nullable String getDeclaration(@Nullable Breakpoint breakpoint, SlingHttpServletRequest request);

/**
* Generates a rule specific to that generator
*
* @param breakpoint if rule is specific to it, null otherwise
* @param id rules can reuse in format <code>${id}</code> current
* @param request current request
* @return one or several rules
*/
@Nullable String getRule(@Nullable Breakpoint breakpoint, @Nullable String id, SlingHttpServletRequest request);
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ public String getKey() {
return null;
}

@Override
public @Nullable String getRule(@Nullable Breakpoint breakpoint, @Nullable String id,
SlingHttpServletRequest request) {
return null;
}

private String buildBorder(ValueMap policy) {
String borderSides = policy.get(PN_SIDES, String.class);
if (StringUtils.equals(ALL, borderSides)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,10 @@ public String getKey() {
}
return null;
}

@Override
public @Nullable String getRule(@Nullable Breakpoint breakpoint, @Nullable String id,
SlingHttpServletRequest request) {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static com.day.cq.wcm.commons.Constants.EMPTY_STRING_ARRAY;
import static org.apache.commons.lang3.StringUtils.EMPTY;

import com.adobe.dx.bindings.internal.DxBindingsValueProvider;
import com.adobe.dx.responsive.Breakpoint;
import com.adobe.dx.style.StyleWorker;
import com.adobe.dx.style.StyleService;
Expand All @@ -33,10 +32,8 @@

import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.hssf.record.PageBreakRecord;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.scripting.SlingBindings;
import org.jetbrains.annotations.NotNull;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.ConfigurationPolicy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ public String getKey() {
return getFromRequest("min-height", breakpoint.key(), "minheight", request);
}
}

@Override
public @Nullable String getRule(@Nullable Breakpoint breakpoint, @Nullable String id,
SlingHttpServletRequest request) {
return null;
}
};

StyleWorker worker2 = new StyleWorker() {
Expand All @@ -84,6 +90,12 @@ public String getKey() {
return getFromRequest("min-width", breakpoint.key(), "minwidth", request);
}
}

@Override
public @Nullable String getRule(@Nullable Breakpoint breakpoint, @Nullable String id,
SlingHttpServletRequest request) {
return null;
}
};
StyleServiceImpl service;

Expand Down

0 comments on commit fd3dbdf

Please sign in to comment.