}
});
activeOnlyCheckBox = new CheckBox();
activeOnlyCheckBox.setBoxLabel(textMessages.activeOnly());
activeOnlyCheckBox.setValue(true);
northPanel.add(searchTextBox, new HBoxLayoutData(new Margins(0, 5, 0, 0)));
northPanel.add(searchButton, new HBoxLayoutData(new Margins(0, 5, 0, 0)));
northPanel.add(activeOnlyCheckBox, new HBoxLayoutData(new Margins(0, 5, 0, 5)));
treeStore = new TreeStore<TagData>();
tagTree = new TreePanel<TagData>(treeStore);
tagTree.setBorders(true);
tagTree.sinkEvents(Event.ONDBLCLICK);
tagTree.addListener(Events.OnDoubleClick, new Listener<TreePanelEvent<TagData>>() {
public void handleEvent(TreePanelEvent<TagData> be)
{
TagData clickedTag = be.getItem();
List<TagData> checkedTags = tagTree.getCheckedSelection();
for (TagData checkedTag : checkedTags)
{
tagTree.setChecked(checkedTag, false);
}
tagTree.setChecked(clickedTag, true);
doSearch();
}
});
tagTree.setCheckStyle(CheckCascade.NONE);
tagTree.setCheckNodes(CheckNodes.LEAF);
tagTree.setCheckable(true);
tagTree.setDisplayProperty(Constants.NAME);
tagTree.setWidth(250);
centerPanel.setScrollMode(Scroll.AUTOX);
List<ColumnConfig> configs = new ArrayList<ColumnConfig>(4);
ColumnConfig column = new ColumnConfig();
//column.setToolTip(TOOLTIP_EDIT_PASSWORD);
column.setId(Constants.TITLE);
column.setHeader(textMessages.title());
column.setWidth(200);
configs.add(column);
column = new ColumnConfig();
column.setId(Constants.USERNAME);
column.setHeader(textMessages.username());
column.setWidth(100);
configs.add(column);
column = new ColumnConfig();
//column.setToolTip(TOOLTIP_VIEW_PASSWORD_VALUE);
column.setId(Constants.PASSWORD);
column.setHeader(textMessages.password());
column.setWidth(100);
configs.add(column);
column = new ColumnConfig();
column.setId(Constants.TAGS);
column.setHeader(textMessages.tags());
column.setWidth(200);
configs.add(column);
column = new ColumnConfig();
column.setId(Constants.NOTES);
column.setHeader(textMessages.notes());
column.setWidth(300);
configs.add(column);
gridStore = new ListStore<PasswordSearchData>();
ColumnModel cm = new ColumnModel(configs);
passwordGrid = new Grid<PasswordSearchData>(gridStore, cm);
passwordGrid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
passwordGrid.setStyleAttribute("borderTop", "none");
passwordGrid.setBorders(true);
passwordGrid.setStripeRows(true);
passwordGrid.addListener(Events.CellDoubleClick, new Listener<GridEvent<PasswordSearchData>>()
{
@Override
public void handleEvent(GridEvent<PasswordSearchData> ge)
{
if (2 == ge.getColIndex())
{
doShowPasswordPopup((Long)ge.getModel().get(Constants.ID));
}
else
{
doLoadPasswordDialog((Long)ge.getModel().get(Constants.ID));
}
}
});
centerPanel.add(passwordGrid);
BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, 100);
northData.setCollapsible(true);
northData.setFloatable(false);
northData.setHideCollapseTool(false);
northData.setSplit(true);
northData.setMargins(new Margins(5, 5, 0, 5));
BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 150);
westData.setSplit(true);
westData.setCollapsible(true);
westData.setMargins(new Margins(5));
radioOR = new Radio();
radioOR.setBoxLabel(textMessages.or());
radioOR.setValue(true);
radioAND = new Radio();
radioAND.setBoxLabel(textMessages.and());
tagMatchRG = new RadioGroup();
tagMatchRG.setBorders(true);
tagMatchRG.add(radioOR);
tagMatchRG.add(radioAND);
westPanel.setLayout(new RowLayout(Orientation.VERTICAL));
westPanel.add(tagTree, new RowData(1, 1));
westPanel.add(tagMatchRG, new RowData(1, -1));
BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
centerData.setMargins(new Margins(5, 0, 5, 0));
add(northPanel, northData);
add(westPanel, westData);
add(centerPanel, centerData);