Skip to content

Commit

Permalink
KAA-1146: quick fix for Admin UI.
Browse files Browse the repository at this point in the history
  • Loading branch information
vchizhevsky committed Sep 2, 2016
1 parent 7b4dd0c commit e3cb430
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 5 deletions.
Expand Up @@ -248,7 +248,7 @@ public void onClick(ClickEvent event) {
newPlace = new CtlSchemaPlace(place.getMetaInfoId(), version, place.getScope(), place.getApplicationId(), true, true);
} else if (place.getScope() == CTLSchemaScopeDto.TENANT) {
newPlace = new CtlSchemaPlace(place.getMetaInfoId(), version, place.getScope(),
place.getEcfId(), place.getEcfVersionId(), place.getEcfVersion(), true, false);
place.getEcfId(), place.getEcfVersionId(), place.getEcfVersion(), true, true);
}
newPlace.setPreviousPlace(place);
goTo(newPlace);
Expand Down
Expand Up @@ -55,6 +55,16 @@ public EcfVersionActivity(EcfVersionPlace place, ClientFactory clientFactory) {
this.ecfVersionId = place.getEcfVersionId();
initListView();
this.listView.setPresenter(this);
setEnabledForAddButton();
}

private void setEnabledForAddButton() {
listView.addButton().setEnabled(false);
if (place.getEventClassDtoList() != null) {
if (!place.getEventClassDtoList().isEmpty()) {
listView.addButton().setEnabled(true);
}
}
}

private void initListView() {
Expand Down
Expand Up @@ -69,7 +69,7 @@ public void onSuccess(List<EventClassDto> result) {
EventClassDto eventClassDto = eventClassViewDto.getSchema();
eventClassDto.setCtlSchemaId(ctlSchemaMetaInfoDto.getId());
eventClassDto.setCreatedTime(System.currentTimeMillis());
eventClassDto.setVersion(i);
eventClassDto.setVersion(ctlSchemaMetaInfoDto.getVersions().get(ctlSchemaMetaInfoDto.getVersions().size()-1));
eventClassDto.setId(String.valueOf(i++));
eventClassDtoList.add(eventClassDto);
}
Expand Down
Expand Up @@ -52,7 +52,7 @@ interface BaseListViewImplUiBinder extends UiBinder<Widget, BaseListViewImpl<?>>
@UiField public Label titleLabel;
@UiField public HorizontalPanel buttonsPanel;
@UiField public HorizontalPanel supportPanel;
@UiField (provided=true) public final ImageTextButton addButton;
@UiField (provided=true) public ImageTextButton addButton;
@UiField (provided=true) public final AlertPanel errorPanel;
@UiField (provided=true) public final KaaAdminStyle kaaAdminStyle;
@UiField (provided=true) public final AvroUiStyle avroUiStyle;
Expand All @@ -65,7 +65,7 @@ interface BaseListViewImplUiBinder extends UiBinder<Widget, BaseListViewImpl<?>>

public BaseListViewImpl(boolean editable) {
this.editable = editable;
addButton = new ImageTextButton(Utils.resources.plus(), addButtonString());
initAddButton();
errorPanel = new AlertPanel(Type.ERROR);
kaaAdminStyle = Utils.kaaAdminStyle;
avroUiStyle = Utils.avroUiStyle;
Expand All @@ -81,6 +81,10 @@ public BaseListViewImpl(boolean editable) {

clearError();
}

protected void initAddButton(){
addButton = new ImageTextButton(Utils.resources.plus(), addButtonString());
}

protected void appendToolbarWidget(Widget widget) {
buttonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
Expand Down
Expand Up @@ -41,6 +41,11 @@ public EcfVersionViewImpl(boolean editable) {
supportPanel.add(addECButton);
}

@Override
protected void initAddButton() {
addButton = new ImageTextButton(null, addButtonString());
}

@Override
protected AbstractGrid<EventClassDto, String> createGrid() {
return new EcfVersionGrid();
Expand Down
Expand Up @@ -79,4 +79,13 @@ protected boolean validate() {
result &= eventClassTypeName.getValue().length() > 0;
return result;
}

@Override
protected void updateSaveButton(boolean enabled, boolean invalid) {
if(create == true) {
super.updateSaveButton(enabled, invalid);
} else {
getSaveButtonWidget().setEnabled(false);
}
}
}
Expand Up @@ -50,7 +50,9 @@ public ImageTextButton(ImageResource imageResource, String text, ClickHandler cl
spacing = 16;
}

updateImageElementFromImageResource(imageSpan, imageResource, spacing);
if(imageResource != null) {
updateImageElementFromImageResource(imageSpan, imageResource, spacing);
}
DOM.insertBefore(getElement(), imageSpan, DOM.getFirstChild(getElement()));
}

Expand Down

0 comments on commit e3cb430

Please sign in to comment.