Oracle ADF Essentials 10.2.1 Task Flow Not Working - eclipse

I have create a simple JSPX file and a Task Flow using Eclipse Neon OEPE 12.2.1.5
Task Flow XML mainTab.xml
<?xml version="1.0" encoding="UTF-8"?>
<adfc-config xmlns="http://xmlns.oracle.com/adf/controller" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/adf/controller http://xmlns.oracle.com/adf/controller/adfc-config_1_0.xsd">
<task-flow-definition id="mainTab">
<default-activity>view1</default-activity>
<view id="view1">
<page>/view1.jsff</page>
</view>
<view id="view2">
<page>/view2.jsff</page>
</view>
<control-flow-rule>
<from-activity-id>view1</from-activity-id>
<control-flow-case>
<from-outcome>openView2</from-outcome>
<to-activity-id>view2</to-activity-id>
</control-flow-case>
</control-flow-rule>
<control-flow-rule>
<from-activity-id>view2</from-activity-id>
<control-flow-case>
<from-outcome>openView1</from-outcome>
<to-activity-id>view1</to-activity-id>
</control-flow-case>
</control-flow-rule>
<use-page-fragments/>
</task-flow-definition>
</adfc-config>
Main JSPX file
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8" />
<f:view>
<af:document id="d1">
<af:form id="f1">
<af:panelStretchLayout id="psl1">
<f:facet name="center">
<af:region value="#{bindings.mainTab.regionModel}"
id="r1" />
</f:facet>
</af:panelStretchLayout>
</af:form>
</af:document>
</f:view>
</jsp:root>
First View view1.jsff
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:panelStretchLayout id="psl1">
<f:facet name="center">
<af:panelGroupLayout layout="vertical" id="p1">
<af:outputText id="o1" value="Hello View 1"></af:outputText>
<af:button id="b1" text="Load View 2" action="openview2"></af:button>
</af:panelGroupLayout>
</f:facet>
</af:panelStretchLayout>
</jsp:root>
Second View view2.jsff
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:panelStretchLayout id="psl1">
<f:facet name="center">
<af:panelGroupLayout layout="vertical" id="p1">
<af:outputText id="o1" value="Hello View 2"></af:outputText>
<af:button id="b1" text="Load View 1" action="openview1"></af:button>
</af:panelGroupLayout>
</f:facet>
</af:panelStretchLayout>
</jsp:root>
When run the JSPX file Hello View 1 and the button Load View 2 appears, but clicking on the button nothing happens
I am also getting this warning at action="openview1"
The action value does not match a navigation case outcome
I tried the auto completion goto in eclipse with action="view1"
still the button does nothing

Related

Moving Coupon Block on the top of the page

I would like to move coupon block on the upper side of the page (before cart summary).
Coupon block are located on: App/design/frontend/mytheme/themename/default/Magento_Checkout/layout/checkout_cart_index.xml
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="checkout.cart.container">
<container name="cart.discount" label="Cart Discount Container" htmlTag="div" htmlClass="cart-discount" after="-" />
</referenceContainer>
<move element="checkout.cart.crosssell" destination="checkout.cart.container" after="-" />
<move element="checkout.cart.coupon" destination="cart.discount" />
<move element="checkout.cart.shortcut.buttons" destination="checkout.cart.methods" after="checkout.cart.methods.onepage.bottom"/>
</body>

Color swatch on compare page in magento2

Magento2
How can be get the color swatch on product compare page..
To have color swtach on product compare page you need to create custom module:-
Create a layout file with the name as catalog_product_compare_index.xml and add below code in the file created.
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="Magento_Swatches::css/swatches.css"/>
</head>
<body>
<referenceContainer name="content">
<referenceBlock name="catalog.compare.list">
<action method="setTemplate">
<argument name="template" xsi:type="string">W3solver_Compareswatch::product/compare/list.phtml</argument>
</action>
<block class="Magento\Framework\View\Element\RendererList" name="category.product.type.details.renderers" as="details.renderers">
<block class="Magento\Swatches\Block\Product\Renderer\Listing\Configurable" as="configurable" template="Magento_Swatches::product/listing/renderer.phtml" />
</block>
</referenceBlock>
</referenceContainer>
</body>
</page>
You need to add one function in your overriden list.phtml on line 63
<?php
if($_item->getTypeId() == "configurable"):
echo $block->getProductDetailsHtml($_item);
endif;
?>
This will show the color patches on compare page.

XSLT1.0 Add child element only once if does not exist

I am trying to add an element called Stamping one time and only if it doesn't exist in the message.
<!-- Copy all other elements -->
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()" />
</xsl:copy>
<xsl:template match="/*[local-name()='Envelope']/*[local-name()='Body']/*/*[not(*[local-name()='Stamping'])]">
<xsl:copy>
<xsl:apply-templates select="#*|node()" />
</xsl:copy>
<v1:Stamping>
<v2:UserData CityCode="NO Stamping" Role="User" SecurityId="55"/>
</v1:Stamping>
</xsl:template>
My problem occurs because the new v1:Stamping value is repeated for every child like this based on my existing match:
<envelope>
<body>
<operationName>
<child1 Catalog="1" />
<v1:Stamping>
<v2:UserData CityCode="NO Stamping" Role="User" SecurityId="55"/>
<v1:Stamping>
<child2 Catalog="2" />
<v1:Stamping>
<v2:UserData CityCode="NO Stamping" Role="User" SecurityId="55"/>
</v1:Stamping>
</operationName>
</body>
</envelope>
I need to see the result where stamping is only added one time as a child element of operationName. operationName is an element that will exist but this XSLT will be applied across many services and the value in operationName will be different depending on the service where this XSLT will be applied. This example below would be the needed output.
<envelope>
<body>
<operationName>
<child1 Catalog="1" />
<child2 Catalog="2" />
<v2:UserData CityCode="NO Stamping" Role="User" SecurityId="55"/>
</operationName>
</body>
</envelope>
I need to see the result where stamping is only added one time as a
child element of operationName.
Then write a template especially for operationName elements:
<xsl:template match="operationName">
and check whether v1:Stamping already exists as one of its children:
<xsl:if test="not(v1:Stamping)">
If it does not exist already, it is added to the output tree.
Assuming the following XML, where there is no v1:Stamping element, as input:
XML Input
<?xml version="1.0" encoding="UTF-8"?>
<envelope>
<body>
<operationName>
<child1 Catalog="1"/>
<child2 Catalog="2"/>
</operationName>
</body>
</envelope>
Stylesheet
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:v1="http://www.v1.com" xmlns:v2="http://www.v2.com">
<xsl:output method="xml" encoding="UTF-8" indent="yes" />
<xsl:strip-space elements="*"/>
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="operationName">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
<xsl:if test="not(v1:Stamping)">
<v1:Stamping>
<v2:UserData CityCode="NO Stamping" Role="User" SecurityId="55"/>
</v1:Stamping>
</xsl:if>
</xsl:copy>
</xsl:template>
</xsl:transform>
XML Output
<?xml version="1.0" encoding="UTF-8"?>
<envelope>
<body>
<operationName>
<child1 Catalog="1"/>
<child2 Catalog="2"/>
<v1:Stamping xmlns:v1="http://www.v1.com" xmlns:v2="http://www.v2.com">
<v2:UserData CityCode="NO Stamping" Role="User" SecurityId="55"/>
</v1:Stamping>
</operationName>
</body>
</envelope>

Convert XML Option element nodes to HTML Option tags

Is there a direct was to convert an Element Object to an HTMLOption Object?
Let's suppose I have this XML:
<?xml version='1.0'?>
<options>
<option value="1">Hello1</option>
<option value="2">Hello2</option>
</options>
I want to insert each option in this select
Is there a way to just convert these XML to option directly or I have to then navigate the XML then get all information I need and then create a new Option and add that option to the select?
something like:
var options = XmlCode.getElementsByTagName('option');
for(var i = 0; i < options.length; i++){
selectBox.add(options[i]);
}
as a native code would be nice ^^
Note: I don't want to use any libraries or frameworks. I want do learn and do this by myself.
XSLT is made for XML to HTML conversion. Something like this will do the trick:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="select2option.xml" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:html="http://www.w3.org/1999/xhtml"
>
<xsl:output method="html" encoding="utf-8" indent="yes" standalone="yes" media-type="text/html" omit-xml-declaration="yes" doctype-system="about:legacy-compat" />
<html:options>
<html:option name="foo">bar</html:option>
</html:options>
<xsl:template match="xsl:stylesheet">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="/">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="html:options">
<select>
<xsl:apply-templates />
</select>
</xsl:template>
<xsl:template match="html:option">
<option name="#name">
<xsl:apply-templates />
</option>
</xsl:template>
</xsl:stylesheet>

Zend Framework - how to apply icon in xml file and retriev it

When it load the xml file, the icon cause failure inside the label tags. How to fix it?
// horizontal top menu
<?xml version="1.0" encoding="UTF-8"?>
<root>
<nav>
<page1>
<label><img src='icon.icon' /> Page 1</label>
<controller>index</controller>
</page1>
<home>
<label>Home</label>
<controller>index</controller>
</home>
</nav>
</root>
// controller test
$config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml', 'nav');
$container = new Zend_Navigation($config);
$this->view->navigation($container);
I suppose you could do it with CSS instead
// horizontal top menu
<?xml version="1.0" encoding="UTF-8"?>
<root>
<nav>
<page1>
<label>Page 1</label>
<controller>index</controller>
<class>menu-page1-icon</class>
</page1>
</nav>
</root>
CSS
.menu-page1-icon:before {
content: url(path/to/icon.icon);
}
It should probably be in a cdata section:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<nav>
<page1>
<label><![CDATA[<img src='icon.icon' /> Page 1]]></label>
<controller>index</controller>
</page1>
<home>
<label>Home</label>
<controller>index</controller>
</home>
</nav>
</root>
http://msdn.microsoft.com/en-us/library/ms256076.aspx