Package com.cxy.redisclient.dto

Examples of com.cxy.redisclient.dto.ContainerKeyInfo


      }
    }
  }

  private void deleteKey(Item item) {
    ContainerKeyInfo cinfo = new ContainerKeyInfo();
    TreeItem[] items = tree.getSelection();

    parseContainer(items[0], cinfo);

    String key = cinfo.getContainerStr();
    key += item.getText();

    service2.deleteKey(cinfo.getId(), cinfo.getDb(), key);
    item.dispose();
  }
View Full Code Here


    pBuffer = new PasteBuffer();

    for (Item item : itemsSelected) {
      TreeItem treeItem;

      ContainerKeyInfo cinfo = new ContainerKeyInfo();
      if (item instanceof TreeItem) {
        treeItem = (TreeItem) item;
      } else {
        treeItem = getTreeItemByTableItem((TableItem) item);
      }

      parseContainer(treeItem, cinfo);

      if (item instanceof TreeItem)
        pBuffer.cut(cinfo, treeItem);
      else {
        NodeType type = (NodeType) item.getData(NODE_TYPE);
        if (type == NodeType.CONTAINER || type == NodeType.DATABASE)
          pBuffer.cut(cinfo, treeItem);
        else {
          cinfo.setContainer(cinfo.getContainer(), item.getText());
          pBuffer.cut(cinfo, treeItem);
        }
      }
    }
  }
View Full Code Here

  }

  protected void dbContainerProperties() {
    TreeItem treeItem;

    ContainerKeyInfo cinfo = new ContainerKeyInfo();
    if (itemsSelected[0] instanceof TreeItem) {
      treeItem = (TreeItem) itemsSelected[0];
    } else {
      treeItem = getTreeItemByTableItem((TableItem) itemsSelected[0]);
    }

    parseContainer(treeItem, cinfo);

    NodeType type = (NodeType) treeItem.getData(NODE_TYPE);

    String str;
    String container;

    if (type == NodeType.DATABASE) {
      str = i18nFile.getText(I18nFile.TYPE) + ":\t"
          + i18nFile.getText(I18nFile.DATABASE) + "\n"
          + i18nFile.getText(I18nFile.LOCATION) + ":\t"
          + getLocation(cinfo) + "\n"
          + i18nFile.getText(I18nFile.KEY) + ":\t";
      container = "";
    } else {
      str = i18nFile.getText(I18nFile.TYPE) + ":\t"
          + i18nFile.getText(I18nFile.CONTAINER) + "\n"
          + i18nFile.getText(I18nFile.LOCATION) + ":\t"
          + getLocation(cinfo) + "\n"
          + i18nFile.getText(I18nFile.KEY) + ":\t";
      container = cinfo.getContainerStr();
    }

    Set<Node> nodes = service2.listContainerAllKeys(cinfo.getId(),
        cinfo.getDb(), container);
    str += nodes.size();

    String properties;

    if (type == NodeType.DATABASE)
View Full Code Here

  private void dataProperties() {
    TableItem[] items = table.getSelection();
    NodeType type = (NodeType) items[0].getData(NODE_TYPE);

    TreeItem treeItem = getTreeItemByTableItem(items[0]);
    ContainerKeyInfo cinfo = new ContainerKeyInfo();
    parseContainer(treeItem, cinfo);
    String key = cinfo.getContainerStr() + items[0].getText();

    if (!service2.isKeyExist(cinfo.getId(), cinfo.getDb(), key))
      throw new KeyNotExistException(cinfo.getId(), cinfo.getDb(), key);

    if (!openDataContent.isOpen(cinfo.getId(), cinfo.getDb(), key)) {
      final CTabItem tbtmNewItem = new CTabItem(tabFolder_1, SWT.NONE);
      tbtmNewItem.setText("New Item");
      tbtmNewItem.setShowClose(true);
      Composite composite_2 = new Composite(tabFolder_1, SWT.NONE);
      tbtmNewItem.setControl(composite_2);
      composite_2.setLayout(new GridLayout(1, false));
      tbtmNewItem.setText(key);
     
      tbtmNewItem.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
          DataContent dataContent = (DataContent) tbtmNewItem
              .getData();

          openDataContent.remove(dataContent);
          tbtmNewItem.dispose();
        }
      });

     
      DataContent content = null;
      if (type == NodeType.STRING) {
        tbtmNewItem.setImage(strImage);
        content = new StringDataContent(tbtmNewItem, iconImage, cinfo.getId(),
            cinfo.getServerName(), cinfo.getDb(), key,
            I18nFile.STRING);

      } else if (type == NodeType.HASH) {
        tbtmNewItem.setImage(hashImage);
        content = new HashDataContent(tbtmNewItem, iconImage, cinfo.getId(),
            cinfo.getServerName(), cinfo.getDb(), key,
            I18nFile.HASH);
      } else if (type == NodeType.LIST) {
        tbtmNewItem.setImage(listImage);
        content = new ListDataContent(tbtmNewItem, iconImage, cinfo.getId(),
            cinfo.getServerName(), cinfo.getDb(), key,
            I18nFile.LIST);
      } else if (type == NodeType.SET) {
        tbtmNewItem.setImage(setImage);
        content = new SetDataContent(tbtmNewItem, iconImage, cinfo.getId(),
            cinfo.getServerName(), cinfo.getDb(), key, I18nFile.SET);
      } else if (type == NodeType.SORTEDSET) {
        tbtmNewItem.setImage(zsetImage);
        content = new ZSetDataContent(tbtmNewItem, iconImage, cinfo.getId(),
            cinfo.getServerName(), cinfo.getDb(), key,
            I18nFile.ZSET);
      }
      content.setShell(composite_2);
      content.initContents();
      openDataContent.add(content);
      tabFolder_1.setSelection(tbtmNewItem);
    } else {
      tabFolder_1.setSelection(openDataContent.getTabItem(cinfo.getId(),
          cinfo.getDb(), key));
    }

  }
View Full Code Here

      @Override
      public void widgetSelected(SelectionEvent e) {
        if (flatView == true) {
          TreeItem[] treeItems = tree.getSelection();

          ContainerKeyInfo cinfo = new ContainerKeyInfo();
          parseContainer(treeItems[0], cinfo);

          flatView = false;
          updateView(cinfo);
        }
      }
    });
    mntmHierarchy.setText(i18nFile.getText(I18nFile.HIERARCHY));

    MenuItem mntmFlat = new MenuItem(menu_3, SWT.RADIO);
    mntmFlat.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        if (flatView == false) {
          TreeItem[] treeItems = tree.getSelection();

          ContainerKeyInfo cinfo = new ContainerKeyInfo();
          parseContainer(treeItems[0], cinfo);

          flatView = true;
          updateView(cinfo);
        }
View Full Code Here

    FindKeyDialog dialog = new FindKeyDialog(shell, iconImage);
    FindInfo info = (FindInfo) dialog.open();
    if (info != null) {
      TreeItem treeItem;

      ContainerKeyInfo cinfo = new ContainerKeyInfo();
      if (itemsSelected[0] instanceof TreeItem) {
        treeItem = (TreeItem) itemsSelected[0];
      } else {
        treeItem = getTreeItemByTableItem((TableItem) itemsSelected[0]);
      }

      parseContainer(treeItem, cinfo);
      NodeType searchFrom = (NodeType) treeItem.getData(NODE_TYPE);

      Set<Node> nodes = service2.find(searchFrom, cinfo.getId(),
          cinfo.getDb(), cinfo.getContainerStr(),
          info.getSearchNodeType(), info.getPattern(),
          info.isForward());
      if (!nodes.isEmpty()) {

        Node node = nodes.iterator().next();
        TreeItem selected = gotoDBContainer(node.getId(), node.getDb(),
            node.getKey(), true, true);
        history.add(selected);
        btnBackward.setEnabled(true);
        btnForward.setEnabled(false);

        fBuffer = new FindBuffer(node, searchFrom, cinfo.getId(),
            cinfo.getDb(), cinfo.getContainerStr(),
            info.getSearchNodeType(), info.getPattern());
      } else {
        MessageDialog.openInformation(shell,
            i18nFile.getText(I18nFile.FINDRESULTS),
            i18nFile.getText(I18nFile.NOFOUND));
View Full Code Here

            i18nFile.getText(I18nFile.FILEREPLACE));
      if (!exist || ok) {
        for (Item item : itemsSelected) {
          TreeItem treeItem;

          ContainerKeyInfo cinfo = new ContainerKeyInfo();
          if (item instanceof TreeItem) {
            treeItem = (TreeItem) item;
          } else {
            treeItem = getTreeItemByTableItem((TableItem) item);
          }
View Full Code Here

  }

  private void importFile() {
    TreeItem treeItem;

    ContainerKeyInfo cinfo = new ContainerKeyInfo();
    if (itemsSelected[0] instanceof TreeItem) {
      treeItem = (TreeItem) itemsSelected[0];
    } else {
      treeItem = getTreeItemByTableItem((TableItem) itemsSelected[0]);
    }

    parseContainer(treeItem, cinfo);

    FileDialog dialog = new FileDialog(shell, SWT.OPEN);
    dialog.setText(i18nFile.getText(I18nFile.IMPORTREDIS));
    String[] filterExt = { "*.*" };
    dialog.setFilterExtensions(filterExt);
    String file = dialog.open();
    if (file != null) {
      ImportService service = new ImportService(file, cinfo.getId(),
          cinfo.getDb());
      try {
        service.importFile();
      } catch (IOException e) {
        throw new RuntimeException(e.getMessage());
      }
View Full Code Here

  }

  private void renameContainer() {
    TreeItem treeItem;

    ContainerKeyInfo cinfo = new ContainerKeyInfo();
    if (itemsSelected[0] instanceof TreeItem)
      treeItem = (TreeItem) itemsSelected[0];
    else
      treeItem = getTreeItemByTableItem((TableItem) itemsSelected[0]);

    parseContainer(treeItem, cinfo);

    RenameKeysDialog dialog = new RenameKeysDialog(shell, iconImage,
        cinfo.getServerName(), cinfo.getDb(), cinfo.getContainerStr());
    RenameInfo rinfo = (RenameInfo) dialog.open();

    if (rinfo != null) {
      Set<String> result = service2.renameContainer(cinfo.getId(),
          cinfo.getDb(), cinfo.getContainerStr(),
          rinfo.getNewContainer(), rinfo.isOverwritten(),
          rinfo.isRenameSub());
      treeItem.getParentItem().setData(ITEM_OPENED, false);
      dbContainerTreeItemSelected(treeItem.getParentItem(), false);
      if (!rinfo.isOverwritten() && result.size() > 0) {
View Full Code Here

  private void copy() {
    pBuffer = new PasteBuffer();
    for (Item item : itemsSelected) {
      TreeItem treeItem;

      ContainerKeyInfo cinfo = new ContainerKeyInfo();
      if (item instanceof TreeItem) {
        treeItem = (TreeItem) item;
      } else {
        treeItem = getTreeItemByTableItem((TableItem) item);
      }

      parseContainer(treeItem, cinfo);

      if (item instanceof TreeItem)
        pBuffer.copy(cinfo);
      else {
        NodeType type = (NodeType) item.getData(NODE_TYPE);
        if (type == NodeType.CONTAINER || type == NodeType.DATABASE)
          pBuffer.copy(cinfo);
        else {
          cinfo.setContainer(cinfo.getContainer(), item.getText());
          pBuffer.copy(cinfo);
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.cxy.redisclient.dto.ContainerKeyInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.