2099: Workspace Explorer enhancements: create a new folder

Task-Url: https://support.d4science.org/issues/2099

Completed form to create a new folder

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@122723 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-02-02 11:42:40 +00:00
parent 5b2c2d1a88
commit a0ee5e2416
17 changed files with 209 additions and 173 deletions

12
pom.xml
View File

@ -54,12 +54,12 @@
<dependencies>
<!-- <dependency> -->
<!-- <groupId>xerces</groupId> -->
<!-- <artifactId>xerces</artifactId> -->
<!-- <version>2.4.0</version> -->
<!-- <scope>compile</scope> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>xerces</groupId> -->
<!-- <artifactId>xerces</artifactId> -->
<!-- <version>2.4.0</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<!-- Google Web Toolkit (GWT) -->
<dependency>

View File

@ -222,6 +222,7 @@ public class WorkspaceExplorerController implements EventHandler {
};
workspaceExplorerPanel.getSouthPanel().add(createFolder);
createFolder.getTextBoxFolderName().setFocus(true);
}
});

View File

@ -11,6 +11,7 @@
display: inline-block;
vertical-align: middle;
margin-bottom: 3px;
margin-right: 2px;
}
/* Our sample icon */
@ -19,6 +20,7 @@
display: inline-block;
vertical-align: middle;
margin-bottom: 3px;
margin-right: 2px;
}
@sprite .myBaseIcon_new_folder {
@ -26,4 +28,5 @@
display: inline-block;
vertical-align: middle;
margin-bottom: 3px;
margin-right: 2px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 B

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 430 B

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -5,20 +5,20 @@ package org.gcube.portlets.widgets.wsexplorer.client.view;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.ControlGroup;
import com.github.gwtbootstrap.client.ui.ControlLabel;
import com.github.gwtbootstrap.client.ui.FluidRow;
import com.github.gwtbootstrap.client.ui.Form;
import com.github.gwtbootstrap.client.ui.TextBox;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Widget;
@ -36,6 +36,9 @@ public abstract class CreateFolderForm extends Composite {
@UiField
Button close_dialog;
@UiField
ControlLabel control_label;
@UiField
Button submit_create_folder;
@ -45,12 +48,6 @@ public abstract class CreateFolderForm extends Composite {
@UiField
Form form_create_folder;
@UiField
ControlGroup input_folder_name_group;
@UiField
HorizontalPanel hp_form_actions;
private Alert alertError = new Alert("Required Field");
private Alert alertSubmitResult = new Alert("");
@ -86,6 +83,11 @@ public abstract class CreateFolderForm extends Composite {
*/
public CreateFolderForm() {
initWidget(uiBinder.createAndBindUi(this));
control_label.addStyleName("margin-right-5px");
input_folder_name.addStyleName("margin-right-5px");
input_folder_name.addStyleName("gwt-TextBox-personal");
submit_create_folder.addStyleName("margin-right-5px");
// setSize(width+"px", "200px");
// input_folder_name.setWidth(width-10+"px");
@ -102,6 +104,19 @@ public abstract class CreateFolderForm extends Composite {
}
});
input_folder_name.addKeyDownHandler(new KeyDownHandler() {
@Override
public void onKeyDown(KeyDownEvent event) {
if(event.getNativeKeyCode() == KeyCodes.KEY_ENTER){
if(validateForm()){
subtmitHandler(input_folder_name.getValue());
}
}
}
});
submit_create_folder.addClickHandler(new ClickHandler() {
@Override
@ -124,7 +139,7 @@ public abstract class CreateFolderForm extends Composite {
alertSubmitResult.setVisible(false);
alertSubmitResult.setClose(false);
hp_form_actions.setCellHorizontalAlignment(close_dialog, HasHorizontalAlignment.ALIGN_RIGHT);
// hp_form_actions.setCellHorizontalAlignment(close_dialog, HasHorizontalAlignment.ALIGN_RIGHT);
showAlertSubmitResult(false, "");
form_create_folder.add(alertSubmitResult);
@ -139,12 +154,18 @@ public abstract class CreateFolderForm extends Composite {
boolean valid = true;
// input_layer_name.setType(ControlGroupType.NONE);
input_folder_name_group.setType(ControlGroupType.NONE);
// input_folder_name_group.setType(ControlGroupType.NONE);
// ControlGroup ct = new ControlGroup();
// ct.setType(ControlGroupType.NONE);
// input_folder_name.setControlGroup(ct);
if(input_folder_name.getValue()==null || input_folder_name.getValue().isEmpty()){
input_folder_name.setControlGroup(input_folder_name_group);
input_folder_name_group.setType(ControlGroupType.ERROR);
input_folder_name.setPlaceholder("Required Field!!!");
// ControlGroup ct2 = new ControlGroup();
// ct.setType(ControlGroupType.ERROR);
// input_folder_name.setControlGroup(ct);
// input_folder_name.setErrorLabel(new Label("Required Field"));
valid = false;
}
@ -164,12 +185,13 @@ public abstract class CreateFolderForm extends Composite {
alertSubmitResult.setVisible(visible);
}
/**
* Gets the submit_button.
* Gets the submit button.
*
* @return the submit_button
* @return the submit button
*/
public Button getSubmit_button() {
public Button getSubmitButton() {
return submit_create_folder;
}
@ -209,4 +231,15 @@ public abstract class CreateFolderForm extends Composite {
alertError.setVisible(bool);
}
/**
* Gets the text box folder name.
*
* @return the input_folder_name
*/
public TextBox getTextBoxFolderName() {
return input_folder_name;
}
}

View File

@ -3,21 +3,11 @@
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<b:WellForm type="INLINE" ui:field="form_create_folder">
<b:Fieldset styleName="noBorder">
<b:ControlGroup ui:field="input_folder_name_group">
<b:ControlLabel for="input_folder_name">New Folder</b:ControlLabel>
<b:Controls>
<b:TextBox placeholder="Type Folder name..." b:id="input_folder_name"
ui:field="input_folder_name"></b:TextBox>
</b:Controls>
</b:ControlGroup>
<b:FluidRow ui:field="validator_field"></b:FluidRow>
<g:HorizontalPanel ui:field="hp_form_actions">
<b:FormActions>
<b:Button ui:field="submit_create_folder">Create</b:Button>
</b:FormActions>
<b:Button ui:field="close_dialog">Close</b:Button>
</g:HorizontalPanel>
</b:Fieldset>
<b:ControlLabel ui:field="control_label">New Folder</b:ControlLabel>
<b:TextBox placeholder="Type Folder name..." b:id="input_folder_name"
ui:field="input_folder_name" styleName="gwt-TextBox-personal"></b:TextBox>
<b:Button ui:field="submit_create_folder">Create</b:Button>
<b:Button ui:field="close_dialog">Close</b:Button>
<b:FluidRow ui:field="validator_field"></b:FluidRow>
</b:WellForm>
</ui:UiBinder>

View File

@ -13,7 +13,6 @@ import org.gcube.portlets.widgets.wsexplorer.shared.ItemCategory;
import com.github.gwtbootstrap.client.ui.NavWidget;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
@ -63,7 +62,7 @@ public class Navigation extends Composite{
public Navigation(HandlerManager eventBus) {
initWidget(uiBinder.createAndBindUi(this));
this.eventBus = eventBus;
getElement().getStyle().setMarginLeft(5.0, Unit.PX);
// getElement().getStyle().setMarginLeft(5.0, Unit.PX);
home.setActive(true);
WorkspaceExplorerConstants.workspaceNavigatorService.getItemByCategory(ItemCategory.HOME, new AsyncCallback<Item>() {

View File

@ -8,8 +8,5 @@
</b:NavWidget>
<b:NavWidget ui:field="new_folder" text="New Folder">
</b:NavWidget>
<!-- <g:VerticalPanel> -->
<!-- <b:TextBox placeholder="type folder name" styleName="size"></b:TextBox> -->
<!-- </g:VerticalPanel> -->
</g:FlowPanel>
</ui:UiBinder>

View File

@ -242,7 +242,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes{
GWT.log("workspace explorer updating..");
explorerPanel.clear();
// itTables = new ItemsTable(true, displayFields);
itTables.addItems(items);
itTables.updateItems(items, true);
explorerPanel.add(itTables.getCellTable());
GWT.log("workspace explorer updated");
}
@ -256,9 +256,10 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes{
public void addItemToExplorer(Item item){
GWT.log("workspace explorer add item.."+item);
// itTables = new ItemsTable(true, displayFields);
// explorerPanel.clear();
itTables.addItems(Arrays.asList(item));
explorerPanel.add(itTables.getCellTable());
GWT.log("workspace explorer updated");
// explorerPanel.add(itTables.getCellTable());
GWT.log("added item: "+item.getName() +", to Explorer");
}
/**

View File

@ -55,8 +55,6 @@ public abstract class AbstractItemsCellTable {
public abstract void initTable(AbstractCellTable<Item> ItemTable, final SimplePager pager, final Pagination pagination);
/**
* Instantiates a new abstract items cell table.
*
@ -74,7 +72,7 @@ public abstract class AbstractItemsCellTable {
dataProvider.addDataDisplay(cellTable);
// initTable(cellTable, null, null);
cellTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
ssm = new SingleSelectionModel<Item>();
cellTable.setSelectionModel(ssm);
ssm.addSelectionChangeHandler(new Handler() {
@ -90,7 +88,7 @@ public abstract class AbstractItemsCellTable {
}
}
});
cellTable.addDomHandler(new DoubleClickHandler() {
@Override
@ -101,12 +99,12 @@ public abstract class AbstractItemsCellTable {
AbstractItemsCellTable.this.eventBus.fireEvent(new org.gcube.portlets.widgets.wsexplorer.client.event.LoadFolderEvent(selected));
}
}
},
},
DoubleClickEvent.getType());
/*
cellTable.addCellPreviewHandler(new CellPreviewEvent.Handler<Item> () {
long lastClick=-1000;
@Override
public void onCellPreview(CellPreviewEvent<Item> event) {
long clictAt = System.currentTimeMillis();
@ -119,20 +117,20 @@ public abstract class AbstractItemsCellTable {
}
lastClick = System.currentTimeMillis();
}
}
}
}); */
MenuBar options = new MenuBar(true);
ScheduledCommand openCommand = new ScheduledCommand() {
@Override
public void execute() {
AbstractItemsCellTable.this.eventBus.fireEvent(new org.gcube.portlets.widgets.wsexplorer.client.event.LoadFolderEvent(itemContextMenu));
}
};
MenuItem openItem = new MenuItem("Open", openCommand);
options.addItem(openItem);
final DialogBox menuWrapper = new DialogBox(true);
@ -140,7 +138,7 @@ public abstract class AbstractItemsCellTable {
menuWrapper.getElement().getStyle().setZIndex(10000);
menuWrapper.add(options);
cellTable.sinkEvents(Event.ONCONTEXTMENU);
cellTable.addHandler(new ContextMenuHandler() {
@Override
public void onContextMenu(ContextMenuEvent event) {
@ -156,7 +154,7 @@ public abstract class AbstractItemsCellTable {
}*/
}
}, ContextMenuEvent.getType());
// ssm.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
//
// @Override
@ -166,36 +164,34 @@ public abstract class AbstractItemsCellTable {
//
// }
// });
}
/**
* Adds the Items.
* Update items.
*
* @param Items
* the Items
* @param items the items
* @param removeOldItems the remove old items
*/
public void addItems(List<Item> Items) {
dataProvider.getList().clear();
public void updateItems(List<Item> items, boolean removeOldItems) {
for (Item pckg : Items)
addItem(pckg);
if(removeOldItems)
dataProvider.getList().clear();
cellTable.setPageSize(Items.size() + 1);
dataProvider.getList().addAll(items);
dataProvider.flush();
dataProvider.refresh();
cellTable.setPageSize(items.size()+1);
cellTable.redraw();
}
/**
* Adds the Item.
*
* @param pckg
* the pckg
*/
private void addItem(Item pckg) {
/*private void addItem(Item pckg) {
dataProvider.getList().add(pckg);
dataProvider.flush();
dataProvider.refresh();
}
}*/
/**
* Gets the cell tables.

View File

@ -67,28 +67,20 @@ public class ItemsTable extends AbstractItemsCellTable implements SelectionItem{
/* (non-Javadoc)
* @see org.gcube.portlets.widgets.wsexplorer.client.view.grid.AbstractItemsCellTable#addItems(java.util.List)
* @see org.gcube.portlets.widgets.wsexplorer.client.view.grid.AbstractItemsCellTable#updateItems(java.util.List, boolean)
*/
public void addItems(List<Item> packages) {
dataProvider.getList().clear();
for (Item pckg : packages)
addItem(pckg);
cellTable.setPageSize(packages.size()+1);
cellTable.redraw();
public void updateItems(List<Item> items, boolean removeOldItems) {
super.updateItems(items, removeOldItems);
}
/**
* Adds the item.
* Adds the items.
*
* @param pckg the pckg
* @param packages the packages
*/
private void addItem(Item pckg) {
dataProvider.getList().add(pckg);
dataProvider.flush();
dataProvider.refresh();
public void addItems(List<Item> packages) {
dataProvider.getList().addAll(packages);
}
/* (non-Javadoc)

View File

@ -3,59 +3,5 @@
* SPECIFIC CSS FOR WORKSPACE EXPLORER
*
*
* Added to: /src/main/java/org/gcube/portlets/widgets/wsexplorer/resources/css/bootstrap.min.css
**************************************************/
/* .margin-auto { */
/* margin: 0 auto; */
/* /* width: 50%; */ */
/* } */
/* .table-overflow td, th { */
/* overflow: hidden !important; */
/* } */
/* .table-overflow th{ */
/* text-align: center !important; */
/* } */
/* .breadcrumbs-navigator .breadcrumb { */
/* margin-bottom: 5px !important; */
/* margin-left: 0px !important; */
/* } */
/* .moreinfo{ */
/* margin-top: 60%; */
/* } */
/* .alert-custom { */
/* margin-top: 10px; */
/* margin-bottom: 0 !important; */
/* padding: 4px !important; */
/* } */
/* .fileNameTextBox{ */
/* vertical-align: top !important; */
/* margin-right: 10px; */
/* margin-left: 5px; */
/* width: 550px; */
/* font-size: 12px !important; */
/* } */
/* .footerHP{ */
/* margin-top: 20px !important; */
/* float: right; */
/* } */
/* .htmlSaveName { */
/* display: inline; */
/* font-size: 14px; */
/* margin-right: 5px; */
/* vertical-align: middle; */
/* } */
/* .savePanel{ */
/* border: 1px solid; */
/* padding-left: 25px; */
/* } */
* See: /src/main/java/org/gcube/portlets/widgets/wsexplorer/resources/css/bootstrap.min.css
**************************************************/

View File

@ -1282,4 +1282,51 @@ a:hover, a:focus {
.savePanel{
/*border: 1px solid;*/
padding-left: 25px;
}
}
.well {
background-color: #F5F5F5;
border: 1px solid #E3E3E3;
border-radius: 4px;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05) inset;
margin-bottom: 20px;
min-height: 20px;
padding: 19px;
}
.well blockquote {
border-color: rgba(0, 0, 0, 0.15);
}
.well-large {
border-radius: 6px;
padding: 24px;
}
.well-small {
border-radius: 3px;
padding: 9px;
}
.form-search input, .form-inline input, .form-horizontal input, .form-search textarea, .form-inline textarea, .form-horizontal textarea, .form-search select, .form-inline select, .form-horizontal select, .form-search .help-inline, .form-inline .help-inline, .form-horizontal .help-inline, .form-search .uneditable-input, .form-inline .uneditable-input, .form-horizontal .uneditable-input, .form-search .input-prepend, .form-inline .input-prepend, .form-horizontal .input-prepend, .form-search .input-append, .form-inline .input-append, .form-horizontal .input-append {
display: inline-block;
margin-bottom: 0;
vertical-align: middle;
}
.form-search .hide, .form-inline .hide, .form-horizontal .hide {
display: none;
}
.form-search label, .form-inline label, .form-search .btn-group, .form-inline .btn-group {
display: inline-block;
}
.form-search .input-append, .form-inline .input-append, .form-search .input-prepend, .form-inline .input-prepend {
margin-bottom: 0;
}
.form-search .radio, .form-search .checkbox, .form-inline .radio, .form-inline .checkbox {
margin-bottom: 0;
padding-left: 0;
vertical-align: middle;
}
.form-search .radio input[type="radio"], .form-search .checkbox input[type="checkbox"], .form-inline .radio input[type="radio"], .form-inline .checkbox input[type="checkbox"] {
float: left;
margin-left: 0;
margin-right: 3px;
}

View File

@ -3,7 +3,6 @@
* GWT-BOOTSTRAP MINIMAL CSS FOR WORKSPACE EXPLORE
*
**************************************************/
/* body { */
/* padding-top: 50px; */
/* } */
@ -13,37 +12,69 @@
/* div.input-append > input, div.input-append > textarea, div.input-append > select, div.input-append > .uneditable-input { */
/* margin-bottom: 0; */
/* } */
.gwt-PopupPanel .gwt-DatePicker {
width: 200px;
width: 200px;
}
.gwt-SuggestBoxPopup {
z-index: 2100;
z-index: 2100;
}
.gwt-SuggestBoxPopup .suggestPopupTop {
background-color: #FFFFFF;
background-color: #FFFFFF;
}
.gwt-SuggestBoxPopup .suggestPopupMiddle {
background-color: #FFFFFF;
background-color: #FFFFFF;
}
.gwt-SuggestBoxPopup .suggestPopupBottomCenter {
background-color: #FFFFFF;
background-color: #FFFFFF;
}
.gwt-SuggestBoxPopup .item {
clear: both;
color: #333333;
cursor: pointer;
font-size: 110%;
font-weight: normal;
line-height: 20px;
padding: 3px 9px;
white-space: nowrap;
clear: both;
color: #333333;
cursor: pointer;
font-size: 110%;
font-weight: normal;
line-height: 20px;
padding: 3px 9px;
white-space: nowrap;
}
.gwt-SuggestBoxPopup .item-selected {
background-color: #0081C2;
background-image: linear-gradient(to bottom, #0088CC, #0077B3);
background-repeat: repeat-x;
color: #FFFFFF;
outline: 0 none;
text-decoration: none;
background-color: #0081C2;
background-image: linear-gradient(to bottom, #0088CC, #0077B3);
background-repeat: repeat-x;
color: #FFFFFF;
outline: 0 none;
text-decoration: none;
}
.gwt-TextBox-personal {
background-color: #FFFFFF;
border: 1px solid #CCCCCC;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;
border-radius: 4px;
color: #555555;
display: inline-block;
font-size: 14px;
height: 20px;
line-height: 20px;
margin-bottom: 10px;
padding: 4px 6px;
vertical-align: middle;
}
.form-inline input:FOCUS{
border-color: rgba(82, 168, 236, 0.8);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px
rgba(82, 168, 236, 0.6);
outline: 0 none
}
.margin-right-5px {
margin-right: 5px;
}

View File

@ -602,7 +602,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
@Override
public Item createFolder(String nameFolder, String description, String parentId) throws Exception {
_log.trace("creating folder: "+nameFolder +" parent is null?"+parentId);
_log.debug("creating folder: "+nameFolder +", parent id: "+parentId);
try {