📄 tocresourcecontent.java
字号:
package com.esri.solutions.jitk.web.data;
import java.util.List;
import javax.faces.model.SelectItem;
import com.esri.adf.web.data.GISResource;
/**
* Extension of {@link com.esri.adf.web.data.TocResourceContent} in
* order to manipulate the ADF-provided Context Menu Items that are
* shown for a GIS Resource. This is needed in order to protect
* Overlays within the WebContext. This implementation will
* remove the Move Up, Move Down, and Remove Context Menu Items
* based on the return values of {@link WebContext#canMoveUp(GISResource)},
* {@link WebContext#canMoveDown(GISResource)}, and
* {@link WebContext#canRemove(GISResource)}.
*
* <p>
* If an ADF WebContext object is in use, then the ADF-provided
* Context Menu Items are returned unchanged.
* </p>
*/
public class TocResourceContent extends
com.esri.adf.web.data.TocResourceContent {
private static final long serialVersionUID = 990861410451964296L;
@Override
public List<SelectItem> getContextMenuItems() {
List<SelectItem> items = super.getContextMenuItems();
GISResource resource = this.getResource();
com.esri.adf.web.data.WebContext adfContext = resource.getWebContext();
if (!(adfContext instanceof WebContext)) {
return items;
}
if (items == null) {
return items;
}
WebContext context = (WebContext) adfContext;
if (!context.canMoveDown(resource)) {
items.remove(moveDown);
}
if (!context.canMoveUp(resource)) {
items.remove(moveUp);
}
if (!context.canRemove(resource)) {
items.remove(removeResource);
}
return items;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -