Package net.sourceforge.squirrel_sql.client.session.properties

Examples of net.sourceforge.squirrel_sql.client.session.properties.SessionProperties


        result = createNiceMock(IApplication.class);
     } else {
        result = createMock(IApplication.class);
     }
     SquirrelResources resoures = getEasyMockSquirrelResources();
     SessionProperties props = getEasyMockSessionProperties(";", "--", true);
     SquirrelPreferences prefs = getEasyMockSquirrelPreferences(props);
     expect(result.getMainFrame()).andReturn(null).anyTimes();
     expect(result.getResources()).andReturn(resoures).anyTimes();
     expect(result.getSquirrelPreferences()).andReturn(prefs).anyTimes();
     TaskThreadPool mockThreadPool = FwTestUtil.getEasyMockTaskThreadPool();
View Full Code Here


    sessionUnderTest.setQueryTokenizer(customTokenizer2);
  }

   private SessionProperties getEasyMockSessionProperties() {
      // Simulate the user switching the statement separator for the session
      SessionProperties result = EasyMock.createMock(SessionProperties.class);
      expect(result.getSQLStatementSeparator()).andReturn(";").once();
      expect(result.getSQLStatementSeparator()).andReturn("FOO").once();
      expect(result.getStartOfLineComment()).andReturn("--").anyTimes();
      expect(result.clone()).andReturn(result);
      expect(result.getRemoveMultiLineComment()).andReturn(true).anyTimes();
      result.setSQLStatementSeparator(isA(String.class));
      expectLastCall().anyTimes();
      result.setStartOfLineComment(isA(String.class));
      expectLastCall().anyTimes();
      result.setRemoveMultiLineComment(EasyMock.anyBoolean());
      expectLastCall().anyTimes();
      replay(result);
      return result;
  }
View Full Code Here

      // MockConnection2 mockCon = getMockConnection();
      con = new SQLConnection(getMockConnection(), null, sqlDriver);
    }
    id = new UidIdentifier();
    messageHandler = new MockMessageHandler();
    props = new SessionProperties();
    props.setLoadSchemasCatalogs(false);
    app = new MockApplication();
    app.getMockSessionManager().setSession(this);
    sqlAlias = new SQLAlias(new UidIdentifier());
    schemaInfo = new SchemaInfo(app);
View Full Code Here

            //MockConnection2 mockCon = getMockConnection();
        con = new SQLConnection(getMockConnection(), null, sqlDriver);
      }
      id = new UidIdentifier();
      messageHandler = new MockMessageHandler();
      props = new SessionProperties();
      props.setLoadSchemasCatalogs(false);
      app = new MockApplication();
      app.getMockSessionManager().setSession(this);
      sqlAlias = new SQLAlias(new UidIdentifier());
      schemaInfo = new SchemaInfo(app);
View Full Code Here

  }

  private void propertiesHaveChanged(String propertyName)
  {
    final ISession session = getSession();
    final SessionProperties props = session.getProperties();
    if (propertyName == null
      || propertyName.equals(
        SessionProperties.IPropertyNames.COMMIT_ON_CLOSING_CONNECTION))
    {
            _app.getThreadPool().addTask(new Runnable() {
                public void run() {
                    session.getSQLConnection().setCommitOnClose(
                            props.getCommitOnClosingConnection());                   
                }
            });
    }
    if (propertyName == null
      || propertyName.equals(
        SessionProperties.IPropertyNames.SHOW_TOOL_BAR))
    {
      synchronized(this)
      {
        boolean show = props.getShowToolBar();
        if (show != (_toolBar != null))
        {
          if (show)
          {
            if (_toolBar == null)
View Full Code Here

    });
  }

  private void secureAddTab(ExplainTab tab)
  {
    SessionProperties props = _session.getProperties();

    if (s_log.isDebugEnabled())
    {
      s_log.debug("secureAddTab - TabCount: " + _tabbedExecutionsPanel.getTabCount());
      s_log.debug("secureAddTab - Limited?: " + props.getLimitSQLResultTabs());
      s_log.debug("secureAddTab - TabLimit: " + props.getSqlResultTabLimit());
    }

    if (props.getLimitSQLResultTabs()
      && props.getSqlResultTabLimit() <= _tabbedExecutionsPanel.getTabCount())
    {
      closeTabAt(0);
    }
    _tabbedExecutionsPanel.addTab(tab.getTitle(), null, tab, tab.getToolTip());
    _tabbedExecutionsPanel.setSelectedComponent(tab);
View Full Code Here

   public ObjectResultController(ISession session, HibernatePluginResources resource)
   {
      _session = session;
      _resource = resource;
      final SessionProperties props = session.getProperties();
      _objectResultTabbedPane = UIFactory.getInstance().createTabbedPane(props.getSQLExecutionTabPlacement());

   }
View Full Code Here

      }
   }

   private JTabbedPane createTabbedPane(DataSetViewerTablePanel tblDetails, DataSetViewerTablePanel tblDetailsMetaData, ISession session)
   {
      SessionProperties props = session.getProperties();
      JTabbedPane ret = UIFactory.getInstance().createTabbedPane(props.getSQLExecutionTabPlacement());

      ret.addTab(s_stringMgr.getString("SingleResultController.data"), new JScrollPane(tblDetails.getComponent()));
      ret.addTab(s_stringMgr.getString("SingleResultController.metaData"), new JScrollPane(tblDetailsMetaData.getComponent()));

      ret.setSelectedIndex(0);
View Full Code Here

              s_log.error("Unexpected exception: "+dse.getMessage(), dse);
          }
   }

   private JPanel buildMainPanel() {
      SessionProperties props = this.getSession().getProperties();

      JPanel panel = new JPanel();
      GridBagLayout gridBag = new GridBagLayout();
      panel.setLayout(gridBag);

      _frequency = new JSlider();
      _frequency.setMinimum(0);
      _frequency.setMaximum(20);
      _frequency.setValue(0);         // by default, it is not running.
      _frequency.setMajorTickSpacing(2);
      _frequency.setMinorTickSpacing(1);
      _frequency.setPaintLabels(true);
      _frequency.setPaintTicks(true);
      _frequency.setSnapToTicks(true);
      _frequency.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
           JSlider slider = (JSlider) e.getSource();
           if (slider.getValue() == 0) {
              // don't bother changing the delay, but stop it if it's running.
              if (_refreshTimer.isRunning())
                _refreshTimer.stop();
           }
           else {
              // change the delay, and start it if it was stopped.
              _refreshTimer.setDelay(slider.getValue() * 1000);
              if (!_refreshTimer.isRunning())
                _refreshTimer.start();
           }
           // i18n[mssql.delay={0}s delay]
           slider.setToolTipText(s_stringMgr.getString("mssql.delay", Integer.valueOf(slider.getValue())));
        }
      });
      addComponentToGridBag(0,0,1,1,0.0,0.0,GridBagConstraints.BOTH,gridBag,_frequency,panel);


      // i18n[mssql.refreshNow=Refresh Now]
      JButton refreshButton = new JButton(s_stringMgr.getString("mssql.refreshNow"));
      refreshButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
           if (!_haveSession)
              return;
           if (_inRefresh)
              return;
           _inRefresh = true;
           refreshData();
           _inRefresh = false;
        }
      });
      addComponentToGridBag(GridBagConstraints.RELATIVE,0,1,1,0.0,0.0,GridBagConstraints.NONE,gridBag,refreshButton,panel);

      _whoViewer = BaseDataSetViewerDestination.getInstance(props.getReadOnlySQLResultsOutputClassName(), null);
      JScrollPane whoScroll = new JScrollPane(_whoViewer.getComponent());
      // i18n[mssql.currentActivity=Current Activity]
      whoScroll.setBorder(BorderFactory.createTitledBorder(s_stringMgr.getString("mssql.currentActivity")));
      addComponentToGridBag(0,1,1,1,1.0,1.0,GridBagConstraints.BOTH,gridBag,whoScroll,panel);

      _perfViewer = BaseDataSetViewerDestination.getInstance(props.getReadOnlySQLResultsOutputClassName(), null);
      JScrollPane perfScroll = new JScrollPane(_perfViewer.getComponent());
      // i18n[mssql.performace=Performance Counters]
      perfScroll.setBorder(BorderFactory.createTitledBorder(s_stringMgr.getString("mssql.performace")));
      addComponentToGridBag(GridBagConstraints.RELATIVE,1,1,1,1.0,1.0,GridBagConstraints.BOTH,gridBag,perfScroll,panel);

View Full Code Here

  public Component getComponent()
  {
        if (_comp == null)
        {
            ISession session = getSession();
            SessionProperties props = session.getProperties();
            String destClassName = props.getMetaDataOutputClassName();
            try {
                _comp = new DataSetScrollingPanel(destClassName, null);
            } catch (Exception e) {
                s_log.error("Unexpected exception from call to getComponent: "+
                            e.getMessage(), e);
View Full Code Here

TOP

Related Classes of net.sourceforge.squirrel_sql.client.session.properties.SessionProperties

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.