package com.zaranux.os.client.programs;
import com.zaranux.client.api.AsyncCallback;
import com.zaranux.client.java.io.File;
import com.allen_sauer.gwt.log.client.Log;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
import com.zaranux.os.client.access.ACLComponent;
import com.zaranux.os.client.core.ComponentContainer;
import com.zaranux.os.client.core.Program;
public class Attributes extends Program implements ComponentContainer{
public Attributes(String[] args)
{
this.args = args;
}
@Override
protected void main(String[] args) {
// for now we process just the first argument
// TODO: go through all arguents and show their attributes in seperate tabs.
if(args.length < 1) return;
File[] files = new File[1];
files[0] = new File(args[0]);
final ACLComponent aclComponent = new ACLComponent(files,this);
IButton saveButton = new IButton("Save");
//saveButton.setLeft(300);
saveButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
Log.error("saveButton");
aclComponent.save(new AsyncCallback<Boolean>()
{
public void onSuccess(Boolean b)
{
if(b)
setStatus("Access Control List is saved.");
else
setStatus("Unable to save Access Control List.");
}
public void onFailure(Throwable t)
{
setStatus("Failed to save Access Control List.");
Log.error("Failed to save Access Control List. : " + t);
}
});
}
});
HLayout hLayout = new HLayout();
hLayout.setMembersMargin(5);
hLayout.addMember(saveButton);
//hLayout.setAlign(Alignment.CENTER);
VLayout vLayout = new VLayout();
vLayout.setLayoutMargin(0);
vLayout.setMembersMargin(0);
vLayout.setAutoHeight();
vLayout.setAutoWidth();
//aclComponent.getWidget().setWidth("100%");
//aclComponent.getWidget().setHeight("100%");
vLayout.addMember(aclComponent.getWidget());
vLayout.addMember(hLayout);
setWidget(vLayout,350,200);
//vLayout.setWidth100();
//vLayout.setHeight100();
}
// do not do anything
public void run(Program program)
{
}
}