use of com.liferay.ide.portlet.core.model.CustomPortletMode in project liferay-ide by liferay.
the class PortletModeImageService method compute.
@Override
protected ImageData compute() {
String portletMode = null;
Element element = context(Element.class);
ImageData imageData = null;
if (element instanceof CustomPortletMode) {
CustomPortletMode iCustomPortletMode = (CustomPortletMode) element;
portletMode = String.valueOf(iCustomPortletMode.getPortletMode().content());
} else if (element instanceof PortletMode) {
PortletMode iPortletMode = (PortletMode) element;
portletMode = iPortletMode.getPortletMode().content();
}
if (portletMode != null) {
if ("VIEW".equalsIgnoreCase(portletMode)) {
imageData = IMG_VIEW;
} else if ("EDIT".equalsIgnoreCase(portletMode)) {
imageData = IMG_EDIT;
} else if ("HELP".equalsIgnoreCase(portletMode)) {
imageData = IMG_HELP;
}
}
if (imageData == null) {
imageData = IMG_DEFAULT;
}
return imageData;
}
use of com.liferay.ide.portlet.core.model.CustomPortletMode in project liferay-ide by liferay.
the class PortletModePossibleValueService method compute.
// provided by Portlet Specification and Liferay
/**
* (non-Javadoc)
*
* @see org.eclipse.sapphire.modeling.PossibleValuesService#fillPossibleValues(java.
* util.SortedSet)
*/
@Override
protected void compute(Set<String> values) {
PortletApp portletApp = context(PortletApp.class);
for (int i = 0; i < DEFAULT_MODES.length; i++) {
values.add(DEFAULT_MODES[i]);
}
// Add the ones defined in portlet.xml
List<CustomPortletMode> customPortletModes = portletApp.getCustomPortletModes();
for (CustomPortletMode iCustomPortletMode : customPortletModes) {
String customPortletMode = iCustomPortletMode.getPortletMode().text(false);
if (customPortletMode != null) {
values.add(customPortletMode);
}
}
}
Aggregations