/** * Create a view action for a given cell. We need sometimes data from the cell. * * @param controller * @param actionsConfiguration * @param forModel * @param forcell * @return */ public static Node viewActions(AbstractViewController controller, VLViewComponentXML actionsConfiguration, OperationData forModel, Object forcell) { String orientation = actionsConfiguration.getPropertyValue("orientation", "horizontal"); if (forcell != null) { forModel.getMeta().put("sourceNode", forcell); } if (orientation.equals("horizontal")) { return horizontalViewActions(controller, actionsConfiguration, forModel); } else { return verticalViewActions(controller, actionsConfiguration, forModel); } }
/** * @{inheritedDoc} */ @SuppressWarnings("rawtypes") @Override public void buildFrom(IEmaginController controller, VLViewComponentXML configuration) { VLViewComponentXML handler = configuration.getComponentById("Handler").orElse(null); if (handler != null) { action = handler.getPropertyValue("action"); args = handler.getPropertyValue("args"); } // inital configured view (viewId) can be overrided by declaring // toViewId in the item model. if (getForModel().getMeta().get("sourceNode") != null) { AbstractListCell cell = (AbstractListCell) getForModel().getMeta().get("sourceNode"); OperationData data = (OperationData) cell.getItem(); if (data != null) { viewOverride = (String) data.getAttributes().get("viewId"); } } super.buildFrom(controller, configuration); }
/** * @{inheritedDoc} */ @SuppressWarnings("unchecked") @Override public void handle(MouseEvent event) { if (event.getClickCount() == 1) { List<VLViewComponentXML> sub = (List<VLViewComponentXML>) getForData().getMeta().get("subComponents"); boolean hassub = false; if (sub != null) { for (VLViewComponentXML s : sub) { if (s.getId().equals("Handler")) { hassub = true; getForData().getMeta().put("parentItem", this); ComponentToButtonBaseHelper.setButtonActions(controller, s, null, event, getForData()); } } } if (!hassub) { // forward to empty page PushStructureContentEvent ev = new PushStructureContentEvent.Builder().viewId("DemoEmptyPrefenceView").model(getForData()).build(); controller.dispatchEvent(ev); } } }
data.getMeta().put("subComponents", componentXML.getSubcomponents());
private void selectRadio(RadioButton radioButton, boolean goback) { Object v = isStaticValue ? radioButton.getUserData() : radioButton.selectedProperty().get(); List<IListFormValue> s = new ArrayList<>(); IListFormValue val = currentValues.get(0); val.setSavedValue(v); s.add(val); JsonObject query = new JsonObject(); query.addProperty("key", getKey()); query.addProperty("value", v != null ? v.toString() : ""); setPreferenceValueOperation.doOperation(query, res -> { processUpdate(s); if (goback) { SingleResult sr = (SingleResult) controller.getModel(); ParentItemPresenter parent = (ParentItemPresenter) sr.getData().getMeta().get("parentItem"); if (parent != null) { parent.updateDisplay(); } // call go back only if we are not in self mode and in desktop boolean desktopselfView = isSelfView(parent.getController()) && AbstractApplicationRunner.isDesktop(); if(!desktopselfView) NodeHelper.goBack(controller); if(desktopselfView) { StandardViewController c = (StandardViewController) parent.getController().getParent(); IViewLayoutManager m = c != null ? c.getLayoutManager() : null; if(m != null && m instanceof ViewForwardLayoutManager) { ((ViewForwardLayoutManager)m).popContent(); } } } }); }
OperationData data = model.getData(); List<EnumeratedValueModel> selectableValue = (List<EnumeratedValueModel>) data.getMeta().get("selectableValue"); List<IListFormValue> currentValues = (List<IListFormValue>) data.getMeta().get("currentValue"); PreferenceItemPresenterFactory presenterFactory = (PreferenceItemPresenterFactory) data.getMeta().get("presenter");
List<VLViewComponentXML> sub = (List<VLViewComponentXML>) ((OperationData) getCell().getItem()).getMeta().get("subComponents"); VLViewComponentXML conf = new VLViewComponentXML(); if (sub != null) {