use of org.eclipse.ui.forms.widgets.TableWrapData in project cubrid-manager by CUBRID.
the class NoticeDashboardPage method createSection.
private Section createSection(Composite parent, String title, String category, int sectionStyle) {
Section section = toolkit.createSection(parent, sectionStyle);
section.clientVerticalSpacing = 5;
section.setLayout(new GridLayout());
section.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
section.setText(title);
if (category != null) {
TableWrapLayout layout = new TableWrapLayout();
layout.numColumns = 1;
Composite composite = toolkit.createComposite(section, SWT.None);
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
section.setClient(composite);
FormText text = createFormText(composite);
formTexts.put(category, text);
}
sections.add(section);
return section;
}
use of org.eclipse.ui.forms.widgets.TableWrapData in project yamcs-studio by yamcs.
the class ThemeColorDetailsPage method createContents.
@Override
public void createContents(Composite parent) {
TableWrapLayout layout = new TableWrapLayout();
layout.topMargin = 5;
layout.leftMargin = 5;
layout.rightMargin = 2;
layout.bottomMargin = 2;
parent.setLayout(layout);
FormToolkit tk = mform.getToolkit();
Section s1 = tk.createSection(parent, Section.NO_TITLE);
// s1.marginWidth = 10;
TableWrapData td = new TableWrapData(TableWrapData.FILL, TableWrapData.TOP);
td.grabHorizontal = true;
s1.setLayoutData(td);
Composite client = tk.createComposite(s1);
GridLayout gl = new GridLayout();
client.setLayout(gl);
colorLabel = tk.createLabel(client, " yy ", SWT.BORDER);
colorLabel.setBackground(selectedColor);
Composite rgbScales = tk.createComposite(client);
GridData gd = new GridData();
rgbScales.setLayoutData(gd);
gl = new GridLayout(3, false);
rgbScales.setLayout(gl);
tk.createLabel(rgbScales, "Red");
redScale = new Scale(rgbScales, SWT.NONE);
redScale.setMinimum(0);
redScale.setMaximum(255);
redScale.setIncrement(1);
redScale.addListener(SWT.Selection, evt -> {
redText.setText("" + redScale.getSelection());
updateSelectedColor();
});
redText = tk.createText(rgbScales, " ", SWT.RIGHT);
redText.setEnabled(false);
gd = new GridData();
gd.widthHint = 50;
redText.setLayoutData(gd);
tk.createLabel(rgbScales, "Green");
greenScale = new Scale(rgbScales, SWT.NONE);
greenScale.setMinimum(0);
greenScale.setMaximum(255);
greenScale.setIncrement(1);
greenScale.addListener(SWT.Selection, evt -> {
greenText.setText("" + greenScale.getSelection());
updateSelectedColor();
});
greenText = tk.createText(rgbScales, " ", SWT.RIGHT);
greenText.setEnabled(false);
gd = new GridData();
gd.widthHint = 50;
greenText.setLayoutData(gd);
tk.createLabel(rgbScales, "Blue");
blueScale = new Scale(rgbScales, SWT.NONE);
blueScale.setMinimum(0);
blueScale.setMaximum(255);
blueScale.setIncrement(1);
blueScale.addListener(SWT.Selection, evt -> {
blueText.setText("" + blueScale.getSelection());
updateSelectedColor();
});
blueText = tk.createText(rgbScales, " ", SWT.RIGHT);
blueText.setEnabled(false);
gd = new GridData();
gd.widthHint = 50;
blueText.setLayoutData(gd);
tk.paintBordersFor(s1);
s1.setClient(client);
}
use of org.eclipse.ui.forms.widgets.TableWrapData in project eclipse-integration-commons by spring-projects.
the class DashboardMainPage method displayUpdate.
private void displayUpdate(final SyndEntry entry, String severity, Composite composite, int pos, Control[] children) {
ImageHyperlink link;
FormText text;
if (pos < children.length / 2) {
link = (ImageHyperlink) children[pos * 2];
link.setVisible(true);
text = (FormText) children[pos * 2 + 1];
text.setVisible(true);
} else {
link = toolkit.createImageHyperlink(composite, SWT.NONE);
text = new FormText(composite, SWT.WRAP | SWT.MULTI | SWT.NO_BACKGROUND | SWT.NO_FOCUS);
text.setHyperlinkSettings(toolkit.getHyperlinkGroup());
final TableWrapData data = new TableWrapData();
data.indent = UPDATE_INDENTATION;
data.maxWidth = updateSection.getSize().x - UPDATE_TEXT_WRAP_INDENT;
text.setLayoutData(data);
text.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
data.maxWidth = updateSection.getSize().x - UPDATE_TEXT_WRAP_INDENT;
}
});
text.setBackground(toolkit.getColors().getBackground());
text.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
if (e.data instanceof String) {
TasksUiUtil.openUrl((String) e.data);
}
}
});
}
link.setText(entry.getTitle());
TableWrapData linkData = new TableWrapData();
if ("important".equals(severity)) {
link.setImage(StsUiImages.getImage(StsUiImages.IMPORTANT));
linkData.indent = 0;
} else if ("warning".equals(severity)) {
link.setImage(StsUiImages.getImage(StsUiImages.WARNING));
linkData.indent = 0;
} else {
// link.setImage(IdeUiPlugin.getImage(ICON_BLOG_BLANK));
linkData.indent = UPDATE_INDENTATION - 1;
}
link.setLayoutData(linkData);
link.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
String url = entry.getLink();
if (url == null) {
return;
}
TasksUiUtil.openUrl(url);
}
});
String description = getDescription(entry);
if (entry.getPublishedDate() != null && description.endsWith("</p></form>")) {
String dateString = DateFormat.getDateInstance(DateFormat.MEDIUM).format(entry.getPublishedDate());
description = description.replace("</p></form>", " (" + dateString + ")</p></form>");
} else if (entry.getPublishedDate() != null) {
String dateString = DateFormat.getDateInstance(DateFormat.MEDIUM).format(entry.getPublishedDate());
description = description + " (" + dateString + ")";
}
text.setText(description, description.startsWith("<form>"), true);
text.setForeground(feedColor);
text.setBackground(toolkit.getColors().getBackground());
addImages(text, description);
}
use of org.eclipse.ui.forms.widgets.TableWrapData in project eclipse-integration-commons by spring-projects.
the class DashboardMainPage method displayFeed.
private void displayFeed(SyndEntry entry, Composite composite, final Section section, final int pos, Control[] children) {
ImageHyperlink link;
FormText text;
if (pos < children.length / 2) {
link = (ImageHyperlink) children[pos * 2];
link.setVisible(true);
text = (FormText) children[pos * 2 + 1];
text.setVisible(true);
} else {
final ImageHyperlink newLink = toolkit.createImageHyperlink(composite, SWT.NONE);
feedControls.add(newLink);
link = newLink;
link.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
Object source = e.getSource();
if (source instanceof ImageHyperlink && ((ImageHyperlink) source).getData() != null) {
SyndEntry entry = (SyndEntry) ((ImageHyperlink) source).getData();
String url = entry.getLink();
if (url == null) {
return;
}
int urlPos = url.indexOf("?");
String newUrl = url;
if (urlPos > 0) {
newUrl = url.substring(0, urlPos + 1) + url.substring(urlPos + 1).replaceAll("\\?", "&");
}
TasksUiUtil.openUrl(url);
prefStore.setValue(IIdeUiConstants.PREF_FEED_ENTRY_READ_STATE + ":" + newUrl, true);
IdeUiPlugin.getDefault().savePluginPreferences();
newLink.setImage(IdeUiPlugin.getImage(ICON_BLOG_BLANK));
}
}
});
// text = new Text(composite, SWT.WRAP | SWT.MULTI |
// SWT.NO_BACKGROUND);
text = new FormText(composite, SWT.WRAP | SWT.MULTI | SWT.NO_BACKGROUND | SWT.NO_FOCUS);
text.setHyperlinkSettings(toolkit.getHyperlinkGroup());
feedControls.add(text);
final TableWrapData data = new TableWrapData();
data.indent = UPDATE_INDENTATION;
data.maxWidth = section.getSize().x - FEEDS_TEXT_WRAP_INDENT;
data.grabVertical = true;
text.setLayoutData(data);
text.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
data.maxWidth = section.getSize().x - FEEDS_TEXT_WRAP_INDENT;
}
});
text.setForeground(feedColor);
text.setBackground(toolkit.getColors().getBackground());
}
String title = entry.getTitle();
Date entryDate = new Date(0);
if (entry.getUpdatedDate() != null) {
entryDate = entry.getUpdatedDate();
} else {
entryDate = entry.getPublishedDate();
}
String dateString = "";
if (entryDate != null) {
dateString = DateFormat.getDateInstance(DateFormat.MEDIUM).format(entryDate);
}
String entryAuthor = "";
if (entry.getAuthor() != null && entry.getAuthor().trim() != "") {
entryAuthor = " by " + entry.getAuthor();
}
if (dateString.length() > 0 && entryAuthor.length() > 0) {
link.setText(removeHtmlEntities(title));
}
TableWrapData linkData = new TableWrapData();
if (!prefStore.getBoolean(IIdeUiConstants.PREF_FEED_ENTRY_READ_STATE + ":" + entry.getLink())) {
link.setImage(IdeUiPlugin.getImage(ICON_BLOG_INCOMING));
linkData.indent = 0;
} else {
// link.setImage(IdeUiPlugin.getImage(ICON_BLOG_BLANK));
linkData.indent = UPDATE_INDENTATION - 1;
}
link.setLayoutData(linkData);
link.setData(entry);
String description = trimText(getDescription(entry));
text.setText(description + " (" + dateString + entryAuthor + ")", false, false);
}
use of org.eclipse.ui.forms.widgets.TableWrapData in project netxms by netxms.
the class AlarmComments method createEditorsSection.
/**
* Create comment list
*/
private void createEditorsSection() {
final Section details = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
details.setText(Messages.get().AlarmComments_Comments);
TableWrapData twd = new TableWrapData();
twd.grabHorizontal = true;
twd.align = TableWrapData.FILL;
details.setLayoutData(twd);
editorsArea = toolkit.createComposite(details);
GridLayout layout = new GridLayout();
editorsArea.setLayout(layout);
details.setClient(editorsArea);
linkAddComment = toolkit.createImageHyperlink(editorsArea, SWT.NONE);
// $NON-NLS-1$
linkAddComment.setImage(imageCache.add(Activator.getImageDescriptor("icons/new_comment.png")));
linkAddComment.setText(Messages.get().AlarmComments_AddCommentLink);
linkAddComment.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
addComment();
}
});
}
Aggregations