int indexOf(String strThreadID) {
   int iMonitorCount = pnlThread.getComponentCount();
   for (int iMonitorIndex = 0; iMonitorIndex < iMonitorCount; iMonitorIndex++) {
     PanelThreadMonitor mntTemp = ((PanelThreadMonitor) pnlThread.getComponentAt(iMonitorIndex));
     if (mntTemp.mstrThreadID.equals(strThreadID)) return iMonitorIndex;
   }
   return -1;
 }
Esempio n. 2
0
  public void setCurrentLayout(int newId) {

    if (newId >= nviews) return;

    tabbedPane.removeAll();
    tabbedToolPanel.removeAll();
    String key;
    String currValue;
    JComponent obj;
    PushpinIF pobj;
    clearPushpinComp();
    for (int i = 0; i < keys.size(); i++) {
      key = (String) keys.get(i);
      currValue = (String) tp_paneInfo[newId].get(key);
      obj = (JComponent) panes.get(key);
      pobj = null;
      if (currValue.equals("yes") && obj != null) {
        if (obj instanceof PushpinIF) {
          pobj = (PushpinIF) obj;
          pobj.setAvailable(true);
          if (!pobj.isOpen()) {
            if (!pobj.isPopup()) obj = null;
          }
        }
        if (obj != null) {
          if (key.equals("Locator")) key = getLocatorName();
          tabbedPane.addTab(key, null, obj, "");
        }
        // tabbedPane.addTab(key, null, (JComponent)panes.get(key), "");
      }
    }

    if (tabbedPane.getTabCount() < 1) {
      pinPanel.setAvailable(false);
      pinPanel.setStatus("close");
      // setVisible(false);
      return;
    }

    pinPanel.setAvailable(true);
    pinPanel.setStatus("open");
    if (tabbedPane.getTabCount() == 1) {
      tabbedToolPanel.add(tabbedPane.getComponentAt(0));
      // tabbedToolPanel.add(tabbedPane);
    } else {
      tabbedToolPanel.add(tabbedPane);
    }
    setSelectedTab(tp_selectedTab, selectedTabName);

    tabbedToolPanel.validate();
    // repaint();
  }
Esempio n. 3
0
  public int getOpenCount() {
    int num = tabbedToolPanel.getComponentCount();
    if (num != 1) return num;
    Component comp = tabbedToolPanel.getComponent(0);
    if (comp instanceof JTabbedPane) {
      JTabbedPane tp = (JTabbedPane) comp;
      num = tp.getTabCount();
      if (num != 1) return num;
      comp = tp.getComponentAt(0);
    }
    if (comp instanceof VToolPanel) num = ((VToolPanel) comp).getOpenCount();
    else if (comp instanceof PushpinIF) {
      if (!((PushpinIF) comp).isOpen()) num = 0;
    }

    return num;
  }
  /*
   *	Tab has changed. Focus on saved component for the given tab.
   *  When there is no saved component, focus on the first component.
   */
  public void stateChanged(ChangeEvent e) {
    Component key = tabbedPane.getComponentAt(tabbedPane.getSelectedIndex());

    if (key == null) return;

    Component value = tabFocus.get(key);

    //  First time selecting this tab or focus policy is RESET_FOCUS

    if (value == null) {
      key.transferFocus();
      tabFocus.put(key, value);
    } else //  Use the saved component for focusing
    {
      value.requestFocusInWindow();
    }
  }
Esempio n. 5
0
  private Component getSelectedObj() {
    if (tabbedToolPanel.getComponentCount() < 1) return null;
    Component comp = tabbedToolPanel.getComponent(0);
    if (comp instanceof JTabbedPane) {
      JTabbedPane tp = (JTabbedPane) comp;
      if (tp.getTabCount() == 1) {
        comp = tp.getComponentAt(0);
      } else if (tp.getTabCount() > 1) {
        comp = tp.getSelectedComponent();
      }
    }
    if (comp instanceof VToolPanel) return comp;

    if (!(comp instanceof XMLToolPanel)) {
      if (comp instanceof PushpinIF) comp = ((PushpinIF) comp).getPinObj();
    }
    return comp;
  }
  private synchronized void doShowSalesReport() {

    BackOfficeWindow window = BackOfficeWindow.getInstance();
    JTabbedPane tabbedPane = window.getTabbedPane();

    ReportViewer viewer = null;
    //        int index = tabbedPane.indexOfTab(com.floreantpos.POSConstants.SALES_REPORT);
    int index = tabbedPane.indexOfTab("Transaksi Harian");
    if (index == -1) {
      //            viewer = new ReportViewer(new SalesReport());
      viewer = new ReportViewer(new DailyTxnReport());
      //            tabbedPane.addTab(POSConstants.SALES_REPORT, viewer);
      tabbedPane.addTab("Transaksi Harian", viewer);
    } else {
      viewer = (ReportViewer) tabbedPane.getComponentAt(index);
    }
    tabbedPane.setSelectedComponent(viewer);

    window.setVisible(true);
  }
 public void updateLanguage() {
   //////////////////////////////////////////////////////////////
   mdic = MonitorDictionary.getChildDictionary("ThreadManager");
   MonitorDictionary.applyButton(btnKick, "Kick");
   MonitorDictionary.applyButton(btnRefresh, "Refresh");
   MonitorDictionary.applyButton(btnSend, "Send");
   tblUser.setColumnNameEx(mdic.getString("LoginName"), 1);
   tblUser.setColumnNameEx(mdic.getString("LoginTime"), 2);
   tblUser.setColumnNameEx(mdic.getString("Host"), 3);
   //////////////////////////////////////////////////////////////
   MonitorDictionary.applyButton(mnuSelectAll, "jmenu.Edit.SelectAll");
   MonitorDictionary.applyButton(mnuClearAll, "jmenu.Edit.ClearAll");
   MonitorDictionary.applyButton(mnuClearSelected, "jmenu.Edit.ClearSelected");
   //////////////////////////////////////////////////////////////
   MonitorDictionary.applyButton(mnuSystem, "jmenu.System");
   MonitorDictionary.applyButton(mnuSystem_ChangePassword, "jmenu.System.ChangePassword");
   MonitorDictionary.applyButton(mnuSystem_StopServer, "jmenu.System.Shutdown");
   MonitorDictionary.applyButton(mnuSystem_EnableThreads, "jmenu.System.ThreadManager");
   MonitorDictionary.applyButton(mnuHelp, "jmenu.Help");
   MonitorDictionary.applyButton(mnuHelp_About, "jmenu.Help.About");
   //////////////////////////////////////////////////////////////
   MonitorDictionary.applyButton(mnuUI, "jmenu.UI");
   //////////////////////////////////////////////////////////////
   if (isOpen()) {
     lblStatus.setText(
         "  " + MonitorDictionary.getString("LoggedUser") + ": " + channel.getUserName());
     MonitorDictionary.applyButton(mnuSystem_Login, "jmenu.System.Logout");
     mnuSystem_ChangePassword.setEnabled(true);
     mnuSystem_StopServer.setEnabled(true);
     mnuSystem_EnableThreads.setEnabled(true);
   } else {
     lblStatus.setText("");
     MonitorDictionary.applyButton(mnuSystem_Login, "jmenu.System.Login");
     mnuSystem_ChangePassword.setEnabled(false);
     mnuSystem_StopServer.setEnabled(false);
     mnuSystem_EnableThreads.setEnabled(false);
   }
   //////////////////////////////////////////////////////////////
   for (int iIndex = 0; iIndex < pnlThread.getTabCount(); iIndex++)
     ((PanelThreadMonitor) pnlThread.getComponentAt(iIndex)).updateLanguage();
 }
Esempio n. 8
0
  private boolean containTool(JComponent obj) {
    int k, num;

    if (obj == null) return false;
    Component src = (Component) obj;
    Component comp;
    if (tabbedPane != null) {
      num = tabbedPane.getTabCount();
      for (k = 0; k < num; k++) {
        comp = tabbedPane.getComponentAt(k);
        if (src == comp) return true;
      }
    }
    if (tabbedToolPanel != null) {
      num = tabbedToolPanel.getComponentCount();
      for (k = 0; k < num; k++) {
        comp = tabbedToolPanel.getComponent(k);
        if (src == comp) return true;
      }
    }
    return false;
  }
  /*
   *  Track focus changes and update the current focus component
   *  for the current tab
   */
  public void propertyChange(PropertyChangeEvent e) {
    //  No need to track focus change

    if (exceptions == null && focusPolicy == RESET_FOCUS) return;

    //  Check for exceptions to the focus policy exist

    Component key = tabbedPane.getComponentAt(tabbedPane.getSelectedIndex());

    if (exceptions != null) {
      if (focusPolicy == RESET_FOCUS && !exceptions.contains(key)) return;

      if (focusPolicy == RETAIN_FOCUS && exceptions.contains(key)) return;
    }

    // Track focus changes for the tab

    Component value = (Component) e.getNewValue();

    if (value != null && SwingUtilities.isDescendingFrom(value, key)) {

      tabFocus.put(key, value);
    }
  }
  /*
   *  Specify a tab with an exception to the focus policy rule
   */
  public void addException(int index) {
    if (exceptions == null) exceptions = new HashSet<Component>();

    Component key = tabbedPane.getComponentAt(index);
    exceptions.add(key);
  }