enhancement on legend and styles
This commit is contained in:
parent
05e0026c10
commit
e1ec07b807
|
@ -21,6 +21,8 @@
|
|||
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' />
|
||||
|
||||
<stylesheet src='MetadataProfileFormBuilder.css' />
|
||||
|
||||
|
||||
<!-- Other module inherits -->
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CustomFieldEn
|
|||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.MetaDataFieldSkeleton;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.resources.AddResourceToDataset;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection.TwinColumnSelectionMainPanel;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.CustomLegend;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.InfoIconsLabels;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.LoaderIcon;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.OrganizationBean;
|
||||
|
@ -30,6 +31,7 @@ import com.github.gwtbootstrap.client.ui.Button;
|
|||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||
import com.github.gwtbootstrap.client.ui.Form;
|
||||
import com.github.gwtbootstrap.client.ui.Icon;
|
||||
import com.github.gwtbootstrap.client.ui.Legend;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
import com.github.gwtbootstrap.client.ui.Popover;
|
||||
|
@ -149,6 +151,8 @@ public class CreateMetadataForm extends Composite{
|
|||
/** The metadata types control group. */
|
||||
@UiField ControlGroup metadataTypesControlGroup;
|
||||
|
||||
@UiField CustomLegend customLegend;
|
||||
|
||||
/** The form builder service. */
|
||||
private final MetadataProfileFormBuilderServiceAsync formBuilderService = GWT.create(MetadataProfileFormBuilderService.class);
|
||||
|
||||
|
@ -265,6 +269,17 @@ public class CreateMetadataForm extends Composite{
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Show choose profile form.
|
||||
*
|
||||
* @param bool the bool
|
||||
*/
|
||||
private void showChooseProfileForm(boolean bool) {
|
||||
formFirstStep.setVisible(bool);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new creates the dataset form.
|
||||
*
|
||||
|
@ -276,6 +291,7 @@ public class CreateMetadataForm extends Composite{
|
|||
bind();
|
||||
prepareInfoIcons();
|
||||
showSelectedProfiles(false);
|
||||
showChooseProfileForm(false);
|
||||
showCustomFieldsEntries(false);
|
||||
}
|
||||
|
||||
|
@ -348,6 +364,10 @@ public class CreateMetadataForm extends Composite{
|
|||
private void prepareMetadataList(final List<MetaDataProfileBean> profiles) {
|
||||
|
||||
if(profiles != null && !profiles.isEmpty()){
|
||||
|
||||
if(profiles.size()>1)
|
||||
showChooseProfileForm(true);
|
||||
|
||||
for(MetaDataProfileBean metadataBean: profiles){
|
||||
metadataTypeListbox.addItem(metadataBean.getType());
|
||||
}
|
||||
|
@ -363,12 +383,14 @@ public class CreateMetadataForm extends Composite{
|
|||
metadataFieldsPanel.clear();
|
||||
if(selectedItemText.equals(NONE_PROFILE)){
|
||||
metadataFieldsPanel.setVisible(false);
|
||||
formThirdStep.setVisible(false);
|
||||
selectedProfile.setText("Selected Profile is " + NONE_PROFILE);
|
||||
//receivedBean.setChosenType(null);
|
||||
}else{
|
||||
//receivedBean.setChosenType(selectedItemText);
|
||||
showLoadingProfileInformation(true);
|
||||
formThirdStep.setVisible(true);
|
||||
customLegend.setText("Insert Information for: "+metadataTypeListbox.getSelectedItemText(), true);
|
||||
selectedProfile.setText("Selected Profile is " + metadataTypeListbox.getSelectedItemText());
|
||||
addFields(selectedItemText, profiles);
|
||||
showLoadingProfileInformation(false);
|
||||
|
@ -389,7 +411,9 @@ public class CreateMetadataForm extends Composite{
|
|||
@Override
|
||||
public void execute() {
|
||||
if(profiles.size()==1) {
|
||||
showChooseProfileForm(false);
|
||||
metadataTypeListbox.setSelectedValue(profiles.get(0).getType());
|
||||
customLegend.setText("Insert Information for: "+profiles.get(0).getType(), true);
|
||||
DomEvent.fireNativeEvent(Document.get().createChangeEvent(), metadataTypeListbox);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,11 +52,10 @@
|
|||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel ui:field="createDatasetMainPanel">
|
||||
<u:LoaderIcon ui:field="loaderProfiles" visible="false"></u:LoaderIcon>
|
||||
<b:Form type="HORIZONTAL" styleName="{style.form-main-style}"
|
||||
ui:field="formFirstStep" visible="true">
|
||||
|
||||
<u:LoaderIcon ui:field="loaderProfiles" visible="false"></u:LoaderIcon>
|
||||
|
||||
|
||||
<b:Fieldset styleName="{style.fieldset-border-style}">
|
||||
<b:Legend styleName="{style.legend-style}">
|
||||
Choose a Profile
|
||||
|
@ -113,13 +112,22 @@
|
|||
<b:Form type="HORIZONTAL" styleName="{style.form-main-style}"
|
||||
ui:field="formThirdStep" visible="false">
|
||||
<b:Fieldset styleName="{style.fieldset-border-style}">
|
||||
<b:Legend styleName="{style.legend-style}">
|
||||
<!-- <b:Legend styleName="{style.legend-style}" -->
|
||||
<!-- ui:field="legendInsertInformation"> -->
|
||||
<!-- Insert Information -->
|
||||
<!-- <small> -->
|
||||
<!-- <span style="color:red;">*</span> -->
|
||||
<!-- is required -->
|
||||
<!-- </small> -->
|
||||
<!-- </b:Legend> -->
|
||||
|
||||
<u:CustomLegend ui:field="customLegend">
|
||||
Insert Information
|
||||
<small>
|
||||
<span style="color:red;">*</span>
|
||||
is required
|
||||
</small>
|
||||
</b:Legend>
|
||||
</u:CustomLegend>
|
||||
|
||||
<b:Paragraph ui:field="selectedProfile"
|
||||
styleName="{style.selected-profile}"></b:Paragraph>
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
package org.gcube.portlets.widgets.mpformbuilder.client.ui.utils;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Legend;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
|
||||
|
||||
/**
|
||||
* The Class CustomLegend.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Oct 8, 2020
|
||||
*/
|
||||
public class CustomLegend extends Legend {
|
||||
|
||||
public CustomLegend() {
|
||||
this.addStyleName("legend-style");
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new custom legend.
|
||||
*
|
||||
* @param text the text
|
||||
* @param addIsRequiredTxt the add is required txt
|
||||
*/
|
||||
public CustomLegend(String text, boolean addIsRequiredTxt) {
|
||||
this();
|
||||
setText(text, addIsRequiredTxt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new custom legend.
|
||||
*
|
||||
* @param text the text
|
||||
* @param addIsRequiredTxt the add is required txt
|
||||
*/
|
||||
public CustomLegend(String html) {
|
||||
this();
|
||||
HTML toHMTL = new HTML(html);
|
||||
this.add(toHMTL);
|
||||
}
|
||||
|
||||
|
||||
public void setText(String text, boolean addIsRequiredTxt){
|
||||
this.clear();
|
||||
|
||||
String htmlToAdd = text;
|
||||
if (addIsRequiredTxt)
|
||||
htmlToAdd += "<small><span style='color:red;'> *</span> is required</small>";
|
||||
|
||||
HTML toHMTL = new HTML(htmlToAdd);
|
||||
|
||||
this.add(toHMTL);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
/** Add css rules here for your application. */
|
||||
/** Example rules used by the template application (remove for your app) */
|
||||
|
||||
.legend-style {
|
||||
width: auto;
|
||||
padding: 10px;
|
||||
margin-bottom: 0px;
|
||||
}
|
|
@ -21,14 +21,15 @@
|
|||
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' />
|
||||
|
||||
<stylesheet src='MetadataProfileFormBuilder.css' />
|
||||
|
||||
|
||||
<!-- Other module inherits -->
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
|
||||
<entry-point
|
||||
class='org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilder' />
|
||||
<!-- <entry-point class='org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilder' /> -->
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package org.gcube.portlets.widgets.mpformbuilder;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderServiceAsync;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
||||
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
public class UseCases {
|
||||
|
||||
String scope = "/gcube/devsec/devVRE";
|
||||
String secondaryType = "GeoNaMetadata";
|
||||
private final HandlerManager eventBus = new HandlerManager(null);
|
||||
|
||||
public UseCases() {
|
||||
|
||||
method1();
|
||||
|
||||
method2();
|
||||
}
|
||||
|
||||
private void method2() {
|
||||
|
||||
MetadataProfileFormBuilderServiceAsync.Util.getInstance().getProfilesInTheScope(scope, secondaryType, new AsyncCallback<List<MetaDataProfileBean>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<MetaDataProfileBean> result) {
|
||||
|
||||
for (MetaDataProfileBean metaDataProfileBean : result) {
|
||||
CreateMetadataForm baseForm = new CreateMetadataForm(Arrays.asList(metaDataProfileBean), eventBus);
|
||||
//TODO
|
||||
//ADD this to main panel
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void method1() {
|
||||
|
||||
//TODO
|
||||
//ADD this to main panel
|
||||
CreateMetadataForm baseForm = new CreateMetadataForm(scope, secondaryType, eventBus);
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue