Search in sources :

Example 1 with TemplateParam

use of org.guvnor.ala.ui.openshift.model.TemplateParam in project kie-wb-common by kiegroup.

the class OpenShiftClientServiceImpl method getTemplateModel.

@Override
public TemplateDescriptorModel getTemplateModel(final String url) {
    checkNotNull("url", url);
    OpenShiftTemplate template = new OpenShiftTemplate(url);
    List<TemplateParam> params = buildTemplateParams(template);
    final TemplateDescriptorModel descriptorModel = new TemplateDescriptorModel(params);
    return descriptorModel;
}
Also used : TemplateDescriptorModel(org.guvnor.ala.ui.openshift.model.TemplateDescriptorModel) OpenShiftTemplate(org.guvnor.ala.openshift.access.OpenShiftTemplate) TemplateParam(org.guvnor.ala.ui.openshift.model.TemplateParam)

Example 2 with TemplateParam

use of org.guvnor.ala.ui.openshift.model.TemplateParam in project kie-wb-common by kiegroup.

the class TemplateParamsTableView method addParamValueColumn.

private void addParamValueColumn() {
    final Column<TemplateParam, String> column = new Column<TemplateParam, String>(new EditTextCell()) {

        @Override
        public String getValue(TemplateParam templateParam) {
            if (templateParam.getValue() != null) {
                return templateParam.getValue();
            } else {
                return EMPTY_STRING;
            }
        }
    };
    column.setFieldUpdater(new ParamValueFieldUpdater((EditTextCell) column.getCell()));
    dataGrid.addColumn(column, translationService.getTranslation(TemplateParamsTableView_ParamValueColumn));
    dataGrid.setColumnWidth(column, 55, Style.Unit.PCT);
}
Also used : EditTextCell(com.google.gwt.cell.client.EditTextCell) TemplateParamsTableView_ParamNameColumn(org.guvnor.ala.ui.openshift.client.resources.i18n.GuvnorAlaOpenShiftUIConstants.TemplateParamsTableView_ParamNameColumn) TemplateParamsTableView_ParamValueColumn(org.guvnor.ala.ui.openshift.client.resources.i18n.GuvnorAlaOpenShiftUIConstants.TemplateParamsTableView_ParamValueColumn) TemplateParamsTableView_ParamRequiredColumn(org.guvnor.ala.ui.openshift.client.resources.i18n.GuvnorAlaOpenShiftUIConstants.TemplateParamsTableView_ParamRequiredColumn) Column(com.google.gwt.user.cellview.client.Column) TemplateParam(org.guvnor.ala.ui.openshift.model.TemplateParam)

Example 3 with TemplateParam

use of org.guvnor.ala.ui.openshift.model.TemplateParam in project kie-wb-common by kiegroup.

the class TemplateParamsTableView method addParamRequiredColumn.

private void addParamRequiredColumn() {
    Column<TemplateParam, String> column = new Column<TemplateParam, String>(new TextCell()) {

        @Override
        public String getValue(TemplateParam templateParam) {
            return templateParam.isRequired() ? "*" : "";
        }
    };
    dataGrid.addColumn(column, " ");
    dataGrid.setColumnWidth(column, 30, Style.Unit.PX);
}
Also used : TemplateParamsTableView_ParamNameColumn(org.guvnor.ala.ui.openshift.client.resources.i18n.GuvnorAlaOpenShiftUIConstants.TemplateParamsTableView_ParamNameColumn) TemplateParamsTableView_ParamValueColumn(org.guvnor.ala.ui.openshift.client.resources.i18n.GuvnorAlaOpenShiftUIConstants.TemplateParamsTableView_ParamValueColumn) TemplateParamsTableView_ParamRequiredColumn(org.guvnor.ala.ui.openshift.client.resources.i18n.GuvnorAlaOpenShiftUIConstants.TemplateParamsTableView_ParamRequiredColumn) Column(com.google.gwt.user.cellview.client.Column) TemplateParam(org.guvnor.ala.ui.openshift.model.TemplateParam) TextCell(com.google.gwt.cell.client.TextCell) EditTextCell(com.google.gwt.cell.client.EditTextCell)

Example 4 with TemplateParam

use of org.guvnor.ala.ui.openshift.model.TemplateParam in project kie-wb-common by kiegroup.

the class TemplateParamsFormPresenterTest method initializeParams.

private void initializeParams() {
    requiredTemplateParams = mockParams("required", REQUIRED_TEMPLATE_PARAMS_COUNT, true);
    nonRequiredTemplateParams = mockParams("nonRequired", NON_REQUIRED_TEMPLATE_PARAMS_COUNT, false);
    // add the banned parameters
    bannedTemplateParams = new ArrayList<>();
    bannedTemplateParams.add(new TemplateParam(IMAGE_STREAM_NAMESPACE_TEMPLATE_PARAM, null, null, true, null));
    bannedTemplateParams.add(new TemplateParam(APPLICATION_NAME_TEMPLATE_PARAM, null, null, true, null));
    allTemplateParams = new ArrayList<>();
    allTemplateParams.addAll(requiredTemplateParams);
    allTemplateParams.addAll(nonRequiredTemplateParams);
    allTemplateParams.addAll(bannedTemplateParams);
    // the banned parameters are not shown in the ui
    managedTemplateParams = new ArrayList<>();
    managedTemplateParams.addAll(requiredTemplateParams);
    managedTemplateParams.addAll(nonRequiredTemplateParams);
}
Also used : TemplateParam(org.guvnor.ala.ui.openshift.model.TemplateParam)

Example 5 with TemplateParam

use of org.guvnor.ala.ui.openshift.model.TemplateParam in project kie-wb-common by kiegroup.

the class OpenShiftClientServiceImplTest method testGetTemplateModel.

@Test
public void testGetTemplateModel() throws Exception {
    String url = getClass().getClassLoader().getResource(TEMPLATE).toString();
    TemplateDescriptorModel model = service.getTemplateModel(url);
    List<TemplateParam> expectedParams = buildExpectedParams(PARAMS_COUNT);
    assertEquals(expectedParams, model.getParams());
}
Also used : TemplateDescriptorModel(org.guvnor.ala.ui.openshift.model.TemplateDescriptorModel) TemplateParam(org.guvnor.ala.ui.openshift.model.TemplateParam) Test(org.junit.Test)

Aggregations

TemplateParam (org.guvnor.ala.ui.openshift.model.TemplateParam)7 EditTextCell (com.google.gwt.cell.client.EditTextCell)3 Column (com.google.gwt.user.cellview.client.Column)3 TemplateParamsTableView_ParamNameColumn (org.guvnor.ala.ui.openshift.client.resources.i18n.GuvnorAlaOpenShiftUIConstants.TemplateParamsTableView_ParamNameColumn)3 TemplateParamsTableView_ParamRequiredColumn (org.guvnor.ala.ui.openshift.client.resources.i18n.GuvnorAlaOpenShiftUIConstants.TemplateParamsTableView_ParamRequiredColumn)3 TemplateParamsTableView_ParamValueColumn (org.guvnor.ala.ui.openshift.client.resources.i18n.GuvnorAlaOpenShiftUIConstants.TemplateParamsTableView_ParamValueColumn)3 TextCell (com.google.gwt.cell.client.TextCell)2 TemplateDescriptorModel (org.guvnor.ala.ui.openshift.model.TemplateDescriptorModel)2 ArrayList (java.util.ArrayList)1 OpenShiftTemplate (org.guvnor.ala.openshift.access.OpenShiftTemplate)1 Test (org.junit.Test)1