+ }
+
+ protected Paragraph newParagraph(TextSection parent, Content node) {
+ Paragraph paragraph = new Paragraph(parent, parent.getStyle(), node);
+ updateContent(paragraph);
+ paragraph.setLayoutData(CmsSwtUtils.fillWidth());
+ paragraph.setMouseListener(getMouseListener());
+ paragraph.setFocusListener(getFocusListener());
+ return paragraph;
+ }
+
+ protected DbkSectionTitle newSectionTitle(TextSection parent, Content titleNode) {
+ int style = parent.getStyle();
+ Composite titleParent = newSectionHeader(parent);
+ if (parent.isTitleReadOnly())
+ style = style | SWT.READ_ONLY;
+ DbkSectionTitle title = new DbkSectionTitle(titleParent, style, titleNode);
+ updateContent(title);
+ title.setMouseListener(getMouseListener());
+ title.setFocusListener(getFocusListener());
+ return title;
+ }
+
+ protected DbkImg newImg(TextSection parent, Content node) {
+ DbkImg img = new DbkImg(parent, parent.getStyle(), node, imageManager);
+ GridData imgGd;
+ if (maxMediaWidth != null) {
+ imgGd = new GridData(SWT.CENTER, SWT.FILL, false, false);
+ imgGd.widthHint = maxMediaWidth;
+ img.setPreferredSize(new Cms2DSize(maxMediaWidth, 0));
+ } else {
+ imgGd = CmsSwtUtils.grabWidth(SWT.CENTER, SWT.DEFAULT);
+ }
+ img.setLayoutData(imgGd);
+ updateContent(img);
+ img.setMouseListener(getMouseListener());
+ img.setFocusListener(getFocusListener());
+ return img;
+ }
+
+ protected DbkVideo newVideo(TextSection parent, Content node) {
+ DbkVideo video = new DbkVideo(parent, getCmsEditable().canEdit() ? SWT.NONE : SWT.READ_ONLY, node);
+ GridData gd;
+ if (maxMediaWidth != null) {
+ gd = new GridData(SWT.CENTER, SWT.FILL, false, false);
+ // TODO, manage size
+// gd.widthHint = maxMediaWidth;
+// gd.heightHint = (int) (gd.heightHint * 0.5625);
+ } else {
+ gd = new GridData(SWT.CENTER, SWT.FILL, false, false);
+// gd.widthHint = video.getWidth();
+// gd.heightHint = video.getHeight();
+ }
+ video.setLayoutData(gd);
+ updateContent(video);
+ return video;
+ }
+
+ /**
+ * To be overridden in order to provide additional processing at the section
+ * level.
+ *
+ * @return the parent to use for the {@link DbkSectionTitle}, by default
+ * {@link Section#getHeader()}
+ */
+ protected Composite newSectionHeader(TextSection section) {
+ return section.getHeader();
+ }
+
+ public TextSection getMainSection() {
+ return mainSection;
+ }
+
+ public void setShowMainTitle(boolean showMainTitle) {
+ this.showMainTitle = showMainTitle;
+ }
+
+ public String getDefaultSectionStyle() {
+ return defaultSectionStyle;
+ }
+
+ public void setDefaultSectionStyle(String defaultSectionStyle) {
+ this.defaultSectionStyle = defaultSectionStyle;
+ }
+
+ public void setMaxMediaWidth(Integer maxMediaWidth) {
+ this.maxMediaWidth = maxMediaWidth;