building the Get Info...

This commit is contained in:
Francesco Mangiacrapa 2020-07-10 12:55:36 +02:00
parent 0a1e418d13
commit 98b5ae5fd7
4 changed files with 110 additions and 33 deletions

View File

@ -719,6 +719,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
DialogGetInfoBootstrap dlg = new DialogGetInfoBootstrap(fileItem); DialogGetInfoBootstrap dlg = new DialogGetInfoBootstrap(fileItem);
modal.add(dlg); modal.add(dlg);
modal.add(modalFooter);
modal.show(); modal.show();
} }
} }

View File

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

View File

@ -42,6 +42,15 @@
.no-border { .no-border {
border: 0px; border: 0px;
} }
.html-value-style {
padding-top: 5px;
font-family: Arial, Helvetica, sans-serif;
}
.label-style {
color: gray;
}
</ui:style> </ui:style>
<g:HTMLPanel> <g:HTMLPanel>
<b:Form type="HORIZONTAL"> <b:Form type="HORIZONTAL">
@ -51,39 +60,45 @@
</b:Alert> </b:Alert>
<b:Fieldset ui:field="fieldSetGetInfo" <b:Fieldset ui:field="fieldSetGetInfo"
styleName="{style.noBorder}"> styleName="{style.noBorder}">
<b:ControlGroup addStyleNames="my-control-group"> <b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Name</b:ControlLabel> <b:ControlLabel>Name</b:ControlLabel>
<b:Controls> <b:Controls>
<b:TextBox ui:field="txtName" readOnly="true"> <g:HTML ui:field="txtName">
</b:TextBox> </g:HTML>
</b:Controls> </b:Controls>
</b:ControlGroup> </b:ControlGroup>
<b:ControlGroup addStyleNames="my-control-group"> <b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Id</b:ControlLabel> <b:ControlLabel>Id</b:ControlLabel>
<b:Controls> <b:Controls>
<b:TextBox ui:field="txtId" readOnly="true"> <g:HTML ui:field="txtId">
</b:TextBox> </g:HTML>
</b:Controls> </b:Controls>
</b:ControlGroup> </b:ControlGroup>
<b:ControlGroup addStyleNames="my-control-group"> <b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Location</b:ControlLabel> <b:ControlLabel>Location</b:ControlLabel>
<b:Controls> <b:Controls>
<b:TextBox ui:field="txtLocation" readOnly="true"> <g:HTML ui:field="txtLocation">
</b:TextBox> </g:HTML>
</b:Controls> </b:Controls>
</b:ControlGroup> </b:ControlGroup>
<b:ControlGroup addStyleNames="my-control-group" <b:ControlGroup
ui:field="cgTxtIsPublic" visible="false"> addStyleNames="my-control-group-get-info" ui:field="cgTxtIsPublic"
visible="false">
<b:ControlLabel>Public Folder</b:ControlLabel> <b:ControlLabel>Public Folder</b:ControlLabel>
<b:Controls> <b:Controls>
<b:TextBox ui:field="txtIsPublic" readOnly="true"> <g:HTML ui:field="txtIsPublic">
</b:TextBox> </g:HTML>
</b:Controls> </b:Controls>
</b:ControlGroup> </b:ControlGroup>
<b:ControlGroup addStyleNames="my-control-group"> <b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Description</b:ControlLabel> <b:ControlLabel>Description</b:ControlLabel>
<b:Controls> <b:Controls>
<b:TextArea ui:field="txtAreaDescription" readOnly="true"> <b:TextArea ui:field="txtAreaDescription"
readOnly="true">
</b:TextArea> </b:TextArea>
</b:Controls> </b:Controls>
</b:ControlGroup> </b:ControlGroup>

View File

@ -300,4 +300,35 @@ table.userssuggest th {
cursor: default; cursor: default;
color: gray !important; color: gray !important;
text-decoration: none; text-decoration: none;
} }
.my-control-group-get-info{
margin-bottom: 10px !important;
font-size: 14px !important;
font-family: Arial, serif;
}
.my-control-group-get-info .controls{
margin-left: 70px !important;
}
.my-control-group-get-info .control-label {
width: 80px !important;
text-align: center !important;
padding-right: 10px !important;
color: #5f6368;
}
.my-control-group-get-info .add-on{
width: 20px !important;
}
.my-control-group-get-info .gwt-HTML {
padding-top: 5px;
font-family: Roboto, Arial, serif !important;
}
.my-control-group-get-info .gwt-TextBox:hover {
cursor: text !important;
}