Removed unused code
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@120295 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a5e66f163b
commit
1f24ea91d9
|
@ -55,9 +55,12 @@ import com.google.gwt.i18n.client.DateTimeFormat;
|
|||
import com.google.gwt.i18n.client.NumberFormat;
|
||||
import com.google.gwt.user.client.Random;
|
||||
|
||||
|
||||
/**
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* The Class GxtGridFilterGroupPanel.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Nov 17, 2015
|
||||
*/
|
||||
public class GxtGridFilterGroupPanel extends LayoutContainer {
|
||||
|
||||
|
@ -71,14 +74,18 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
private NumberFormat number = ConstantsExplorer.numberFormatterKB;
|
||||
private final Grid<FileGridModel> grid;
|
||||
|
||||
/**
|
||||
* Instantiates a new gxt grid filter group panel.
|
||||
*
|
||||
* @param group the group
|
||||
*/
|
||||
public GxtGridFilterGroupPanel(boolean group) {
|
||||
// setLayout(new FitLayout());
|
||||
setId("GxtGridFilterGroupPanel "+Random.nextInt());
|
||||
ColumnConfig icon = new ColumnConfig(ConstantsExplorer.ICON, "", 25);
|
||||
icon.setSortable(false);
|
||||
ColumnConfig name = new ColumnConfig(ConstantsExplorer.NAME, ConstantsExplorer.NAME, 300);
|
||||
ColumnConfig type = new ColumnConfig(ConstantsExplorer.TYPE, ConstantsExplorer.TYPE, 50);
|
||||
// ColumnConfig creationDate = new ColumnConfig(ConstantsExplorer.GRIDCOLUMNCREATIONDATE, ConstantsExplorer.GRIDCOLUMNCREATIONDATE, 100);
|
||||
|
||||
ColumnConfig lastUpdate = new ColumnConfig(ConstantsExplorer.LASTMODIFIED, "Last Update", 100);
|
||||
lastUpdate.setDateTimeFormat(DateTimeFormat.getFormat("dd MMM hh:mm aaa yyyy"));
|
||||
ColumnConfig category = new ColumnConfig(ConstantsExplorer.SHORTCUTCATEGORY, ConstantsExplorer.SHORTCUTCATEGORY, 100);
|
||||
|
@ -88,7 +95,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
size.setEditor(new CellEditor(new NumberField()));
|
||||
|
||||
ColumnModel cm = null;
|
||||
|
||||
|
||||
if(group)
|
||||
cm = new ColumnModel(Arrays.asList(icon, name, ownerFullName, type, lastUpdate, size, category));
|
||||
else
|
||||
|
@ -97,28 +104,17 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
final ColumnModel columnModel = cm;
|
||||
|
||||
cp.setBodyBorder(true);
|
||||
// cp.setHeading(ConstantsPortlet.RESULT);
|
||||
cp.setHeaderVisible(false);
|
||||
cp.setLayout(new FitLayout());
|
||||
|
||||
grid = new Grid<FileGridModel>(store, columnModel);
|
||||
grid.getView().setAutoFill(true);
|
||||
// grid.setBorders(true);
|
||||
|
||||
|
||||
|
||||
view.setShowGroupedColumn(false);
|
||||
view.setForceFit(true);
|
||||
grid.setView(view);
|
||||
view.setEmptyText(ConstantsExplorer.EMPTY);
|
||||
|
||||
// view.setGroupRenderer(new GridGroupRenderer() {
|
||||
// public String render(GroupColumnData data) {
|
||||
// String f = columnModel.getColumnById(data.field).getHeader();
|
||||
// String l = data.models.size() == 1 ? "Item" : "Items";
|
||||
// return f + ": " + data.group + " (" + data.models.size() + " " + l + ")";
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
if(group){
|
||||
store.groupBy(ConstantsExplorer.SHORTCUTCATEGORY);
|
||||
groupingEnabled = true;
|
||||
|
@ -134,18 +130,6 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
return "";
|
||||
|
||||
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='color:" + color + "'>" + val + "</span>";
|
||||
|
||||
/*
|
||||
if(val != null && val.equals(GXTFolderItemTypeEnum.FOLDER.toString())){
|
||||
// color = "#EEC900";
|
||||
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='font-weight: bold;color:" + color + "'>" + val + "</span>";
|
||||
}else{
|
||||
if(val==null)
|
||||
val = "";
|
||||
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='color:" + color + "'>" + val + "</span>";
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -160,8 +144,6 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
|
||||
if(value!=-1){
|
||||
String color = "black";
|
||||
// int val = Integer.parseInt(value);
|
||||
// String style = (val/1024) < 2000000 ? "red" : "green";
|
||||
double kb = value/1024;
|
||||
if(kb<1)
|
||||
kb=1;
|
||||
|
@ -185,7 +167,6 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
StringFilter authorFilter = new StringFilter(ConstantsExplorer.TYPE);
|
||||
DateFilter dateFilter = new DateFilter(ConstantsExplorer.LASTMODIFIED);
|
||||
NumericFilter sizeFilter = new NumericFilter(ConstantsExplorer.SIZE);
|
||||
|
||||
|
||||
filters.addFilter(nameFilter);
|
||||
filters.addFilter(authorFilter);
|
||||
|
@ -199,10 +180,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
grid.setColumnLines(true);
|
||||
|
||||
grid.getView().setShowDirtyCells(false);
|
||||
|
||||
// grid.setSize(500, 500);
|
||||
grid.addPlugin(filters);
|
||||
|
||||
grid.getSelectionModel().setSelectionMode(SelectionMode.MULTI);
|
||||
|
||||
grid.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<FileGridModel>() {
|
||||
|
@ -280,6 +258,9 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable grouping.
|
||||
*/
|
||||
public void disableGrouping() {
|
||||
GroupingStore<FileGridModel> groupingStore = null;
|
||||
if (this.getStore() instanceof GroupingStore) {
|
||||
|
@ -291,6 +272,9 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable grouping.
|
||||
*/
|
||||
public void enableGrouping() {
|
||||
GroupingStore<FileGridModel> groupingStore = null;
|
||||
if (this.getStore() instanceof GroupingStore) {
|
||||
|
@ -302,6 +286,11 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire event by file model type.
|
||||
*
|
||||
* @param target the target
|
||||
*/
|
||||
private void fireEventByFileModelType(FileModel target){
|
||||
|
||||
if(target.isDirectory()){
|
||||
|
@ -344,11 +333,20 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset store.
|
||||
*/
|
||||
private void resetStore(){
|
||||
store.removeAll();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update store.
|
||||
*
|
||||
* @param result the result
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean updateStore(List<FileGridModel> result){
|
||||
|
||||
resetStore();
|
||||
|
@ -362,6 +360,12 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the to store.
|
||||
*
|
||||
* @param result the result
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean addToStore(FileGridModel result){
|
||||
|
||||
if(result!= null){
|
||||
|
@ -372,16 +376,31 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the selected item.
|
||||
*
|
||||
* @return the selected item
|
||||
*/
|
||||
public FileGridModel getSelectedItem(){
|
||||
|
||||
return currenItemSelected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the selected items.
|
||||
*
|
||||
* @return the selected items
|
||||
*/
|
||||
public List<FileGridModel> getSelectedItems(){
|
||||
|
||||
return grid.getSelectionModel().getSelection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ids selected items.
|
||||
*
|
||||
* @return the ids selected items
|
||||
*/
|
||||
public List<String> getIdsSelectedItems(){
|
||||
|
||||
if(grid.getSelectionModel().getSelection()!=null){
|
||||
|
@ -398,9 +417,10 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Delete item.
|
||||
*
|
||||
* @param identifier (MANDATORY)
|
||||
* @return
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean deleteItem(String identifier) {
|
||||
|
||||
|
@ -418,10 +438,12 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Rename item.
|
||||
*
|
||||
* @param fileTarget (MANDATORY)
|
||||
* @param newName (MANDATORY)
|
||||
* @param extension OPTIONAL - string or null
|
||||
* @return true, if successful
|
||||
*/
|
||||
private boolean renameItem(FileGridModel fileTarget, String newName, String extension) {
|
||||
|
||||
|
@ -445,16 +467,34 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the current folder view.
|
||||
*
|
||||
* @return the current folder view
|
||||
*/
|
||||
public FileModel getCurrentFolderView() {
|
||||
return currentFolderView;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the current folder view.
|
||||
*
|
||||
* @param currentFolderView the new current folder view
|
||||
*/
|
||||
public void setCurrentFolderView(FileModel currentFolderView) {
|
||||
this.currentFolderView = currentFolderView;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Rename item.
|
||||
*
|
||||
* @param itemIdentifier the item identifier
|
||||
* @param newName the new name
|
||||
* @param extension the extension
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean renameItem(String itemIdentifier, String newName, String extension) {
|
||||
|
||||
if(itemIdentifier!=null){
|
||||
|
@ -480,14 +520,21 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the file grid model by identifier.
|
||||
*
|
||||
* @param id the id
|
||||
* @return the file grid model by identifier
|
||||
*/
|
||||
public FileGridModel getFileGridModelByIdentifier(String id){
|
||||
return (FileGridModel) store.findModel(ConstantsExplorer.IDENTIFIER, id);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
* Select item by file model id.
|
||||
*
|
||||
* @param id the id
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean selectItemByFileModelId(String id){
|
||||
|
||||
|
@ -505,10 +552,20 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the store.
|
||||
*
|
||||
* @return the store
|
||||
*/
|
||||
public GroupingStore<FileGridModel> getStore(){
|
||||
return store;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the border as on search.
|
||||
*
|
||||
* @param bool the new border as on search
|
||||
*/
|
||||
public void setBorderAsOnSearch(boolean bool){
|
||||
|
||||
if(this.cp.getElement("body")!=null){
|
||||
|
@ -522,6 +579,9 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the data changed store listener.
|
||||
*/
|
||||
private void addDataChangedStoreListener(){
|
||||
|
||||
store.addListener(Store.Add, new Listener<StoreEvent<ModelData>>(){
|
||||
|
@ -554,7 +614,8 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Store size.
|
||||
*
|
||||
* @return -1 if store is null. The size otherwise
|
||||
*/
|
||||
private int storeSize(){
|
||||
|
@ -567,7 +628,10 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Refresh size.
|
||||
*
|
||||
* @param width the width
|
||||
* @param height the height
|
||||
*/
|
||||
public void refreshSize(String width, String height) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue