Skip to content

Commit

Permalink
KAA-1096: Remove 'Download configuration' button from Profile filter …
Browse files Browse the repository at this point in the history
…in Admin UI
  • Loading branch information
vchizhevsky committed May 27, 2016
1 parent 17a7b6a commit 3dacb6b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 16 deletions.
Expand Up @@ -73,13 +73,12 @@ public abstract class BaseStructView<T extends AbstractStructureDto, V> extends
private Button saveButton; private Button saveButton;
private Button activateButton; private Button activateButton;
private Button deactivateButton; private Button deactivateButton;
private Button downloadConfigurationButton;


private boolean active; private boolean active;


private Label bodyLabel; private Label bodyLabel;


private HorizontalPanel buttonsPanel; protected HorizontalPanel buttonsPanel;


protected List<HandlerRegistration> registrations = new ArrayList<HandlerRegistration>(); protected List<HandlerRegistration> registrations = new ArrayList<HandlerRegistration>();


Expand All @@ -88,7 +87,7 @@ public BaseStructView(HasErrorMessage hasErrorMessage) {
init(); init();
} }


private void init() { protected void init() {


getColumnFormatter().setWidth(0, "400px"); getColumnFormatter().setWidth(0, "400px");
getColumnFormatter().setWidth(1, "400px"); getColumnFormatter().setWidth(1, "400px");
Expand Down Expand Up @@ -208,11 +207,9 @@ private void init() {
saveButton = new Button(Utils.constants.save()); saveButton = new Button(Utils.constants.save());
activateButton = new Button(Utils.constants.activate()); activateButton = new Button(Utils.constants.activate());
deactivateButton = new Button(Utils.constants.deactivate()); deactivateButton = new Button(Utils.constants.deactivate());
downloadConfigurationButton = new Button(Utils.constants.downloadConfiguration());
buttonsPanel.add(saveButton); buttonsPanel.add(saveButton);
buttonsPanel.add(activateButton); buttonsPanel.add(activateButton);
buttonsPanel.add(deactivateButton); buttonsPanel.add(deactivateButton);
buttonsPanel.add(downloadConfigurationButton);


description.setFocus(true); description.setFocus(true);


Expand All @@ -222,16 +219,6 @@ public void onClick(ClickEvent event) {
updateSaveButton(false, false); updateSaveButton(false, false);
} }
}); });

downloadConfigurationButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
String url = Window.Location.getHref();
Window.open("/kaaAdmin/servlet/kaaConfigurationDownloadServlet?schemaId=" + Utils.getSchemaIdFromUrl(url) +
"&endGroupId=" + Utils.getEndpointGroupIdFromUrl(url),
"_blank", "status=0,toolbar=0,menubar=0,location=0");
}
});
} }


protected void prependButton(Button button) { protected void prependButton(Button button) {
Expand Down
Expand Up @@ -16,7 +16,12 @@


package org.kaaproject.kaa.server.admin.client.mvp.view.struct; package org.kaaproject.kaa.server.admin.client.mvp.view.struct;


import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import org.kaaproject.avro.ui.shared.RecordField; import org.kaaproject.avro.ui.shared.RecordField;
import org.kaaproject.kaa.common.dto.UpdateStatus;
import org.kaaproject.kaa.server.admin.client.mvp.view.widget.RecordPanel; import org.kaaproject.kaa.server.admin.client.mvp.view.widget.RecordPanel;
import org.kaaproject.kaa.server.admin.client.util.HasErrorMessage; import org.kaaproject.kaa.server.admin.client.util.HasErrorMessage;
import org.kaaproject.kaa.server.admin.client.util.Utils; import org.kaaproject.kaa.server.admin.client.util.Utils;
Expand All @@ -29,6 +34,8 @@


public class ConfigFormStructView extends BaseStructView<ConfigurationRecordFormDto, RecordField> { public class ConfigFormStructView extends BaseStructView<ConfigurationRecordFormDto, RecordField> {


private Button downloadConfigurationButton;

public ConfigFormStructView(HasErrorMessage hasErrorMessage) { public ConfigFormStructView(HasErrorMessage hasErrorMessage) {
super(hasErrorMessage); super(hasErrorMessage);
} }
Expand Down Expand Up @@ -66,6 +73,38 @@ public void onValueChange(ValueChangeEvent<RecordField> event) {
}); });
} }


@Override
protected void init() {
super.init();
downloadConfigurationButton = new Button(Utils.constants.downloadConfiguration());

buttonsPanel.add(downloadConfigurationButton);

downloadConfigurationButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
String url = Window.Location.getHref();
Window.open("/kaaAdmin/servlet/kaaConfigurationDownloadServlet?schemaId=" + Utils.getSchemaIdFromUrl(url) +
"&endGroupId=" + Utils.getEndpointGroupIdFromUrl(url),
"_blank", "status=0,toolbar=0,menubar=0,location=0");
}
});
}

@Override
public void reset() {
super.reset();
downloadConfigurationButton.setVisible(false);
}

@Override
public void setData(ConfigurationRecordFormDto struct) {
super.setData(struct);
if (struct.getStatus()==UpdateStatus.ACTIVE) {
downloadConfigurationButton.setVisible(true);
}
}

@Override @Override
protected boolean validateBody() { protected boolean validateBody() {
return ((RecordPanel)body).validate(); return ((RecordPanel)body).validate();
Expand Down
Expand Up @@ -171,7 +171,7 @@ deactivate = Deactivate


deactivatedBy = Deactivated by deactivatedBy = Deactivated by


downloadConfiguration = Download configuration downloadConfiguration = Download


deep = Deep deep = Deep


Expand Down

0 comments on commit 3dacb6b

Please sign in to comment.