use of org.netxms.ui.eclipse.widgets.FilterText in project netxms by netxms.
the class RepositoryManager method createPartControl.
/* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
content = new Composite(parent, SWT.NONE);
content.setLayout(new FormLayout());
// Create filter area
filterText = new FilterText(content, SWT.NONE);
filterText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
onFilterModify();
}
});
filterText.setCloseAction(new Action() {
@Override
public void run() {
enableFilter(false);
}
});
final String[] columnNames = { "Name", "Version", "GUID" };
final int[] columnWidths = { 300, 120, 150 };
viewer = new SortableTreeViewer(content, columnNames, columnWidths, 0, SWT.UP, SortableTableViewer.DEFAULT_STYLE);
WidgetHelper.restoreTreeViewerSettings(viewer, Activator.getDefault().getDialogSettings(), TABLE_CONFIG_PREFIX);
viewer.setContentProvider(new RepositoryContentProvider(this));
viewer.setLabelProvider(new RepositoryLabelProvider());
// viewer.setComparator(new AgentFileComparator());
filter = new RepositoryFilter();
viewer.addFilter(filter);
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
if (selection != null) {
actionDelete.setEnabled(selection.size() > 0);
}
}
});
viewer.getTree().addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
WidgetHelper.saveTreeViewerSettings(viewer, Activator.getDefault().getDialogSettings(), TABLE_CONFIG_PREFIX);
}
});
// Setup layout
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(filterText);
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(100, 0);
viewer.getTree().setLayoutData(fd);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
filterText.setLayoutData(fd);
createActions();
contributeToActionBars();
createPopupMenu();
activateContext();
filterText.setCloseAction(actionShowFilter);
// Set initial focus to filter input line
if (filterEnabled)
filterText.setFocus();
else
// Will hide filter area correctly
enableFilter(false);
refreshRepositoryList();
}
use of org.netxms.ui.eclipse.widgets.FilterText in project netxms by netxms.
the class EventProcessingPolicyEditor method createPartControl.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
session = (NXCSession) ConsoleSharedData.getSession();
IDialogSettings settings = Activator.getDefault().getDialogSettings();
// $NON-NLS-1$
filterEnabled = settings.getBoolean("EventProcessingPolicyEditor.filterEnabled");
// Initiate loading of required plugins if they was not loaded yet
try {
// $NON-NLS-1$
Platform.getAdapterManager().loadAdapter(new EventTemplate(0), "org.eclipse.ui.model.IWorkbenchAdapter");
// $NON-NLS-1$
Platform.getAdapterManager().loadAdapter(new ServerAction(0), "org.eclipse.ui.model.IWorkbenchAdapter");
// $NON-NLS-1$
Platform.getAdapterManager().loadAdapter(session.getTopLevelObjects()[0], "org.eclipse.ui.model.IWorkbenchAdapter");
} catch (Exception e) {
}
// $NON-NLS-1$
imageStop = Activator.getImageDescriptor("icons/stop.png").createImage();
// $NON-NLS-1$
imageAlarm = Activator.getImageDescriptor("icons/alarm.png").createImage();
// $NON-NLS-1$
imageSituation = Activator.getImageDescriptor("icons/situation.gif").createImage();
// $NON-NLS-1$
imageExecute = Activator.getImageDescriptor("icons/execute.png").createImage();
// $NON-NLS-1$
imageTerminate = Activator.getImageDescriptor("icons/terminate.png").createImage();
imageCollapse = SharedIcons.COLLAPSE.createImage();
imageExpand = SharedIcons.EXPAND.createImage();
imageEdit = SharedIcons.EDIT.createImage();
parent.setLayout(new FormLayout());
// Create filter area
filterControl = new FilterText(parent, SWT.NONE);
filterControl.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
onFilterModify();
}
});
filterControl.setCloseAction(new Action() {
@Override
public void run() {
enableFilter(false);
}
});
scroller = new ScrolledComposite(parent, SWT.V_SCROLL);
dataArea = new Composite(scroller, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = 0;
dataArea.setLayout(layout);
dataArea.setBackground(BACKGROUND_COLOR);
scroller.setContent(dataArea);
scroller.setExpandVertical(true);
scroller.setExpandHorizontal(true);
scroller.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
Rectangle r = scroller.getClientArea();
scroller.setMinSize(dataArea.computeSize(r.width, SWT.DEFAULT));
}
});
// Setup layout
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(filterControl);
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(100, 0);
scroller.setLayoutData(fd);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
filterControl.setLayoutData(fd);
normalFont = JFaceResources.getDefaultFont();
boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
sessionListener = new SessionListener() {
@Override
public void notificationHandler(SessionNotification n) {
processSessionNotification(n);
}
};
session.addListener(sessionListener);
selection = new TreeSet<RuleEditor>(new Comparator<RuleEditor>() {
@Override
public int compare(RuleEditor arg0, RuleEditor arg1) {
return arg0.getRuleNumber() - arg1.getRuleNumber();
}
});
createActions();
contributeToActionBars();
openEventProcessingPolicy();
activateContext();
// Set initial focus to filter input line
if (filterEnabled)
filterControl.setFocus();
else
// Will hide filter area correctly
enableFilter(false);
}
use of org.netxms.ui.eclipse.widgets.FilterText in project netxms by netxms.
the class AlarmCategorySelectionDialog method createDialogArea.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite dialogArea = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout();
layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
layout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
layout.numColumns = 2;
dialogArea.setLayout(layout);
// Create filter area
filterText = new FilterText(dialogArea, SWT.NONE, null, false);
filterText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
onFilterModify();
}
});
GridData gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
filterText.setLayoutData(gd);
alarmCategoryList = new AlarmCategoryList(dialogArea, SWT.NONE, TABLE_CONFIG_PREFIX, false);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.horizontalSpan = 2;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
gd.heightHint = 350;
alarmCategoryList.setLayoutData(gd);
alarmCategoryList.getViewer().addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
okPressed();
}
});
return dialogArea;
}
use of org.netxms.ui.eclipse.widgets.FilterText in project netxms by netxms.
the class ServerFileManager method createPartControl.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
session = (NXCSession) ConsoleSharedData.getSession();
content = new Composite(parent, SWT.NONE);
content.setLayout(new FormLayout());
// Create filter area
filterText = new FilterText(content, SWT.NONE);
filterText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
onFilterModify();
}
});
final String[] columnNames = { Messages.get().ViewServerFile_FileName, Messages.get().ViewServerFile_FileType, Messages.get().ViewServerFile_FileSize, Messages.get().ViewServerFile_ModificationDate };
final int[] columnWidths = { 300, 150, 300, 300 };
viewer = new SortableTableViewer(content, columnNames, columnWidths, 0, SWT.UP, SortableTableViewer.DEFAULT_STYLE);
WidgetHelper.restoreTableViewerSettings(viewer, Activator.getDefault().getDialogSettings(), TABLE_CONFIG_PREFIX);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new ServerFileLabelProvider());
viewer.setComparator(new ServerFileComparator());
filter = new ServerFileFilter();
viewer.addFilter(filter);
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
if (selection != null) {
actionDelete.setEnabled(selection.size() > 0);
}
}
});
viewer.getTable().addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
WidgetHelper.saveTableViewerSettings(viewer, Activator.getDefault().getDialogSettings(), TABLE_CONFIG_PREFIX);
}
});
// Setup layout
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(filterText);
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(100, 0);
viewer.getTable().setLayoutData(fd);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
filterText.setLayoutData(fd);
createActions();
contributeToActionBars();
createPopupMenu();
activateContext();
session.addListener(this);
filterText.setCloseAction(actionShowFilter);
// Set initial focus to filter input line
if (initShowFilter)
filterText.setFocus();
else
// Will hide filter area correctly
enableFilter(false);
refreshFileList();
}
use of org.netxms.ui.eclipse.widgets.FilterText in project netxms by netxms.
the class WorldMap method createPartControl.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.osm.views.AbstractGeolocationView#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
IDialogSettings settings = Activator.getDefault().getDialogSettings();
initialZoom = settings.get(ID + "zoom") != null ? settings.getInt(ID + "zoom") : 2;
if (settings.get(ID + "latitude") != null && settings.get(ID + "longitude") != null)
initialLocation = new GeoLocation(settings.getDouble(ID + "latitude"), settings.getDouble(ID + "longitude"));
filterEnabled = settings.get(ID + "filterEnabled") != null ? settings.getBoolean(ID + "filterEnabled") : true;
super.createPartControl(parent);
parent.setLayout(new FormLayout());
// Create filter area
filterControl = new FilterText(parent, SWT.NONE);
filterControl.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
onFilterModify();
}
});
filterControl.setCloseAction(new Action() {
@Override
public void run() {
enableFilter(false);
}
});
// Setup layout
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(filterControl);
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(100, 0);
map.setLayoutData(fd);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
filterControl.setLayoutData(fd);
// Set initial focus to filter input line
if (filterEnabled)
filterControl.setFocus();
else
// Will hide filter area correctly
enableFilter(false);
}
Aggregations