Search in sources :

Example 1 with LayoutTplElement

use of com.liferay.ide.layouttpl.core.model.LayoutTplElement in project liferay-ide by liferay.

the class AddLayoutTemplateActionHandlerFactory method init.

@Override
public void init(SapphireAction action, ActionHandlerFactoryDef def) {
    super.init(action, def);
    LayoutTplElement tplElement = getModelElement().nearest(LayoutTplElement.class);
    Value<Boolean> bootstrapStyle = tplElement.getBootstrapStyle();
    _bootstrapStyle = bootstrapStyle.content();
}
Also used : LayoutTplElement(com.liferay.ide.layouttpl.core.model.LayoutTplElement)

Example 2 with LayoutTplElement

use of com.liferay.ide.layouttpl.core.model.LayoutTplElement in project liferay-ide by liferay.

the class LayoutTplEditor method createEmptyDiagramModel.

protected LayoutTplElement createEmptyDiagramModel() {
    LayoutTplElement layoutTpl = LayoutTplElement.TYPE.instantiate();
    layoutTpl.setBootstrapStyle(_isBootstrapStyle());
    String editorInputName = getEditorInput().getName();
    layoutTpl.setClassName(editorInputName.replaceAll("\\..*$", ""));
    layoutTpl.setIs62(_is62());
    return layoutTpl;
}
Also used : LayoutTplElement(com.liferay.ide.layouttpl.core.model.LayoutTplElement)

Example 3 with LayoutTplElement

use of com.liferay.ide.layouttpl.core.model.LayoutTplElement in project liferay-ide by liferay.

the class LayoutTplEditor method refreshDiagramModel.

protected void refreshDiagramModel() {
    LayoutTplElement newElement = LayoutTplElementsFactory.INSTANCE.newLayoutTplFromFile(getFile(), _bootstrapStyle, _is62);
    if (newElement == null) {
        /*
			 * create an empty model for diagram in memory, but not write to
			 * source
			 */
        newElement = createEmptyDiagramModel();
    }
    Element model = getModelElement();
    model.clear();
    model.copy(newElement);
}
Also used : LayoutTplElement(com.liferay.ide.layouttpl.core.model.LayoutTplElement) Element(org.eclipse.sapphire.Element) LayoutTplElement(com.liferay.ide.layouttpl.core.model.LayoutTplElement)

Example 4 with LayoutTplElement

use of com.liferay.ide.layouttpl.core.model.LayoutTplElement in project liferay-ide by liferay.

the class LayoutTplEditor method createModel.

@Override
protected Element createModel() {
    IFile file = getFile();
    _bootstrapStyle = _isBootstrapStyle();
    _is62 = _is62();
    LayoutTplElement layoutTpl = LayoutTplElementsFactory.INSTANCE.newLayoutTplFromFile(file, _bootstrapStyle, _is62);
    if (layoutTpl == null) {
        layoutTpl = createEmptyDiagramModel();
    }
    Listener listener = new Listener() {

        @Override
        public void handle(Event event) {
            setDesignPageChanged(true);
            firePropertyChange(PROP_DIRTY);
        }
    };
    layoutTpl.attach(listener, "*");
    return layoutTpl;
}
Also used : IFile(org.eclipse.core.resources.IFile) IModelStateListener(org.eclipse.wst.sse.core.internal.provisional.IModelStateListener) Listener(org.eclipse.sapphire.Listener) Event(org.eclipse.sapphire.Event) LayoutTplElement(com.liferay.ide.layouttpl.core.model.LayoutTplElement)

Example 5 with LayoutTplElement

use of com.liferay.ide.layouttpl.core.model.LayoutTplElement in project liferay-ide by liferay.

the class LayoutTemplatesFactory method _isBootstrapStyle.

private static boolean _isBootstrapStyle(CanAddPortletLayouts element) {
    LayoutTplElement layoutTplElement = element.nearest(LayoutTplElement.class);
    Value<Boolean> bootstrapStyle = layoutTplElement.getBootstrapStyle();
    return bootstrapStyle.content();
}
Also used : LayoutTplElement(com.liferay.ide.layouttpl.core.model.LayoutTplElement)

Aggregations

LayoutTplElement (com.liferay.ide.layouttpl.core.model.LayoutTplElement)21 PortletColumnElement (com.liferay.ide.layouttpl.core.model.PortletColumnElement)10 PortletLayoutElement (com.liferay.ide.layouttpl.core.model.PortletLayoutElement)9 Test (org.junit.Test)7 IFile (org.eclipse.core.resources.IFile)5 Element (org.eclipse.sapphire.Element)3 Status (org.eclipse.sapphire.modeling.Status)2 ValidationService (org.eclipse.sapphire.services.ValidationService)2 LayoutTplDescriptorHelper (com.liferay.ide.layouttpl.core.operation.LayoutTplDescriptorHelper)1 IOException (java.io.IOException)1 CoreException (org.eclipse.core.runtime.CoreException)1 IStatus (org.eclipse.core.runtime.IStatus)1 Event (org.eclipse.sapphire.Event)1 Listener (org.eclipse.sapphire.Listener)1 Property (org.eclipse.sapphire.Property)1 Value (org.eclipse.sapphire.Value)1 IDataModel (org.eclipse.wst.common.frameworks.datamodel.IDataModel)1 IModelStateListener (org.eclipse.wst.sse.core.internal.provisional.IModelStateListener)1