Ejemplo n.º 1
0
        public SettingsPanel(JamochaGui gui) : base(gui)
        {
            InitBlock();
            //UPGRADE_ISSUE: Constructor 'java.awt.BorderLayout.BorderLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            setLayout(new BorderLayout());
            tabbedPane = new JTabbedPane();

            EngineSettingsPanel engineSettingsPanel = new EngineSettingsPanel(gui);

            tabbedPane.addTab("Engine", null, engineSettingsPanel, "Engine Settings");
            panels.add(engineSettingsPanel);

            ShellSettingsPanel shellSettingsPanel = new ShellSettingsPanel(gui);

            tabbedPane.addTab("Shell", null, shellSettingsPanel, "Shell Settings");
            panels.add(shellSettingsPanel);

            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.CENTER' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            add(tabbedPane, BorderLayout.CENTER);

            //UPGRADE_ISSUE: Constructor 'java.awt.FlowLayout.FlowLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"'
            //UPGRADE_ISSUE: Field 'java.awt.FlowLayout.RIGHT' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"'
            JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 1));

            saveButton = new JButton("Save Changes", IconLoader.getImageIcon("disk"));
            saveButton.addActionListener(this);
            buttonPanel.add(saveButton);
            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.SOUTH' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            add(buttonPanel, BorderLayout.SOUTH);
        }
Ejemplo n.º 2
0
 private static string[] finishSplit(java.util.List <string> list, string input, int
                                     begin, int maxSize, int limit)
 {
     // Add trailing text.
     if (begin < input.Length)
     {
         list.add(Sharpen.StringHelper.Substring(input, begin));
     }
     else
     {
         if (limit != 0)
         {
             // No point adding the empty string if limit == 0, just to remove it below.
             list.add(string.Empty);
         }
     }
     // Remove all trailing empty matches in the limit == 0 case.
     if (limit == 0)
     {
         int i = list.size() - 1;
         while (i >= 0 && string.IsNullOrEmpty(list.get(i)))
         {
             list.remove(i);
             i--;
         }
     }
     // Convert to an array.
     return(list.toArray(new string[list.size()]));
 }
Ejemplo n.º 3
0
        /**
         * Get all of the positions that make up a {@link KMLAbstractGeometry}. If the geometry contains other geometries,
         * this method collects all the points from all of the geometries.
         *
         * @param globe     Globe to use to determine altitude above terrain.
         * @param geometry  Geometry to collect positions from.
         * @param positions Placemark positions will be added to this list.
         */
        public static void getPositions(Globe globe, KMLAbstractGeometry geometry, java.util.List <Position> positions)
        {
            if (geometry is KMLPoint)
            {
                KMLPoint kmlPoint = (KMLPoint)geometry;
                Position pos      = kmlPoint.getCoordinates();

                if (pos != null)
                {
                    positions.add(computeAltitude(globe, pos, kmlPoint.getAltitudeMode()));
                }
            }
            else if (geometry is KMLModel)
            {
                KMLModel    model    = (KMLModel)geometry;
                KMLLocation location = model.getLocation();
                if (location != null)
                {
                    Position pos = location.getPosition();
                    if (pos != null)
                    {
                        positions.add(computeAltitude(globe, pos, model.getAltitudeMode()));
                    }
                }
            }
            else if (geometry is KMLLineString) // Also handles KMLLinearRing, since KMLLineString is a subclass of KMLLinearRing
            {
                KMLLineString         lineString   = (KMLLineString)geometry;
                Position.PositionList positionList = lineString.getCoordinates();
                if (positionList != null)
                {
                    positions.addAll(computeAltitude(globe, positionList.list, lineString.getAltitudeMode()));
                }
            }
            else if (geometry is KMLPolygon)
            {
                KMLLinearRing ring = ((KMLPolygon)geometry).getOuterBoundary();
                // Recurse and let the LineString/LinearRing code handle the boundary positions
                getPositions(globe, ring, positions);
            }
            else if (geometry is KMLMultiGeometry)
            {
                java.util.List <KMLAbstractGeometry> geoms = ((KMLMultiGeometry)geometry).getGeometries();
                foreach (KMLAbstractGeometry g in geoms)
                {
                    // Recurse, adding positions for the sub-geometry
                    getPositions(globe, g, positions);
                }
            }
        }
Ejemplo n.º 4
0
 public AppSecurityPermissions(android.content.Context context, string packageName
                               )
 {
     mContext   = context;
     mPm        = mContext.getPackageManager();
     mPermsList = new java.util.ArrayList <android.content.pm.PermissionInfo>();
     java.util.Set <android.content.pm.PermissionInfo> permSet = new java.util.HashSet <
         android.content.pm.PermissionInfo>();
     android.content.pm.PackageInfo pkgInfo;
     try
     {
         pkgInfo = mPm.getPackageInfo(packageName, android.content.pm.PackageManager.GET_PERMISSIONS
                                      );
     }
     catch (android.content.pm.PackageManager.NameNotFoundException)
     {
         android.util.Log.w(TAG, "Could'nt retrieve permissions for package:" + packageName
                            );
         return;
     }
     // Extract all user permissions
     if ((pkgInfo.applicationInfo != null) && (pkgInfo.applicationInfo.uid != -1))
     {
         getAllUsedPermissions(pkgInfo.applicationInfo.uid, permSet);
     }
     foreach (android.content.pm.PermissionInfo tmpInfo in Sharpen.IterableProxy.Create
                  (permSet))
     {
         mPermsList.add(tmpInfo);
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Formats a phone number in the specified format using client-defined formatting rules. Note that
 /// if the phone number has a country calling code of zero or an otherwise invalid country calling
 /// code, we cannot work out things like whether there should be a national prefix applied, or how
 /// to format extensions, so we return the national significant number with no formatting applied.
 /// </summary>
 /// <param name="numberFormat">the format the phone number should be formatted into</param>
 /// <param name="userDefinedFormats">formatting rules specified by clients</param>
 /// <returns>the formatted phone number</returns>
 public string FormatByPattern(libphonenumber.PhoneNumberUtil.PhoneNumberFormat numberFormat, IEnumerable <NumberFormat> userDefinedFormats)
 {
     java.util.List <_NumberFormat> tempUserDefinedFormats = new java.util.List <_NumberFormat>();
     foreach (var item in userDefinedFormats)
     {
         tempUserDefinedFormats.add(item);
     }
     return(_PhoneNumberUtil.getInstance().formatByPattern(_inner, (_PhoneNumberFormat)numberFormat, tempUserDefinedFormats));
 }
Ejemplo n.º 6
0
        //-----------------------------------------------------------------------

        /**
         * Add an Iterator to the end of the chain
         *
         * @param iterator Iterator to add
         * @throws IllegalStateException if I've already started iterating
         * @throws NullPointerException if the iterator is null
         */
        public void addIterator(java.util.Iterator <Object> iterator)
        {
            checkLocked();
            if (iterator == null)
            {
                throw new java.lang.NullPointerException("Iterator must not be null");
            }
            iteratorChain.add(iterator);
        }
Ejemplo n.º 7
0
        /**
         * Add a Comparator to the end of the chain using the
         * given sort order
         *
         * @param comparator Comparator to add to the end of the chain
         * @param reverse    false = forward sort order; true = reverse sort order
         */
        public void addComparator(java.util.Comparator <Object> comparator, bool reverse)
        {
            checkLocked();

            comparatorChain.add(comparator);
            if (reverse == true)
            {
                orderingBits.set(comparatorChain.size() - 1);
            }
        }
Ejemplo n.º 8
0
 /**
  * Construct a Comparator chain with a single Comparator,
  * sorting in the given order
  *
  * @param comparator First Comparator in the ComparatorChain
  * @param reverse    false = forward sort; true = reverse sort
  */
 public ComparatorChain(java.util.Comparator <Object> comparator, bool reverse)
 {
     comparatorChain = new java.util.ArrayList <Object>();
     comparatorChain.add(comparator);
     orderingBits = new java.util.BitSet(1);
     if (reverse == true)
     {
         orderingBits.set(0);
     }
 }
Ejemplo n.º 9
0
        /// <summary> Adds a ConnectorLine into the container
        /// </summary>
        /// <param name="p">the primitive which should become added
        ///
        /// </param>
        public virtual void  addPrimitive(ConnectorLine c)
        {
            lines.add(c);
            Graphics2D gr = (Graphics2D)Graphics;

            if (gr == null)
            {
                return;
            }
            drawPrimitive(c, gr);
        }
Ejemplo n.º 10
0
        /**
         * {@inheritDoc}
         * @throws ClassCastException if entry is not an instance of ZipArchiveEntry
         */
        public override void putArchiveEntry(ArchiveEntry archiveEntry) //throws IOException
        {
            if (finished)
            {
                throw new java.io.IOException("Stream has already been finished");
            }

            if (entry != null)
            {
                closeArchiveEntry();
            }

            entry = ((ZipArchiveEntry)archiveEntry);
            entries.add(entry);

            if (entry.getMethod() == -1)   // not specified
            {
                entry.setMethod(method);
            }

            if (entry.getTime() == -1)   // not specified
            {
                entry.setTime(java.lang.SystemJ.currentTimeMillis());
            }

            // Size/CRC not required if RandomAccessFile is used
            if (entry.getMethod() == STORED && raf == null)
            {
                if (entry.getSize() == -1)
                {
                    throw new java.util.zip.ZipException("uncompressed size is required for"
                                                         + " STORED method when not writing to a"
                                                         + " file");
                }
                if (entry.getCrc() == -1)
                {
                    throw new java.util.zip.ZipException("crc checksum is required for STORED"
                                                         + " method when not writing to a file");
                }
                entry.setCompressedSize(entry.getSize());
            }

            if (entry.getMethod() == DEFLATED && hasCompressionLevelChanged)
            {
                def.setLevel(level);
                hasCompressionLevelChanged = false;
            }
            writeLocalFileHeader(entry);
        }
        /**
         * Returns the next element from the iterator.
         *
         * @return the next element from the iterator
         * @throws NoSuchElementException if there are no more elements
         */
        public Object next()
        {//throws NoSuchElementException {
            if (currentIndex < wrappedIteratorIndex)
            {
                ++currentIndex;
                return(list.get(currentIndex - 1));
            }

            Object retval = iterator.next();

            list.add(retval);
            ++currentIndex;
            ++wrappedIteratorIndex;
            return(retval);
        }
Ejemplo n.º 12
0
 public AppSecurityPermissions(android.content.Context context, android.content.pm.PackageParser
                               .Package pkg)
 {
     mContext   = context;
     mPm        = mContext.getPackageManager();
     mPermsList = new java.util.ArrayList <android.content.pm.PermissionInfo>();
     java.util.Set <android.content.pm.PermissionInfo> permSet = new java.util.HashSet <
         android.content.pm.PermissionInfo>();
     if (pkg == null)
     {
         return;
     }
     // Get requested permissions
     if (pkg.requestedPermissions != null)
     {
         java.util.ArrayList <string> strList = pkg.requestedPermissions;
         int size = strList.size();
         if (size > 0)
         {
             extractPerms(strList.toArray(new string[size]), permSet);
         }
     }
     // Get permissions related to  shared user if any
     if (pkg.mSharedUserId != null)
     {
         int sharedUid;
         try
         {
             sharedUid = mPm.getUidForSharedUser(pkg.mSharedUserId);
             getAllUsedPermissions(sharedUid, permSet);
         }
         catch (android.content.pm.PackageManager.NameNotFoundException)
         {
             android.util.Log.w(TAG, "Could'nt retrieve shared user id for:" + pkg.packageName
                                );
         }
     }
     // Retrieve list of permissions
     foreach (android.content.pm.PermissionInfo tmpInfo in Sharpen.IterableProxy.Create
                  (permSet))
     {
         mPermsList.add(tmpInfo);
     }
 }
Ejemplo n.º 13
0
        /// <summary> Adds a Shape into the container
        /// </summary>
        /// <param name="p">the primitive which should become added
        ///
        /// </param>
        public virtual void  addPrimitive(Shape s)
        {
            shapes.add(s);
            if (s.width + s.x > graphwidth)
            {
                graphwidth = s.width + s.x;
            }
            if (s.height + s.y > graphheight)
            {
                graphheight = s.height + s.y;
            }
            Graphics2D gr = (Graphics2D)Graphics;

            if (gr == null)
            {
                return;
            }
            drawPrimitive(s, gr);
        }
 /// <summary>
 /// Formats a phone number in the specified format using client-defined formatting rules. Note that
 /// if the phone number has a country calling code of zero or an otherwise invalid country calling
 /// code, we cannot work out things like whether there should be a national prefix applied, or how
 /// to format extensions, so we return the national significant number with no formatting applied.
 /// </summary>
 /// <param name="numberFormat">the format the phone number should be formatted into</param>
 /// <param name="userDefinedFormats">formatting rules specified by clients</param>
 /// <returns>the formatted phone number</returns>
 public string FormatByPattern(libphonenumber.PhoneNumberUtil.PhoneNumberFormat numberFormat, IEnumerable<NumberFormat> userDefinedFormats)
 {
     java.util.List<_NumberFormat> tempUserDefinedFormats = new java.util.List<_NumberFormat>();
     foreach (var item in userDefinedFormats)
         tempUserDefinedFormats.add(item);
     return _PhoneNumberUtil.getInstance().formatByPattern(_inner, (_PhoneNumberFormat)numberFormat, tempUserDefinedFormats);
 }
Ejemplo n.º 15
0
 /**
  * Adds the filename of a recently deleted file to the result list.
  * @param fileName the file which has been deleted
  */
 protected internal void deleted(String fileName)
 {
     deletedList.add(fileName);
 }
Ejemplo n.º 16
0
 /**
  * Adds the name of a file to the result list which has been
  * copied from the source stream to the target stream.
  * @param fileName the file name which has been added from the original stream
  */
 protected internal void addedFromStream(String fileName)
 {
     addedFromStreamList.add(fileName);
 }
Ejemplo n.º 17
0
 /**
  * Adds the name of a file to the result list which has been
  * copied from the changeset to the target stream
  * @param fileName the name of the file
  */
 protected internal void addedFromChangeSet(String fileName)
 {
     addedFromChangeSetList.add(fileName);
 }
Ejemplo n.º 18
0
 internal void addGroup(Group group)
 {
     groups.add(group);
 }