Search in sources :

Example 1 with CustomWindowState

use of com.liferay.ide.portlet.core.model.CustomWindowState in project liferay-ide by liferay.

the class WindowStateImageService method compute.

@Override
protected ImageData compute() {
    String strWindowState = null;
    Element element = context(Element.class);
    ImageData imageData = null;
    if (element instanceof CustomWindowState) {
        CustomWindowState customWindowState = (CustomWindowState) element;
        strWindowState = String.valueOf(customWindowState.getWindowState().content());
    } else if (element instanceof WindowState) {
        WindowState windowState = (WindowState) element;
        strWindowState = windowState.getWindowState().content();
    }
    if ("MAXIMIZED".equalsIgnoreCase(strWindowState)) {
        imageData = IMG_MAXIMIZED;
    } else if ("MINIMIZED".equalsIgnoreCase(strWindowState)) {
        imageData = IMG_MINIMIZED;
    }
    if (imageData == null) {
        imageData = IMG_DEFAULT;
    }
    return imageData;
}
Also used : WindowState(com.liferay.ide.portlet.core.model.WindowState) CustomWindowState(com.liferay.ide.portlet.core.model.CustomWindowState) CustomWindowState(com.liferay.ide.portlet.core.model.CustomWindowState) ImageData(org.eclipse.sapphire.ImageData) Element(org.eclipse.sapphire.Element)

Example 2 with CustomWindowState

use of com.liferay.ide.portlet.core.model.CustomWindowState in project liferay-ide by liferay.

the class WindowStatesPossibleValueService method refreshValues.

private void refreshValues() {
    PortletApp portletApp = context(PortletApp.class);
    if ((portletApp != null) && !portletApp.disposed()) {
        Set<String> newValues = new TreeSet<>();
        for (int i = 0; i < DEFAULT_STATES.length; i++) {
            newValues.add(DEFAULT_STATES[i]);
        }
        List<CustomWindowState> customWindowStates = portletApp.getCustomWindowStates();
        for (CustomWindowState iCustomWindowState : customWindowStates) {
            String customWindowState = iCustomWindowState.getWindowState().text(false);
            if (customWindowState != null) {
                newValues.add(customWindowState);
            }
        }
        if (!this.values.equals(newValues)) {
            this.values = Collections.unmodifiableSet(newValues);
        }
        if (this.initialized || this.readPriorToInit) {
            refresh();
        }
    }
}
Also used : CustomWindowState(com.liferay.ide.portlet.core.model.CustomWindowState) TreeSet(java.util.TreeSet) PortletApp(com.liferay.ide.portlet.core.model.PortletApp)

Aggregations

CustomWindowState (com.liferay.ide.portlet.core.model.CustomWindowState)2 PortletApp (com.liferay.ide.portlet.core.model.PortletApp)1 WindowState (com.liferay.ide.portlet.core.model.WindowState)1 TreeSet (java.util.TreeSet)1 Element (org.eclipse.sapphire.Element)1 ImageData (org.eclipse.sapphire.ImageData)1