package org.argeo.docbook.ui;
-import static org.argeo.cms.ui.util.CmsUiUtils.fillWidth;
import static org.argeo.docbook.DbkType.para;
import static org.argeo.docbook.DbkUtils.addDbk;
import static org.argeo.docbook.DbkUtils.isDbk;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.argeo.cms.ui.CmsEditable;
-import org.argeo.cms.ui.util.CmsUiUtils;
+import org.argeo.api.cms.Cms2DSize;
+import org.argeo.api.cms.CmsEditable;
+import org.argeo.cms.swt.CmsSwtUtils;
import org.argeo.cms.ui.viewers.AbstractPageViewer;
import org.argeo.cms.ui.viewers.EditablePart;
import org.argeo.cms.ui.viewers.NodePart;
long begin = System.currentTimeMillis();
Section section = (Section) control;
if (section instanceof TextSection) {
- CmsUiUtils.clear(section);
+ CmsSwtUtils.clear(section);
Node node = section.getNode();
TextSection textSection = (TextSection) section;
String style = node.hasProperty(DbkAttr.role.name()) ? node.getProperty(DbkAttr.role.name()).getString()
: getDefaultSectionStyle();
if (style != null)
- CmsUiUtils.style(textSection, style);
+ CmsSwtUtils.style(textSection, style);
// Title
Node titleNode = null;
if (section.getHeader() == null)
section.createHeader();
DbkSectionTitle title = newSectionTitle(textSection, titleNode);
- title.setLayoutData(CmsUiUtils.fillWidth());
+ title.setLayoutData(CmsSwtUtils.fillWidth());
updateContent(title);
}
}
throw new IllegalArgumentException("Unsupported node type for " + child);
}
if (sectionPart != null && sectionPart instanceof Control)
- ((Control) sectionPart).setLayoutData(CmsUiUtils.fillWidth());
+ ((Control) sectionPart).setLayoutData(CmsSwtUtils.fillWidth());
}
// if (!flat)
Node child = ni.nextNode();
if (isDbk(child, DbkType.section)) {
TextSection newSection = newTextSection(section, child);
- newSection.setLayoutData(CmsUiUtils.fillWidth());
+ newSection.setLayoutData(CmsSwtUtils.fillWidth());
refresh(newSection);
}
}
protected Paragraph newParagraph(TextSection parent, Node node) throws RepositoryException {
Paragraph paragraph = new Paragraph(parent, parent.getStyle(), node);
updateContent(paragraph);
- paragraph.setLayoutData(fillWidth());
+ paragraph.setLayoutData(CmsSwtUtils.fillWidth());
paragraph.setMouseListener(getMouseListener());
paragraph.setFocusListener(getFocusListener());
return paragraph;
if (maxMediaWidth != null) {
imgGd = new GridData(SWT.CENTER, SWT.FILL, false, false);
imgGd.widthHint = maxMediaWidth;
- img.setPreferredSize(new Point(maxMediaWidth, 0));
+ img.setPreferredSize(new Cms2DSize(maxMediaWidth, 0));
} else {
- imgGd = CmsUiUtils.grabWidth(SWT.CENTER, SWT.DEFAULT);
+ imgGd = CmsSwtUtils.grabWidth(SWT.CENTER, SWT.DEFAULT);
}
img.setLayoutData(imgGd);
updateContent(img);
getTextInterpreter().write(titleNode, txt);
TextSection newSection = new TextSection(section, section.getStyle(), newSectionNode);
- newSection.setLayoutData(CmsUiUtils.fillWidth());
+ newSection.setLayoutData(CmsSwtUtils.fillWidth());
newSection.moveBelow(paragraph);
// dispose
Section section = paragraph.getSection();
updateContent(paragraph);
Paragraph newParagraph = newParagraph((TextSection) section, newNode);
- newParagraph.setLayoutData(CmsUiUtils.fillWidth());
+ newParagraph.setLayoutData(CmsSwtUtils.fillWidth());
newParagraph.moveBelow(paragraph);
layout(paragraph.getControl(), newParagraph.getControl());
return newParagraph;