use of com.agiletec.aps.system.services.page.widget.NavigatorExpression in project entando-core by entando.
the class TestNavigatorWidgetConfigAction method testExecuteRemoveExpression_2.
public void testExecuteRemoveExpression_2() throws Throwable {
Map<String, String> params = new HashMap<String, String>();
params.put("pageCode", "pagina_2");
params.put("frame", "0");
params.put("widgetTypeCode", "leftmenu");
params.put("navSpec", "parent.subtree(2)+abs(1).subtree(2)+current");
// INDICE SUPERIORE AL SIZE
params.put("expressionIndex", "3");
String result = this.executeRemoveExpression("admin", params);
assertEquals(Action.SUCCESS, result);
NavigatorWidgetConfigAction action = (NavigatorWidgetConfigAction) this.getAction();
Widget widget = action.getWidget();
assertNotNull(widget);
ApsProperties props = widget.getConfig();
assertEquals(1, props.size());
assertEquals("parent.subtree(2) + abs(1).subtree(2) + current", props.getProperty("navSpec"));
List<NavigatorExpression> expressions = action.getExpressions();
assertEquals(3, expressions.size());
NavigatorExpression expression2 = expressions.get(2);
assertEquals(NavigatorExpression.SPEC_CURRENT_PAGE_ID, expression2.getSpecId());
assertTrue(expression2.getOperatorId() < 0);
}
use of com.agiletec.aps.system.services.page.widget.NavigatorExpression in project entando-core by entando.
the class NavigatorWidgetConfigAction method createNewExpression.
/**
* Crea una nuova espressione in base ai parametri della richiesta corrente.
*
* @return La nuova espressione.
*/
protected NavigatorExpression createNewExpression() {
NavigatorExpression navExpression = new NavigatorExpression();
navExpression.setSpecId(this.getSpecId());
navExpression.setSpecAbsLevel(this.getSpecAbsLevel());
navExpression.setSpecCode(this.getSpecCode());
navExpression.setSpecSuperLevel(this.getSpecSuperLevel());
if (this.getOperatorId() > 0) {
navExpression.setOperatorId(this.getOperatorId());
navExpression.setOperatorSubtreeLevel(this.getOperatorSubtreeLevel());
}
return navExpression;
}
use of com.agiletec.aps.system.services.page.widget.NavigatorExpression in project entando-core by entando.
the class NavigatorWidgetConfigAction method executeMoveExpression.
/**
* Esegue il movimento richiesto sulla lista di espressioni specificata. Il
* tipo di movimento richiesto viene ricavato in base ai parametri della
* richiesta corrente.
*
* @param expressions La lista di espressioni nel quale eseguire il
* movimento richiesto.
*/
protected void executeMoveExpression(List<NavigatorExpression> expressions) {
int elementIndex = this.getExpressionIndex();
if (elementIndex < 0 || elementIndex >= expressions.size()) {
return;
}
String movement = this.getMovement();
if (!(elementIndex == 0 && movement.equals(ApsAdminSystemConstants.MOVEMENT_UP_CODE)) && !(elementIndex == expressions.size() - 1 && movement.equals(ApsAdminSystemConstants.MOVEMENT_DOWN_CODE))) {
NavigatorExpression elementToMove = expressions.get(elementIndex);
expressions.remove(elementIndex);
if (movement.equals(ApsAdminSystemConstants.MOVEMENT_UP_CODE)) {
expressions.add(elementIndex - 1, elementToMove);
}
if (movement.equals(ApsAdminSystemConstants.MOVEMENT_DOWN_CODE)) {
expressions.add(elementIndex + 1, elementToMove);
}
}
}
use of com.agiletec.aps.system.services.page.widget.NavigatorExpression in project entando-core by entando.
the class TestNavigatorExpression method testSetExpression_3.
public void testSetExpression_3() throws Throwable {
NavigatorExpression navExpr = new NavigatorExpression("current.path");
assertEquals(NavigatorExpression.SPEC_CURRENT_PAGE_ID, navExpr.getSpecId());
assertEquals(NavigatorExpression.OPERATOR_PATH_ID, navExpr.getOperatorId());
}
use of com.agiletec.aps.system.services.page.widget.NavigatorExpression in project entando-core by entando.
the class TestNavigatorExpression method testGetExpression_4.
public void testGetExpression_4() throws Throwable {
NavigatorExpression navExpr = new NavigatorExpression();
navExpr.setSpecId(NavigatorExpression.SPEC_PAGE_ID);
navExpr.setSpecCode("pagina_11");
navExpr.setOperatorId(NavigatorExpression.OPERATOR_PATH_ID);
String expression = navExpr.toString();
assertEquals("code(pagina_11).path", expression);
}
Aggregations