use of org.eclipse.swt.layout.FormLayout in project tdi-studio-se by Talend.
the class RuntimeGraphcsComposite method createControls.
@Override
protected void createControls(Composite parent) {
chartsPage = new Composite(parent, SWT.NULL);
parent.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
chartsPage.setBackground(parent.getBackground());
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = 0;
formLayout.marginHeight = 0;
chartsPage.setLayout(formLayout);
FormData pageData = new FormData();
pageData.top = new FormAttachment(0, 0);
pageData.bottom = new FormAttachment(100, 0);
pageData.left = new FormAttachment(0, 0);
pageData.right = new FormAttachment(100, 0);
chartsPage.setLayoutData(pageData);
mBeanServerChangeListener = new IMBeanServerChangeListener() {
@Override
public void serverChanged(MBeanServerEvent event) {
new RefreshJob(Messages.reconstructChartJobLabel, toString()) {
@Override
protected void refreshUI() {
IActiveJvm jvm = getJvm();
if (jvm != null) {
reconstructCharts(jvm, false);
}
}
}.schedule();
}
};
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIds.TIMELINE_PAGE);
}
use of org.eclipse.swt.layout.FormLayout in project tdi-studio-se by Talend.
the class RuntimeGraphcsComposite method createReportField.
/* private void createInfoField(Composite parent) {
infoComposite = createFlatFormComposite(parent, new FormToolkit(Display.getDefault()));
FormLayout reportLayout = new FormLayout();
reportLayout.marginWidth = 0;
reportLayout.marginHeight = 0;
infoComposite.setLayout(reportLayout);
FormData reportData = new FormData();
reportData.left = new FormAttachment(65, 5);
reportData.right = new FormAttachment(100, -5);
reportData.top = new FormAttachment(50, 0);
reportData.bottom = new FormAttachment(100, -5);
infoComposite.setLayoutData(reportData);
Group group = new Group(infoComposite, SWT.NULL);
FormLayout groupLayout = new FormLayout();
groupLayout.marginWidth = 0;
groupLayout.marginHeight = 0;
group.setLayout(groupLayout);
FormData groupData = new FormData();
groupData.left = new FormAttachment(0, 0);
groupData.right = new FormAttachment(100, 0);
groupData.top = new FormAttachment(0, 0);
groupData.bottom = new FormAttachment(100, 0);
group.setLayoutData(groupData);
group.setText("Run job Informations");
infoField = new Text(group, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
infoField.setEditable(false);
infoField.setBackground(group.getBackground());
FormData data;
data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, 0);
data.bottom = new FormAttachment(100, 0);
infoField.setLayoutData(data);
}*/
private void createReportField(Composite parent) {
reportComposite = createFlatFormComposite(parent, new FormToolkit(Display.getDefault()));
FormLayout reportLayout = new FormLayout();
reportComposite.setLayout(reportLayout);
FormData reportData = new FormData();
reportData.left = new FormAttachment(65, 5);
reportData.right = new FormAttachment(100, -5);
reportData.top = new FormAttachment(0, 0);
reportData.bottom = new FormAttachment(100, -5);
reportComposite.setLayoutData(reportData);
Group group = new Group(reportComposite, SWT.NULL);
FormLayout groupLayout = new FormLayout();
group.setLayout(groupLayout);
FormData groupData = new FormData();
groupData.left = new FormAttachment(0, 0);
groupData.right = new FormAttachment(100, 0);
groupData.top = new FormAttachment(0, 0);
groupData.bottom = new FormAttachment(100, 0);
group.setLayoutData(groupData);
//$NON-NLS-1$
group.setText("Job execution information");
reportField = new StyledText(group, SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
//may be CoreUIPlugin.setCSSClass can do this globally ,check later
reportField.setBackground(getDisplay().getSystemColor(SWT.COLOR_WHITE));
FormData data;
data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, 0);
data.bottom = new FormAttachment(93, 0);
reportField.setLayoutData(data);
displayReportField();
//export button
Button exportButton = new Button(group, SWT.PUSH);
//$NON-NLS-1$
exportButton.setText("Export");
FormData exportData = new FormData();
exportData.left = new FormAttachment(100, -70);
exportData.right = new FormAttachment(100, 0);
exportData.bottom = new FormAttachment(100, -1);
exportButton.setLayoutData(exportData);
exportButton.setEnabled(true);
exportButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (messageManager == null || messageManager.getMessages().size() < 1) {
//$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.openWarning(getShell(), "Warning", "No log to export.");
return;
}
UnboundedFifoBuffer messages = messageManager.getMessages();
Iterator iterator = messages.iterator();
StringBuilder content = new StringBuilder();
while (iterator.hasNext()) {
ReportMessage message = (ReportMessage) iterator.next();
content.append(message.getContent());
}
if (isMonitoring) {
//$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.openWarning(getShell(), "Warning", "Waiting for job done.");
return;
}
FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
//$NON-NLS-1$
dialog.setFilterPath(".");
String fileName = dialog.open();
if (fileName != null) {
FileWriter writer = null;
try {
writer = new FileWriter(fileName);
writer.write(content.toString());
} catch (IOException e1) {
e1.printStackTrace();
} finally {
try {
if (writer != null) {
writer.close();
}
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
});
}
use of org.eclipse.swt.layout.FormLayout in project tdi-studio-se by Talend.
the class RuntimeGraphcsComposite method reconstructCharts.
void reconstructCharts(IActiveJvm activeJvm, boolean connected) {
if (chartsPage.isDisposed()) {
return;
}
if (connected) {
try {
loadOverviewChartSet(activeJvm);
} catch (JvmCoreException e) {
Activator.log(Messages.configureMonitoredAttributesFailedMsg, e);
}
}
List<IMonitoredMXBeanGroup> groups = activeJvm.getMBeanServer().getMonitoredAttributeGroups();
if (groups.size() == 0) {
return;
}
for (TimelineChart chart : charts) {
chart.dispose();
}
charts.clear();
if (chartComposite != null && !chartComposite.isDisposed()) {
chartComposite.dispose();
}
chartComposite = new Composite(chartsPage, SWT.NONE);
FormLayout chartLayout = new FormLayout();
chartLayout.marginHeight = 0;
chartLayout.marginWidth = 0;
chartComposite.setLayout(chartLayout);
FormData chartComData = new FormData();
chartComData.top = new FormAttachment(0, 0);
chartComData.bottom = new FormAttachment(100, 0);
chartComData.left = new FormAttachment(0, 0);
chartComData.right = new FormAttachment(100, 0);
chartComposite.setLayoutData(chartComData);
for (IMonitoredMXBeanGroup group : groups) {
createSection(chartComposite, group);
}
createReportField(chartComposite);
// createInfoField(chartComposite);
chartsPage.layout();
chartsPage.setVisible(true);
refresh();
}
use of org.eclipse.swt.layout.FormLayout in project tdi-studio-se by Talend.
the class RuntimeGraphcsComposite method createMessagePage.
private Composite createMessagePage(Composite parent) {
messagePage = new Composite(parent, SWT.NONE);
FormLayout messageLayout = new FormLayout();
messageLayout.marginHeight = 0;
messageLayout.marginWidth = 0;
messagePage.setLayout(messageLayout);
messagePage.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
FormToolkit toolkit = new FormToolkit(Display.getDefault());
Hyperlink hyperlink = toolkit.createHyperlink(messagePage, Messages.loadDefaultChartSetLabel, SWT.NONE);
hyperlink.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent event) {
try {
new LoadChartAction(RuntimeGraphcsComposite.this).loadDefaultChartSet();
} catch (JvmCoreException e) {
Activator.log(Messages.loadChartSetFailedMsg, e);
}
}
});
return messagePage;
}
use of org.eclipse.swt.layout.FormLayout in project tdi-studio-se by Talend.
the class RuntimeGraphcsComposite method createSection.
private void createSection(Composite parent, IMonitoredMXBeanGroup group) {
if (parent.isDisposed()) {
return;
}
FormToolkit tookit = new FormToolkit(Display.getDefault());
ExpandableComposite section = tookit.createSection(parent, ExpandableComposite.NO_TITLE);
section.setText(group.getName());
FormLayout sectionLayout = new FormLayout();
sectionLayout.marginWidth = 0;
sectionLayout.marginHeight = 0;
section.setLayout(sectionLayout);
FormData sectionData = new FormData();
if (group.getName().equals(MonitorAttributeName.HEAP_MEMORY)) {
sectionData.left = new FormAttachment(0, 0);
sectionData.right = new FormAttachment(65, 0);
sectionData.top = new FormAttachment(0, 6);
sectionData.bottom = new FormAttachment(53, -5);
} else if (group.getName().equals(MonitorAttributeName.THREAD_COUNT)) {
sectionData.left = new FormAttachment(50, 5);
sectionData.right = new FormAttachment(100, -5);
sectionData.top = new FormAttachment(50, 2);
sectionData.bottom = new FormAttachment(100, 0);
} else if (group.getName().equals(MonitorAttributeName.CPU_USE)) {
sectionData.left = new FormAttachment(0, 0);
sectionData.right = new FormAttachment(65, 0);
sectionData.top = new FormAttachment(53, 0);
sectionData.bottom = new FormAttachment(100, -6);
}
section.setLayoutData(sectionData);
Composite flatFormComposite = createFlatFormComposite(section, tookit);
FormLayout formLayout = new FormLayout();
formLayout.marginHeight = 0;
formLayout.marginWidth = 0;
flatFormComposite.setLayout(formLayout);
TimelineChart chart = new TimelineChart(flatFormComposite, section, group, SWT.NONE, toString() + getJvm().getPid());
charts.add(chart);
FormData data;
data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, 0);
data.bottom = new FormAttachment(100, 0);
chart.setLayoutData(data);
section.setClient(flatFormComposite);
ArrayList<Action> list = new ArrayList<Action>();
list.add(garbageCollectorAction);
if (group.getName().equals(MonitorAttributeName.HEAP_MEMORY)) {
addSectionActions(section, list);
}
}
Aggregations