Skip to content

Commit

Permalink
Merge pull request #10 from kutu/master
Browse files Browse the repository at this point in the history
Несколько обновлений
  • Loading branch information
develar committed Oct 4, 2012
2 parents ae7fb50 + 4ca43cf commit f4079cd
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Expand Up @@ -6,3 +6,8 @@ Thumbs.db


target target


.settings
.actionScriptProperties
.flexLibProperties
.project
*.swc
8 changes: 4 additions & 4 deletions core/src/net/miginfocom/layout/CC.as
Expand Up @@ -441,7 +441,7 @@ public final class CC {
* will take precedence. Push is normally used when the grid has not been defined in the layout. * will take precedence. Push is normally used when the grid has not been defined in the layout.
* <p> * <p>
* If multiple components in a column has push weights set the largest one will be used for the column. * If multiple components in a column has push weights set the largest one will be used for the column.
* @return The current push value. Default is <code>null</code>. * @return The current push value. Default is <code>NaN</code>.
*/ */
public function get pushX():Number { public function get pushX():Number {
return _pushX; return _pushX;
Expand All @@ -452,7 +452,7 @@ public final class CC {
* will take precedence. Push is normally used when the grid has not been defined in the layout. * will take precedence. Push is normally used when the grid has not been defined in the layout.
* <p> * <p>
* If multiple components in a column has push weights set the largest one will be used for the column. * If multiple components in a column has push weights set the largest one will be used for the column.
* @param weight The new push value. Default is <code>null</code>. * @param weight The new push value. Default is <code>NaN</code>.
*/ */
public function set pushX(weight:Number):void { public function set pushX(weight:Number):void {
_pushX = weight; _pushX = weight;
Expand All @@ -463,7 +463,7 @@ public final class CC {
* will take precedence. Push is normally used when the grid has not been defined in the layout. * will take precedence. Push is normally used when the grid has not been defined in the layout.
* <p> * <p>
* If multiple components in a row has push weights set the largest one will be used for the row. * If multiple components in a row has push weights set the largest one will be used for the row.
* @return The current push value. Default is <code>null</code>. * @return The current push value. Default is <code>NaN</code>.
*/ */
public function get pushY():Number { public function get pushY():Number {
return _pushY; return _pushY;
Expand All @@ -474,7 +474,7 @@ public final class CC {
* will take precedence. Push is normally used when the grid has not been defined in the layout. * will take precedence. Push is normally used when the grid has not been defined in the layout.
* <p> * <p>
* If multiple components in a row has push weights set the largest one will be used for the row. * If multiple components in a row has push weights set the largest one will be used for the row.
* @param value The new push value. Default is <code>null</code>. * @param value The new push value. Default is <code>NaN</code>.
*/ */
public function set pushY(value:Number):void { public function set pushY(value:Number):void {
_pushY = value; _pushY = value;
Expand Down
8 changes: 8 additions & 0 deletions core/src/net/miginfocom/layout/ComponentWrapper.as
Expand Up @@ -2,6 +2,14 @@ package net.miginfocom.layout {
/** A class that wraps the important parts of a Component. /** A class that wraps the important parts of a Component.
*/ */
public interface ComponentWrapper { public interface ComponentWrapper {
/** Returns the actual object that this wrapper is aggregating. This might be needed for getting
* information about the object that the wrapper interface does not provide.
* <p>
* If this is a container the container should be returned instead.
* @return The actual object that this wrapper is aggregating. Not <code>null</code>.
*/
function get component():Object;

/** Returns the current x coordinate for this component. /** Returns the current x coordinate for this component.
* @return The current x coordinate for this component. * @return The current x coordinate for this component.
*/ */
Expand Down
4 changes: 2 additions & 2 deletions core/src/net/miginfocom/layout/Grid.as
Expand Up @@ -271,8 +271,8 @@ public final class Grid {
continue; // To work with situations where there are components that does not have a layout manager, or not this one. continue; // To work with situations where there are components that does not have a layout manager, or not this one.
} }


hasPushX ||= (visible || hideMode > 1) && cc.pushX == cc.pushX; hasPushX ||= (visible || hideMode > 1) && !isNaN(cc.pushX);
hasPushY ||= (visible || hideMode > 1) && cc.pushY == cc.pushY; hasPushY ||= (visible || hideMode > 1) && !isNaN(cc.pushY);


if (cc != rootCc) { // If not first in a cell if (cc != rootCc) { // If not first in a cell
if (cc.newline || !cc.boundsInGrid || cc.dockSide != -1) { if (cc.newline || !cc.boundsInGrid || cc.dockSide != -1) {
Expand Down
Expand Up @@ -14,7 +14,11 @@ public class FlashComponentWrapper implements ComponentWrapper {
this.c = c; this.c = c;
_constraints = constraints; _constraints = constraints;
} }


public function get component():Object {
return c;
}

private var _constraints:CC; private var _constraints:CC;
public function get constraints():CC { public function get constraints():CC {
return _constraints; return _constraints;
Expand Down
10 changes: 9 additions & 1 deletion flash/src/org/jetbrains/migLayout/flash/MigLayout.as
Expand Up @@ -3,13 +3,15 @@ import flash.display.DisplayObjectContainer;


import net.miginfocom.layout.AbstractMigLayout; import net.miginfocom.layout.AbstractMigLayout;
import net.miginfocom.layout.Grid; import net.miginfocom.layout.Grid;
import net.miginfocom.layout.LayoutCallback;
import net.miginfocom.layout.LayoutUtil; import net.miginfocom.layout.LayoutUtil;
import net.miginfocom.layout.PlatformDefaults; import net.miginfocom.layout.PlatformDefaults;


public class MigLayout extends AbstractMigLayout { public class MigLayout extends AbstractMigLayout {
private var lastHash:int = -1; private var lastHash:int = -1;
private var lastInvalidW:Number; private var lastInvalidW:Number;
private var lastInvalidH:Number; private var lastInvalidH:Number;
private var callbackList:Vector.<LayoutCallback>;


public function MigLayout(layoutConstraints:String = null, colConstraints:String = null, rowConstraints:String = null) { public function MigLayout(layoutConstraints:String = null, colConstraints:String = null, rowConstraints:String = null) {
super(layoutConstraints, colConstraints, rowConstraints); super(layoutConstraints, colConstraints, rowConstraints);
Expand Down Expand Up @@ -39,6 +41,12 @@ public class MigLayout extends AbstractMigLayout {
grid.layout(0, 0, w, h, lc != null && lc.debugMillis > 0, false); grid.layout(0, 0, w, h, lc != null && lc.debugMillis > 0, false);
} }
} }

public function addLayoutCallback(cb:LayoutCallback):void {
if (!cb) return;
if (!callbackList) callbackList = new Vector.<LayoutCallback>();
callbackList.push(cb);
}


/** Check if something has changed and if so recreate it to the cached objects. /** Check if something has changed and if so recreate it to the cached objects.
* @param container The container that is the target for this layout manager. * @param container The container that is the target for this layout manager.
Expand Down Expand Up @@ -82,7 +90,7 @@ public class MigLayout extends AbstractMigLayout {
//setDebug(par, getDebugMillis() > 0); //setDebug(par, getDebugMillis() > 0);


if (grid == null) { if (grid == null) {
grid = new Grid(container, lc, rowSpecs, colSpecs, null); grid = new Grid(container, lc, rowSpecs, colSpecs, callbackList);
} }


flags &= ~INVALID; flags &= ~INVALID;
Expand Down
4 changes: 4 additions & 0 deletions flex/src/org/jetbrains/migLayout/flex/FlexComponentWrapper.as
Expand Up @@ -28,6 +28,10 @@ internal class FlexComponentWrapper implements ComponentWrapper {
flags = 0; flags = 0;
} }
} }

public function get component():Object {
return c;
}


public function get x():Number { public function get x():Number {
return c.getLayoutBoundsX(); return c.getLayoutBoundsX();
Expand Down

0 comments on commit f4079cd

Please sign in to comment.