Пример #1
0
        /// <summary>
        /// Show popups for each rectangle, using the now configured painter.
        /// </summary>
        private void showPopups(Rectangle[] rects, Rectangle bds, Rectangle visible, JComponent comp, JScrollPane view)
        {
            bool shown = false;

            for (int i = 0; i < rects.Length; i++)
            {
                Rectangle sect = rects[i];
                sect.translate(-bds.x, -bds.y);
                ImgComp part = painter.getPartial(sect, bds.x + rects[i].x < visible.x);
                Point   pos  = new Point(bds.x + rects[i].x, bds.y + rects[i].y);
                SwingUtilities.convertPointToScreen(pos, comp);
                if (comp is JList)
                {
                    //XXX off by one somewhere, only with JLists - where?
                    pos.y--;
                }
                if (pos.x > 0)
                {                 //Mac OS will reposition off-screen popups to x=0,
                    //so don't try to show them
                    popups[i] = PopupFactory.getPopup(view, part, pos.x, pos.y);
                    popups[i].show();
                    shown = true;
                }
            }
            if (shown)
            {
                setHideComponent(comp, view);
            }
            else
            {
                setHideComponent(null, null);                 //clear references
            }
        }
Пример #2
0
        private void showJTree(JScrollPane view, Point pt)
        {
            JTree     tree = (JTree)view.Viewport.View;
            Point     p    = SwingUtilities.convertPoint(view, pt.x, pt.y, tree);
            int       row  = tree.getClosestRowForLocation(p.x, p.y);
            TreePath  path = tree.getClosestPathForLocation(p.x, p.y);
            Rectangle bds  = tree.getPathBounds(path);

            if (bds == null || !bds.contains(p))
            {
                hide();
                return;
            }
            if (setCompAndRow(tree, row))
            {
                Rectangle   visible = getShowingRect(view);
                Rectangle[] rects   = getRects(bds, visible);
                if (rects.Length > 0)
                {
                    ensureOldPopupsHidden();
                    painter.configure(path.LastPathComponent, view, tree, path, row);
                    showPopups(rects, bds, visible, tree, view);
                }
                else
                {
                    hide();
                }
            }
        }
Пример #3
0
 public virtual void SafeRefreshImage()
 {
     SwingUtilities.invokeLater(() =>
     {
         RefreshImage();
     });
 }
Пример #4
0
        public static void EnableVisualStyles(this Applet a)
        {
            // a dirty redirect.
            Application.EnableVisualStyles();

            SwingUtilities.updateComponentTreeUI(a);
        }
Пример #5
0
 public virtual void forceTotalTimes(int paramInt)
 {
     if (SwingUtilities.EventDispatchThread)
     {
         this.o_totalTimes          = paramInt;
         this.o_timeToInvoke        = 1;
         this.o_progressBar.Minimum = 0;
         this.o_progressBar.Maximum = paramInt;
     }
     else
     {
         try
         {
             SwingUtilities.invokeAndWait(new ForceTotalTimes(this, paramInt));
         }
         catch (InterruptedException interruptedException)
         {
             Console.WriteLine(interruptedException.ToString());
             Console.Write(interruptedException.StackTrace);
         }
         catch (InvocationTargetException invocationTargetException)
         {
             Console.WriteLine(invocationTargetException.ToString());
             Console.Write(invocationTargetException.StackTrace);
         }
     }
 }
Пример #6
0
 public static void Main(string[] args)
 {
     SwingUtilities.invokeLater(() =>
     {
         new LightSwitch();
     });
 }
 public void mouseClicked(MouseEvent me)
 {
     // if right mouse button clicked (or me.isPopupTrigger())
     if (SwingUtilities.isRightMouseButton(me))
     {
         popupMenu.show(outerInstance.__annotationJList, me.getX(), me.getY());
     }
 }
Пример #8
0
 public void actionPerformed(ActionEvent param1ActionEvent)
 {
     outerInstance.t.stop();
     SwingUtilities.invokeLater(() =>
     {
         outerInstance.previousFocus.requestFocus();
     });
 }
Пример #9
0
        private void showJList(JScrollPane view, Point pt)
        {
            JList list = (JList)view.Viewport.View;
            Point p    = SwingUtilities.convertPoint(view, pt.x, pt.y, list);
            int   row  = list.locationToIndex(p);

            if (row == -1)
            {
                hide();
                return;
            }
            Rectangle bds = list.getCellBounds(row, row);
            //GetCellBounds returns a width that is the
            //full component width;  we want only what
            //the renderer really needs.
            ListCellRenderer ren          = list.CellRenderer;
            Dimension        rendererSize = ren.getListCellRendererComponent(list, list.Model.getElementAt(row), row, false, false).PreferredSize;

            // fix for possible npe spotted by SCO
            // http://pspsharp.org/forum/viewtopic.php?p=3387#p3387
            if (bds == null)
            {
                hide();
                return;
            }

            bds.width = rendererSize.width;

            if (!bds.contains(p))
            {
                hide();
                return;
            }

            //bds.width = rendererSize.width;
            //if (bds == null || !bds.contains(p)) {
            //    hide();
            //    return;
            //}
            // end "fix for possible npe spotted by SCO"

            if (setCompAndRow(list, row))
            {
                Rectangle   visible = getShowingRect(view);
                Rectangle[] rects   = getRects(bds, visible);
                if (rects.Length > 0)
                {
                    ensureOldPopupsHidden();
                    painter.configure(list.Model.getElementAt(row), view, list, row);
                    showPopups(rects, bds, visible, list, view);
                }
                else
                {
                    hide();
                }
            }
        }
Пример #10
0
 /// <summary>Run the GUI.</summary>
 /// <remarks>
 /// Run the GUI.  This program accepts no command-line arguments.
 /// Everything is entered into the GUI.
 /// </remarks>
 public static void Main(string[] args)
 {
     //Schedule a job for the event-dispatching thread:
     //creating and showing this application's GUI.
     if (IsMacOSX())
     {
         Runtime.SetProperty("apple.laf.useScreenMenuBar", "true");
     }
     SwingUtilities.InvokeLater(null);
 }
Пример #11
0
		public virtual void eventDispatched(AWTEvent param1AWTEvent)
		{
		  bool @bool;
		  if (!(param1AWTEvent is MouseEvent))
		  {
			return;
		  }
		  MouseEvent mouseEvent = (MouseEvent)param1AWTEvent;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.awt.Component src = mouseEvent.getComponent();
		  Component src = mouseEvent.Component;
		  JPopupPanel jPopupPanel = (JPopupPanel)SwingUtilities.getAncestorOfClass(typeof(JPopupPanel), component);
		  if (jPopupPanel == null)
		  {
			CostOSRibbonApplicationMenuPopupPanel.CostOSApplicationMenuContainerPanel costOSApplicationMenuContainerPanel = (CostOSRibbonApplicationMenuPopupPanel.CostOSApplicationMenuContainerPanel)SwingUtilities.getAncestorOfClass(typeof(CostOSRibbonApplicationMenuPopupPanel.CostOSApplicationMenuContainerPanel), component);
			if (costOSApplicationMenuContainerPanel != null || param1AWTEvent.Source.ToString().ToLower().IndexOf("weight") != -1 || component is nomitech.common.laf.CostOSTitlePane)
			{
			  return;
			}
		  }
		  switch (mouseEvent.ID)
		  {
			case 501:
			  @bool = false;
			  if (component is JCommandButton)
			  {
				@bool = ((JCommandButton)component).PopupModel.PopupShowing;
			  }
			  if (!@bool && jPopupPanel != null)
			  {
				PopupPanelManager.defaultManager().hidePopups(jPopupPanel);
				return;
			  }
			  if (component is org.pushingpixels.flamingo.@internal.ui.ribbon.JRibbonTaskToggleButton)
			  {
				JRibbon jRibbon = (JRibbon)SwingUtilities.getAncestorOfClass(typeof(JRibbon), component);
				if (jRibbon != null && FlamingoUtilities.isShowingMinimizedRibbonInPopup(jRibbon))
				{
				  return;
				}
			  }
			  if (!@bool && SwingUtilities.getAncestorOfClass(typeof(javax.swing.plaf.basic.ComboPopup), component) == null)
			  {
				PopupPanelManager.defaultManager().hidePopups(component);
			  }
			  break;
			case 502:
			  if (SwingUtilities.getAncestorOfClass(typeof(javax.swing.plaf.basic.ComboPopup), component) != null)
			  {
				SwingUtilities.invokeLater(() =>
				{
				  PopupPanelManager.defaultManager().hidePopups(src);
				}});
			  break;
Пример #12
0
 private void checkAndInvokeLater(ThreadStart paramRunnable)
 {
     if (!Showing)
     {
         return;
     }
     if (this.o_currentTimes % this.o_timeToInvoke == 0)
     {
         SwingUtilities.invokeLater(paramRunnable);
     }
 }
Пример #13
0
 public virtual void mousePressed(MouseEvent param1MouseEvent)
 {
     if (outerInstance.RecenterOnClickEnabled && (SwingUtilities.isMiddleMouseButton(param1MouseEvent) || (SwingUtilities.isLeftMouseButton(param1MouseEvent) && param1MouseEvent.ClickCount == 2)))
     {
         recenterMap(param1MouseEvent);
     }
     else
     {
         this.prev = param1MouseEvent.Point;
     }
 }
Пример #14
0
 /**
  * Initialize the applet.
  * As recommended, the actual use of Swing components takes place in the
  * event-dispatching thread.
  */
 public void init()
 {
     try
     {
         SwingUtilities.invokeAndWait(this);
     }
     catch             //(Exception e)
     {
         //System.err.println("Initialization failure");
     }
 }
Пример #15
0
        public override void mouseMoved(MouseEvent e)
        {
            Point       p    = e.Point;
            JComponent  comp = (JComponent)e.Source;
            JScrollPane jsp  = (JScrollPane)SwingUtilities.getAncestorOfClass(typeof(JScrollPane), comp);

            if (jsp != null)
            {
                p = SwingUtilities.convertPoint(comp, p, jsp);
                show(jsp, p);
            }
        }
Пример #16
0
		internal virtual void grabWindow(IList<PopupPanelManager.PopupInfo> param1List)
		{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.awt.Toolkit tk = java.awt.Toolkit.getDefaultToolkit();
		  Toolkit tk = Toolkit.DefaultToolkit;
		  AccessController.doPrivileged(new PrivilegedActionAnonymousInnerClass(this, tk));
		  JComponent jComponent = ((PopupPanelManager.PopupInfo)param1List[0]).PopupOriginator;
		  this.grabbedWindow = (jComponent is Window) ? (Window)jComponent : SwingUtilities.getWindowAncestor(jComponent);
		  if (this.grabbedWindow != null)
		  {
			this.grabbedWindow.addComponentListener(this);
			this.grabbedWindow.addWindowListener(this);
		  }
		}
Пример #17
0
        }         //GEN-LAST:event_cbFileTraceActionPerformed

        // TODO does fireTableDataChanged need to be in the swing thread?
        // if not we could just call fireTableDataChanged(); from the logging functions
        public override void run()
        {
            ThreadStart refresher = () =>
            {
                if (sortRequired)
                {
                    sortRequired = false;
                    sortLists();
                }

                // Scroll to bottom of the tables
                int max = jScrollPane1.VerticalScrollBar.Maximum;
                jScrollPane1.VerticalScrollBar.Value = max;

                max = jScrollPane2.VerticalScrollBar.Maximum;
                jScrollPane2.VerticalScrollBar.Value = max;

                // Tell the tables to redraw
                fileHandleModel.fireTableDataChanged();
                fileCommandModel.fireTableDataChanged();
            };

            while (true)
            {
                try
                {
                    lock (this)
                    {
                        while (!dirty)
                        {
                            Monitor.Wait(this);
                        }
                        dirty = false;
                    }

                    if (Instance.Visible)
                    {
                        SwingUtilities.invokeAndWait(refresher);
                    }

                    // Cap update frequency
                    Thread.Sleep(200);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                }
            }
        }
 public virtual void popupHidden(PopupPanelManager.PopupEvent paramPopupEvent)
 {
     if (paramPopupEvent.Component is CostOSRibbonApplicationMenuPopupPanel)
     {
         CostOSRibbonUI.Instance.BackstageShown = false;
         CostOSRootPaneUI.Resolver.Ribbon.firePropertyChange("AppMenuHidden", false, true);
         Window window = SwingUtilities.getWindowAncestor(CostOSRootPaneUI.Resolver.Ribbon);
         window = JideSwingUtilities.getTopModalDialog(window);
         if (window != null)
         {
             window.invalidate();
             window.repaint();
         }
     }
 }
Пример #19
0
//JAVA TO C# CONVERTER WARNING: 'sealed override' parameters are not available in .NET:
//ORIGINAL LINE: @Override public java.awt.Component getTableCellEditorComponent(sealed override javax.swing.JTable table, sealed override Object value, sealed override bool isSelected, sealed override int row, sealed override int column)
            public override Component getTableCellEditorComponent(JTable table, object value, bool isSelected, int row, int column)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'sealed override':
//ORIGINAL LINE: sealed override javax.swing.JTextField tf = ((javax.swing.JTextField) getComponent());
                JTextField tf = ((JTextField)Component);

                tf.Text = string.Format("0x{0:X}", Integer.decode((string)table.Model.getValueAt(row, column)));

                // needed for double-click to work, otherwise the second click
                // is interpreted to position the caret
                SwingUtilities.invokeLater(() =>
                {
                    // automatically select text after '0x'
                    tf.select(2, tf.Text.Length());
                });
                return(tf);
            }
Пример #20
0
 public virtual void setProgress(string paramString, int paramInt)
 {
     if (!VisibleAndShowing)
     {
         this.o_currentTimes = paramInt;
         return;
     }
     if (SwingUtilities.EventDispatchThread)
     {
         this.o_descriptionLabel.Text = paramString;
         this.o_progressBar.Value     = this.o_currentTimes;
     }
     else
     {
         this.o_currentTimes = paramInt;
         SwingUtilities.invokeLater(new SetProgress(this, paramString, this.o_currentTimes));
     }
 }
Пример #21
0
 public virtual void addNotify()
 {
     base.addNotify();
     uninstallListeners();
     this.window = SwingUtilities.getWindowAncestor(this);
     if (this.window != null)
     {
         if (this.window is Frame)
         {
             State = ((Frame)this.window).ExtendedState;
         }
         else
         {
             State = 0;
         }
         Active = this.window.Active;
         installListeners();
         updateSystemIcon();
     }
 }
Пример #22
0
        /// <summary>
        /// Gets the sub-rectangle of a JScrollPane's area that
        /// is actually showing the view
        /// </summary>
        private Rectangle getShowingRect(JScrollPane pane)
        {
            Insets ins1  = pane.Viewport.Insets;
            Border inner = pane.ViewportBorder;
            Insets ins2;

            if (inner != null)
            {
                ins2 = inner.getBorderInsets(pane);
            }
            else
            {
                ins2 = new Insets(0, 0, 0, 0);
            }
            Insets ins3 = new Insets(0, 0, 0, 0);

            if (pane.Border != null)
            {
                ins3 = pane.Border.getBorderInsets(pane);
            }

            Rectangle r = pane.ViewportBorderBounds;

            r.translate(-r.x, -r.y);
            r.width  -= ins1.left + ins1.right;
            r.width  -= ins2.left + ins2.right;
            r.height -= ins1.top + ins1.bottom;
            r.height -= ins2.top + ins2.bottom;
            r.x      -= ins2.left;
            r.x      -= ins3.left;
            Point p = pane.Viewport.ViewPosition;

            r.translate(p.x, p.y);
            r = SwingUtilities.convertRectangle(pane.Viewport, r, pane);
            return(r);
        }
Пример #23
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void loadDB() throws Exception
        public override void loadDB()
        {
            if (DBLoaded)
            {
                return;
            }
            if (syncToEventDispatch && !SwingUtilities.EventDispatchThread)
            {
                this.o_retException = null;
                SwingUtilities.invokeAndWait(new RunnableAnonymousInnerClass(this));
                if (this.o_retException != null)
                {
                    throw this.o_retException;
                }
                return;
            }
            if (this.o_properties != null && !string.ReferenceEquals(this.o_properties.PreviousVersion, null))
            {
                if (this.o_properties.isOlderVersionFrom(this.o_properties.PreviousVersion, "4.0.1"))
                {
                    Console.WriteLine("Deleting indexes prior to 4.0.1 from version " + this.o_properties.PreviousVersion);
                    try
                    {
                        Console.WriteLine("deleting: " + new File(installDir + "project/" + this.o_projectFolderName + "/indexBase"));
                        deleteDirectory(new File(installDir + "project/" + this.o_projectFolderName + "/indexBase"));
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception.ToString());
                        Console.Write(exception.StackTrace);
                    }
                }
                if (this.o_properties.isOlderVersionFrom(this.o_properties.PreviousVersion, "4.2.7"))
                {
                    Properties properties = new Properties();
                    properties.setProperty("user", "SA");
                    properties.setProperty("password", "");
                    properties.setProperty("shutdown", "true");
                    initDriver(HSQL_DBMS);
                    Connection connection = DriverManager.getConnection("jdbc:hsqldb:" + installDir + "project/" + this.o_projectFolderName + "/projectDB", properties);
                    if (!connection.AutoCommit)
                    {
                        connection.commit();
                    }
                    Statement statement = connection.createStatement();
                    try
                    {
                        Console.WriteLine("Renaming the Condition Table to CNDON...");
                        statement.execute("DROP TABLE IF EXISTS CNDON");
                        statement.execute("ALTER TABLE CONDITION RENAME TO CNDON");
                        Console.WriteLine("OK!");
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception.ToString());
                        Console.Write(exception.StackTrace);
                        Console.WriteLine("TABLE WITH NAME CONDITION NOT FOUND!");
                    }
                    statement.close();
                    connection.close();
                }
                if (this.o_properties.isOlderVersionFrom(this.o_properties.PreviousVersion, "4.6.0"))
                {
                    Properties properties = new Properties();
                    properties.setProperty("user", "SA");
                    properties.setProperty("password", "");
                    properties.setProperty("shutdown", "true");
                    initDriver(HSQL_DBMS);
                    Connection connection = DriverManager.getConnection("jdbc:hsqldb:" + installDir + "project/" + this.o_projectFolderName + "/projectDB", properties);
                    if (!connection.AutoCommit)
                    {
                        connection.commit();
                    }
                    Statement statement = connection.createStatement();
                    try
                    {
                        Console.WriteLine("Updating data integrity...");
                        statement.execute("ALTER TABLE BOQITEM ALTER COLUMN DESCRIPTION LONGVARCHAR");
                        statement.execute("ALTER TABLE BOQITEM ALTER COLUMN NOTES LONGVARCHAR");
                        statement.execute("ALTER TABLE EQUIPMENT ALTER COLUMN DESCRIPTION LONGVARCHAR");
                        statement.execute("ALTER TABLE EQUIPMENT ALTER COLUMN NOTES LONGVARCHAR");
                        statement.execute("ALTER TABLE ASSEMBLY ALTER COLUMN DESCRIPTION LONGVARCHAR");
                        statement.execute("ALTER TABLE ASSEMBLY ALTER COLUMN NOTES LONGVARCHAR");
                        statement.execute("ALTER TABLE MATERIAL ALTER COLUMN DESCRIPTION LONGVARCHAR");
                        statement.execute("ALTER TABLE MATERIAL ALTER COLUMN NOTES LONGVARCHAR");
                        statement.execute("ALTER TABLE SUBCONTRACTOR ALTER COLUMN DESCRIPTION LONGVARCHAR");
                        statement.execute("ALTER TABLE SUBCONTRACTOR ALTER COLUMN NOTES LONGVARCHAR");
                        statement.execute("ALTER TABLE QUOTEITEM ALTER COLUMN TITLE LONGVARCHAR");
                        Console.WriteLine("OK!");
                    }
                    catch (Exception)
                    {
                    }
                    statement.close();
                    connection.close();
                }
            }
            closeSession();
            this.o_configuration = new Configuration();
            this.o_configuration.configure(configXML);
            ISet <object> set = this.o_configuration.Properties.Keys;

            string[] arrayOfString = (string[])set.toArray(new string[set.Count]);
            foreach (string str in arrayOfString)
            {
                if (str.IndexOf("search.default", StringComparison.Ordinal) != -1)
                {
                    this.o_configuration.Properties.remove(str);
                }
            }
            this.o_configuration.setProperty("hibernate.connection.isolation", "1");
            this.o_configuration.setProperty("hibernate.cache.jdbc.batch_size", "50");
            this.o_configuration.setProperty("hibernate.cache.use_second_level_cache", "false");
            this.o_configuration.setProperty("hibernate.cache.use_query_cache", "false");
            this.o_configuration.setProperty("hibernate.cache.provider_class", "org.hibernate.cache.NoCacheProvider");
            this.o_configuration.setProperty("hibernate.search.indexing_strategy", "manual");
            this.o_configuration.setProperty("hibernate.search.autoregister_listeners", "false");
            this.o_configuration.setProperty("hibernate.temp.use_jdbc_metadata_defaults", "false");
            this.o_configuration.registerTypeOverride(new CostOSString256Type(), new string[] { "costos_string" });
            this.o_configuration.registerTypeOverride(new CostOSTextType());
            this.o_configuration.registerTypeOverride(new UnitAliasType(ProjectGroupCodesProvider, "unit_alias"));
            for (sbyte b = 1; b <= 9; b++)
            {
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)10, b, "eps_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-1, b, "wbs1_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-2, b, "wbs2_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-3, b, "location_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-4, b, "paramitem_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)10, b, "eps_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-1, b, "wbs1_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-2, b, "wbs2_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-3, b, "location_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-4, b, "paramitem_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-1, b, "wbs1_level" + b + "_item_code", (short)5));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-2, b, "wbs2_level" + b + "_item_code", (short)5));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-1, b, "wbs1_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-2, b, "wbs2_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-1, b, "wbs1_level" + b + "_qty", (short)6));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-2, b, "wbs2_level" + b + "_qty", (short)6));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)1, b, "groupcode1_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)2, b, "groupcode2_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)3, b, "groupcode3_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)4, b, "groupcode4_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)5, b, "groupcode5_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)6, b, "groupcode6_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)7, b, "groupcode7_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)8, b, "groupcode8_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)9, b, "groupcode9_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)1, b, "groupcode1_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)2, b, "groupcode2_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)3, b, "groupcode3_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)4, b, "groupcode4_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)5, b, "groupcode5_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)6, b, "groupcode6_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)7, b, "groupcode7_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)8, b, "groupcode8_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)9, b, "groupcode9_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)1, b, "groupcode1_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)2, b, "groupcode2_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)3, b, "groupcode3_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)4, b, "groupcode4_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)5, b, "groupcode5_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)6, b, "groupcode6_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)7, b, "groupcode7_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)8, b, "groupcode8_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)9, b, "groupcode9_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)1, b, "groupcode1_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)2, b, "groupcode2_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)3, b, "groupcode3_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)4, b, "groupcode4_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)5, b, "groupcode5_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)6, b, "groupcode6_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)7, b, "groupcode7_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)8, b, "groupcode8_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)9, b, "groupcode9_level" + b + "_unit", (short)4));
            }
            this.o_configuration.setListener("post-update", null);
            this.o_configuration.setListener("post-insert", null);
            this.o_configuration.setListener("post-delete", null);
            this.o_configuration.setProperty("hibernate.connection.url", "jdbc:hsqldb:" + installDir + "project/" + this.o_projectFolderName + "/projectDB;hsqldb.write_delay=false");
            this.o_sessionFactory = this.o_configuration.buildSessionFactory();
            Session session = currentSession();

            if (ProjectSchemaUpdateUtil.checkRequiresProjectIdUpdates(this))
            {
                ProjectSchemaUpdateUtil.processProjectIdUpdates(this);
            }
            closeSession();
            ProjectDBUtil projectDBUtil;

            (projectDBUtil = ProjectDBUtil.currentProjectDBUtil()).CurrentProjectDBUtil = this;
            File file = new File(installDir + "project" + File.separator + this.o_projectFolderName + File.separator + "projectDB.details");

            if (!file.exists())
            {
                this.b_isDBLoaded = true;
                if (this.o_properties == null)
                {
                    this.o_properties = new ProjectDBProperties(this, true);
                }
                else
                {
                    this.o_properties.reloadProperties();
                }
                if (!string.ReferenceEquals(this.o_properties.PreviousVersion, null))
                {
                    updateNewerDatabase();
                }
                ProjectGroupCodesProvider.initializeProjectCaches();
            }
            ProjectDBUtil.CurrentProjectDBUtil = projectDBUtil;
        }
Пример #24
0
 /// <summary>Run the GUI.</summary>
 /// <remarks>
 /// Run the GUI.  This program accepts no command-line arguments.
 /// Everything is entered into the GUI.
 /// </remarks>
 public static void Main(string[] args)
 {
     //Schedule a job for the event-dispatching thread:
     //creating and showing this application's GUI.
     SwingUtilities.InvokeLater(null);
 }
            public override void Run()
            {
                string taggedStr = Edu.Stanford.Nlp.Tagger.Maxent.MaxentTaggerGUI.tagger.TagString(s);

                SwingUtilities.InvokeLater(null);
            }
Пример #26
0
            public virtual void layoutContainer(Container param1Container)
            {
                Insets insets = param1Container.Insets;
                int    i      = outerInstance.TabButtonGap;
                bool   bool1  = outerInstance.ribbon.ComponentOrientation.LeftToRight;
                int    j      = param1Container.Width;
                int    k      = outerInstance.TaskbarHeight;
                int    m      = insets.top;
                bool   bool2  = outerInstance.UsingTitlePane;

                if (!bool2)
                {
                    outerInstance.taskBarPanel.removeAll();
                    foreach (Component component in outerInstance.ribbon.TaskbarComponents)
                    {
                        outerInstance.taskBarPanel.add(component);
                    }
                    outerInstance.taskBarPanel.setBounds(insets.left, insets.top, j - insets.left - insets.right, k);
                    m += k;
                }
                else
                {
                    outerInstance.taskBarPanel.setBounds(0, 0, 0, 0);
                }
                Font font = outerInstance.ribbon.Font;

                if (font == null)
                {
                    font = new Font("SansSerif", 0, 12);
                    outerInstance.ribbon.Font = font;
                }
                FontMetrics fontMetrics = outerInstance.ribbon.getFontMetrics(font);
                int         n           = fontMetrics.stringWidth(CostOSRibbonApplicationMenuButtonUI.ApplicationMenuButtonText) + 24;
                int         i1;

                for (i1 = 0; i1 < outerInstance.ribbon.TaskCount; i1++)
                {
                    RibbonTask ribbonTask = outerInstance.ribbon.getTask(i1);
                    n += fontMetrics.stringWidth(ribbonTask.Title) + 32;
                }
                n += 12;
                i1 = outerInstance.TaskToggleButtonHeight;
                int i2 = bool1 ? insets.left : (j - insets.right);
                int i3 = k + i1;

                if (!bool2)
                {
                    outerInstance.applicationMenuButton.Visible = (outerInstance.ribbon.ApplicationMenu != null);
                    if (outerInstance.ribbon.ApplicationMenu != null)
                    {
                        if (bool1)
                        {
                            outerInstance.applicationMenuButton.setBounds(-5, insets.top, i3 + 24, i3);
                        }
                        else
                        {
                            outerInstance.applicationMenuButton.setBounds(i2 - i3, insets.top, i3, i3);
                        }
                    }
                }
                else
                {
                    outerInstance.applicationMenuButton.Visible = false;
                }
                i2 = bool1 ? (i2 + 2) : (i2 - 2);
                if (FlamingoUtilities.getApplicationMenuButton(SwingUtilities.getWindowAncestor(outerInstance.ribbon)) != null)
                {
                    i2 = bool1 ? (i2 + i3 + 15) : (i2 - i3);
                }
                if (outerInstance.o_trailingButton != null && outerInstance.helpButton == null)
                {
                    Dimension dimension = outerInstance.o_trailingButton.PreferredSize;
                    if (bool1)
                    {
                        outerInstance.o_trailingButton.setBounds(j - insets.right - dimension.width, m, dimension.width, dimension.height);
                    }
                    else
                    {
                        outerInstance.o_trailingButton.setBounds(insets.left, m, dimension.width, dimension.height);
                    }
                    if (outerInstance.o_searchButton != null)
                    {
                        Dimension dimension1 = outerInstance.o_searchButton.PreferredSize;
                        if (bool1)
                        {
                            outerInstance.o_searchButton.setBounds(n, m, dimension1.width, dimension1.height);
                        }
                        else
                        {
                            outerInstance.o_searchButton.setBounds(insets.left + dimension1.width, m, dimension1.width, dimension1.height);
                        }
                    }
                }
                if (outerInstance.helpButton != null)
                {
                    Dimension dimension = outerInstance.helpButton.PreferredSize;
                    if (bool1)
                    {
                        outerInstance.helpButton.setBounds(j - insets.right - dimension.width, m, dimension.width, dimension.height);
                    }
                    else
                    {
                        outerInstance.helpButton.setBounds(insets.left, m, dimension.width, dimension.height);
                    }
                    if (outerInstance.o_trailingButton != null)
                    {
                        Dimension dimension1 = outerInstance.o_trailingButton.PreferredSize;
                        if (bool1)
                        {
                            outerInstance.o_trailingButton.setBounds(j - insets.right * 2 - dimension1.width + dimension.width, m, dimension1.width, dimension1.height);
                        }
                        else
                        {
                            outerInstance.o_trailingButton.setBounds(insets.left + dimension1.width, m, dimension1.width, dimension1.height);
                        }
                    }
                }
                int i4 = 0;

                if (bool1)
                {
                    i4 = (outerInstance.o_trailingButton != null) ? (outerInstance.o_trailingButton.X - i - i2) : (param1Container.Width - insets.right - i2);
                    if (outerInstance.helpButton != null && outerInstance.o_trailingButton != null)
                    {
                        i4 = outerInstance.o_trailingButton.X - i - i2;
                    }
                    if (outerInstance.o_searchButton != null && outerInstance.o_trailingButton != null)
                    {
                        i4 = outerInstance.o_searchButton.X - i - i2;
                    }
                    outerInstance.taskToggleButtonsScrollablePanel.setBounds(i2, m, i4, i1);
                }
                else
                {
                    i4 = (outerInstance.helpButton != null) ? (i2 - i - outerInstance.helpButton.X - outerInstance.o_trailingButton.Width) : (i2 - insets.left);
                    if (outerInstance.helpButton != null && outerInstance.o_trailingButton != null)
                    {
                        i4 = i2 - i - outerInstance.o_trailingButton.X - outerInstance.o_trailingButton.Width - outerInstance.helpButton.X - outerInstance.helpButton.Width;
                    }
                    outerInstance.taskToggleButtonsScrollablePanel.setBounds(i2 - i4, m, i4, i1);
                }
                BasicRibbonUI.TaskToggleButtonsHostPanel taskToggleButtonsHostPanel = (BasicRibbonUI.TaskToggleButtonsHostPanel)outerInstance.taskToggleButtonsScrollablePanel.View;
                int i5 = (taskToggleButtonsHostPanel.MinimumSize).width;

                taskToggleButtonsHostPanel.PreferredSize = new Dimension(i5, (this.this$0.taskToggleButtonsScrollablePanel.Bounds).height);
                outerInstance.taskToggleButtonsScrollablePanel.doLayout();
                m += i1;
                int i6 = i1;

                if (!bool2)
                {
                    i6 += k;
                }
                if (outerInstance.bandScrollablePanel.Parent == outerInstance.ribbon)
                {
                    if (!outerInstance.ribbon.Minimized && outerInstance.ribbon.TaskCount > 0)
                    {
                        Insets insets1 = (outerInstance.ribbon.SelectedTask.BandCount == 0) ? new Insets(0, 0, 0, 0) : outerInstance.ribbon.SelectedTask.getBand(0).Insets;
                        outerInstance.bandScrollablePanel.setBounds(1 + insets.left, m + insets1.top, param1Container.Width - 2 * insets.left - 2 * insets.right - 1, param1Container.Height - i6 - insets.top - insets.bottom - insets1.top - insets1.bottom);
                        BasicRibbonUI.BandHostPanel bandHostPanel = (BasicRibbonUI.BandHostPanel)outerInstance.bandScrollablePanel.View;
                        int i7 = (bandHostPanel.MinimumSize).width;
                        bandHostPanel.PreferredSize = new Dimension(i7, (this.this$0.bandScrollablePanel.Bounds).height);
                        outerInstance.bandScrollablePanel.doLayout();
                        bandHostPanel.doLayout();
                    }
                    else
                    {
                        outerInstance.bandScrollablePanel.setBounds(0, 0, 0, 0);
                    }
                }
            }
Пример #27
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void loadDB() throws Exception
        public override void loadDB()
        {
            if (DBLoaded)
            {
                return;
            }
            if (syncToEventDispatch && !SwingUtilities.EventDispatchThread)
            {
                this.o_retException = null;
                loadDB();
                SwingUtilities.invokeAndWait(new RunnableAnonymousInnerClass(this));
                if (this.o_retException != null)
                {
                    throw this.o_retException;
                }
                return;
            }
            closeSession();
            this.dbmsType = this.o_urlTable.Dbms.Value;
            if (this.requiresAlters)
            {
                this.o_configuration = ProjectSessionFactoryBuilder.Instance.createConfigurationFromUrl(configXML, this.o_urlTable, ProjectGroupCodesProvider, this.requiresAlters, this.o_urlTable.TablePrefix);
                long l = DateTimeHelper.CurrentUnixTimeMillis();
                Console.WriteLine("  BUILDING SESSION FACTORY...");
                this.o_sessionFactory = this.o_configuration.buildSessionFactory();
                Console.WriteLine("DONE IN: " + ((DateTimeHelper.CurrentUnixTimeMillis() - l) / 1000L));
            }
            else
            {
                if (ProjectSessionFactory.GroupCodesProvider == null)
                {
                    ProjectSessionFactory.UpGroupCodesProvider = s_providerFactory.createSharedFactory();
                }
                this.sharedGroupCodesProvider = (ProjectGroupCodesProvider)ProjectSessionFactory.GroupCodesProvider;
                long l = DateTimeHelper.CurrentUnixTimeMillis();
                Console.WriteLine("  GETTING SESSION FACTORY...");
                this.o_configuration  = ProjectSessionFactory.getConfiguration(this.dbmsType);
                this.o_sessionFactory = ProjectSessionFactory.getSessionFactory(this.dbmsType);
                Console.WriteLine("DONE IN: " + ((DateTimeHelper.CurrentUnixTimeMillis() - l) / 1000L));
            }
            currentSession();
            closeSession();
            this.b_isDBLoaded = true;
            ProjectDBUtil projectDBUtil;

            (projectDBUtil = ProjectDBUtil.currentProjectDBUtil()).CurrentProjectDBUtil = this;
            if (this.o_properties == null)
            {
                this.o_properties = new ProjectDBProperties(this, true);
            }
            else
            {
                this.o_properties.reloadProperties();
            }
            if (!string.ReferenceEquals(this.o_properties.PreviousVersion, null) && this.requiresAlters && !(s_providerFactory is nomitech.ces.utils.DummyProjectGroupCodesProviderFactory))
            {
                updateNewerDatabase();
            }
            if (this.sharedGroupCodesProvider == null)
            {
                ProjectGroupCodesProvider.initializeProjectCaches();
            }
            else
            {
                ((WBSCache)Wbs1Cache).initCache();
                ((WBS2Cache)Wbs2Cache).initCache();
                try
                {
                    ((ParamItemCache)ParamItemCache).initializeCache();
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception.ToString());
                    Console.Write(exception.StackTrace);
                }
            }
            ProjectVariableCache.initCache();
            ProjectDBUtil.CurrentProjectDBUtil = projectDBUtil;
        }
Пример #28
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void unloadDB() throws Exception
        public override void unloadDB()
        {
            if (syncToEventDispatch && !SwingUtilities.EventDispatchThread)
            {
                this.o_retException = null;
                SwingUtilities.invokeAndWait(new RunnableAnonymousInnerClass2(this));
                if (this.o_retException != null)
                {
                    throw this.o_retException;
                }
                return;
            }
            try
            {
                if (DBLoaded)
                {
                    try
                    {
                        currentSession().beginTransaction().commit();
                        closeSession();
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception.ToString());
                        Console.Write(exception.StackTrace);
                    }
                }
                this.b_isDBLoaded = false;
                foreach (Session session in this.aliveSessions)
                {
                    if (session.Open)
                    {
                        try
                        {
                            if (session.Transaction != null && session.Transaction.Active)
                            {
                                session.Transaction.commit();
                            }
                            session.flush();
                        }
                        catch (Exception exception)
                        {
                            Console.WriteLine(exception.ToString());
                            Console.Write(exception.StackTrace);
                        }
                        try
                        {
                            session.close();
                        }
                        catch (Exception exception)
                        {
                            Console.WriteLine(exception.ToString());
                            Console.Write(exception.StackTrace);
                        }
                    }
                }
                this.aliveSessions.Clear();
                if (this.o_sessionFactory != null && !this.o_sessionFactory.Closed)
                {
                    this.o_sessionFactory.close();
                }
                this.o_session        = null;
                this.o_sessionFactory = null;
            }
            catch (Exception exception)
            {
                Console.WriteLine("Could not shutdown Database dont save Project:\n " + exception.Message);
                throw exception;
            }
        }
Пример #29
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void unloadDB() throws Exception
        public override void unloadDB()
        {
            if (syncToEventDispatch && !SwingUtilities.EventDispatchThread)
            {
                this.o_retException = null;
                SwingUtilities.invokeAndWait(new RunnableAnonymousInnerClass2(this));
                if (this.o_retException != null)
                {
                    throw this.o_retException;
                }
                return;
            }
            try
            {
                this.b_isDBLoaded = false;
                Properties properties = new Properties();
                properties.setProperty("user", "SA");
                properties.setProperty("password", "");
                properties.setProperty("shutdown", "true");
                Connection connection = DriverManager.getConnection("jdbc:hsqldb:" + installDir + "project/" + this.o_projectFolderName + "/projectDB", properties);
                if (!connection.AutoCommit)
                {
                    connection.commit();
                }
                if (this.o_sessionFactory != null)
                {
                    try
                    {
                        currentSession().beginTransaction().commit();
                        closeSession();
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception.ToString());
                        Console.Write(exception.StackTrace);
                    }
                }
                foreach (Session session in this.aliveSessions)
                {
                    if (session.Open)
                    {
                        try
                        {
                            if (session.Transaction != null && session.Transaction.Active)
                            {
                                session.Transaction.commit();
                            }
                            session.flush();
                        }
                        catch (Exception exception)
                        {
                            Console.WriteLine(exception.ToString());
                            Console.Write(exception.StackTrace);
                        }
                        try
                        {
                            session.close();
                        }
                        catch (Exception exception)
                        {
                            Console.WriteLine(exception.ToString());
                            Console.Write(exception.StackTrace);
                        }
                    }
                }
                this.aliveSessions.Clear();
                if (this.o_sessionFactory != null && !this.o_sessionFactory.Closed)
                {
                    try
                    {
                        this.o_sessionFactory.close();
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception.ToString());
                        Console.Write(exception.StackTrace);
                    }
                }
                this.o_session        = null;
                this.o_sessionFactory = null;
                Statement statement = connection.createStatement();
                statement.execute("SHUTDOWN");
                statement.close();
                connection.close();
            }
            catch (Exception exception)
            {
                Console.WriteLine("Could not shutdown Database dont save Project:\n " + exception.Message);
                throw exception;
            }
        }