|
|
|
@ -10,10 +10,14 @@ import com.github.gwtbootstrap.client.ui.ControlGroup;
|
|
|
|
|
import com.github.gwtbootstrap.client.ui.TextArea;
|
|
|
|
|
import com.github.gwtbootstrap.client.ui.TextBox;
|
|
|
|
|
import com.google.gwt.core.client.GWT;
|
|
|
|
|
import com.google.gwt.dom.client.Text;
|
|
|
|
|
import com.google.gwt.event.dom.client.ClickEvent;
|
|
|
|
|
import com.google.gwt.event.dom.client.ClickHandler;
|
|
|
|
|
import com.google.gwt.uibinder.client.UiBinder;
|
|
|
|
|
import com.google.gwt.uibinder.client.UiField;
|
|
|
|
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
|
|
|
import com.google.gwt.user.client.ui.Composite;
|
|
|
|
|
import com.google.gwt.user.client.ui.HTML;
|
|
|
|
|
import com.google.gwt.user.client.ui.Widget;
|
|
|
|
|
|
|
|
|
|
public class DialogGetInfoBootstrap extends Composite {
|
|
|
|
@ -29,20 +33,22 @@ public class DialogGetInfoBootstrap extends Composite {
|
|
|
|
|
|
|
|
|
|
public static final String UNKNOWN = "unknown";
|
|
|
|
|
|
|
|
|
|
//@UiField
|
|
|
|
|
//TextBox txtName;
|
|
|
|
|
@UiField
|
|
|
|
|
TextBox txtName;
|
|
|
|
|
HTML txtName;
|
|
|
|
|
|
|
|
|
|
@UiField
|
|
|
|
|
TextBox txtId;
|
|
|
|
|
HTML txtId;
|
|
|
|
|
|
|
|
|
|
@UiField
|
|
|
|
|
TextBox txtLocation;
|
|
|
|
|
HTML txtLocation;
|
|
|
|
|
|
|
|
|
|
@UiField
|
|
|
|
|
ControlGroup cgTxtIsPublic;
|
|
|
|
|
|
|
|
|
|
@UiField
|
|
|
|
|
TextBox txtIsPublic;
|
|
|
|
|
HTML txtIsPublic;
|
|
|
|
|
|
|
|
|
|
@UiField
|
|
|
|
|
TextArea txtAreaDescription;
|
|
|
|
@ -67,19 +73,20 @@ public class DialogGetInfoBootstrap extends Composite {
|
|
|
|
|
|
|
|
|
|
public DialogGetInfoBootstrap(final FileModel fileModel) {
|
|
|
|
|
initWidget(uiBinder.createAndBindUi(this));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Setting name
|
|
|
|
|
textFieldSetValue(txtName, fileModel.getName());
|
|
|
|
|
textFieldSetValue(txtId, fileModel.getIdentifier());
|
|
|
|
|
htmlSetValue(txtName, fileModel.getName());
|
|
|
|
|
htmlSetValue(txtId, fileModel.getIdentifier());
|
|
|
|
|
|
|
|
|
|
if (fileModel.isRoot())
|
|
|
|
|
txtLocation.setValue("/");
|
|
|
|
|
txtLocation.setHTML("/");
|
|
|
|
|
else
|
|
|
|
|
loadLocation(fileModel.getIdentifier());
|
|
|
|
|
|
|
|
|
|
if (fileModel.isDirectory()) {
|
|
|
|
|
cgTxtIsPublic.setVisible(true);
|
|
|
|
|
txtIsPublic.setValue(fileModel.isPublic() + "");
|
|
|
|
|
txtIsPublic.setHTML(fileModel.isPublic() + "");
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* if (fileModel.getSynchedThreddsStatus() != null) { txtThreddsSynched = new
|
|
|
|
@ -99,32 +106,44 @@ public class DialogGetInfoBootstrap extends Composite {
|
|
|
|
|
} else
|
|
|
|
|
loadDescription(fileModel.getIdentifier());
|
|
|
|
|
|
|
|
|
|
addHandlers();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void addHandlers() {
|
|
|
|
|
txtAreaDescription.addClickHandler(new ClickHandler() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(ClickEvent event) {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void textFieldSetValue(TextBox field, String value) {
|
|
|
|
|
private void htmlSetValue(HTML field, String value) {
|
|
|
|
|
|
|
|
|
|
if (value == null || value.isEmpty())
|
|
|
|
|
field.setValue(UNKNOWN);
|
|
|
|
|
field.setHTML(UNKNOWN);
|
|
|
|
|
else
|
|
|
|
|
field.setValue(value);
|
|
|
|
|
field.setHTML(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void loadLocation(String itemId) {
|
|
|
|
|
|
|
|
|
|
txtLocation.setEnabled(false);
|
|
|
|
|
setPlaceholder(txtLocation, "loading...");
|
|
|
|
|
AppControllerExplorer.rpcWorkspaceService.getListParentsByItemIdentifier(itemId, false,
|
|
|
|
|
new AsyncCallback<List<FileModel>>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
GWT.log("failure get list parents by item identifier " + caught);
|
|
|
|
|
txtLocation.setValue(UNKNOWN);
|
|
|
|
|
txtLocation.setEnabled(false);
|
|
|
|
|
removePlaceHolder(txtLocation);
|
|
|
|
|
txtLocation.setHTML(UNKNOWN);
|
|
|
|
|
//txtLocation.set(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(List<FileModel> result) {
|
|
|
|
|
|
|
|
|
|
removePlaceHolder(txtLocation);
|
|
|
|
|
|
|
|
|
|
String location = "";
|
|
|
|
|
if (result != null) {
|
|
|
|
|
for (FileModel fileModel : result) {
|
|
|
|
@ -135,8 +154,7 @@ public class DialogGetInfoBootstrap extends Composite {
|
|
|
|
|
if (location.isEmpty())
|
|
|
|
|
location = "/";
|
|
|
|
|
|
|
|
|
|
txtLocation.setValue(location);
|
|
|
|
|
txtLocation.setEnabled(true);
|
|
|
|
|
txtLocation.setHTML(location);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -169,5 +187,17 @@ public class DialogGetInfoBootstrap extends Composite {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setPlaceholder(HTML html, String placeholder) {
|
|
|
|
|
html.setHTML(placeholder);
|
|
|
|
|
html.getElement().getStyle().setColor("#E8E8E8");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void removePlaceHolder(HTML html) {
|
|
|
|
|
html.setHTML("");
|
|
|
|
|
html.getElement().getStyle().setColor("#000");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|