on ‎2020 Dec 21 4:46 AM
Hi Team,
As you know there are various tabs for any given entity in hybris back office.
For example if yo take product ,there are various tabs such as given below.

I have a code like this below
public class DefaultGroupVariantsProductStaticMsgRenderer extends AbstractEditorAreaPanelRenderer<ProductModel> {
private static final Logger LOG = LogManager.getLogger(DefaultGroupVariantsProductStaticMsgRenderer.class);
public static final String GROUP_PRODUCT_STATIC_MESSAGE = "hmc.group.product.alert";
public static final String GROUP_PRODUCT_VARIANTS_STATIC_MESSAGE = "hmc.group.product.variants.alert";
private WidgetInstanceManager widgetInstanceManager;
public DefaultGroupVariantsProductStaticMsgRenderer() { }
public void render(Component parent, AbstractPanel abstractPanel, ProductModel model, DataType dataType, WidgetInstanceManager widgetInstanceManager) {
if (!(model instanceof GenericVariantProductModel)) {
LOG.error("Product is not Variant Type");
return;
}
final GenericVariantProductModel gvpModel = (GenericVariantProductModel) model;
this.widgetInstanceManager = widgetInstanceManager;
if (gvpModel.getBaseProduct().isDefaultBase() == false) {
Div panel = new Div();
Label label = new Label(Labels.getLabel(GROUP_PRODUCT_VARIANTS_STATIC_MESSAGE));
label.setParent(panel);
parent.appendChild(panel);
}
}}
Based on the tab thats is being selected I need to set the message GROUP_PRODUCT_STATIC_MESSAGE or GROUP_PRODUCT_VARIANTS_STATIC_MESSAGE in the label accordingly.
Please advise how can i get the tab name for example in this case "VARIANTS" ?
Request clarification before answering.
We usually set this renderer in config file like below:
<editorArea:customPanel spring-bean="productMsgRenderer" /><br>You can define two different renderer instances and pass attributes for the same.
OR
You can use same renderer instance with different custom attributes passed in config and captured in above Renderer class as below :
component.getAttribute("attr");<br>
OR
I think you could be able to parse the Component tree in below method to get the tab label name. Debug will help. Please try.
public void render(Component parent, AbstractPanel abstractPanel, ProductModel model, DataType dataType, WidgetInstanceManager widgetInstanceManager)<br>Hope you got some heads up! Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.