List of usage examples for java.beans Beans setDesignTime
public static void setDesignTime(boolean isDesignTime) throws SecurityException
From source file:com.google.gdt.eclipse.designer.uibinder.parser.UiBinderContext.java
/** * Ensures that UiBinder is configured for design time. */// w w w . j a v a2s .com public void runDesignTime(RunnableEx runnable) throws Exception { String isKey = "gwt.UiBinder.isDesignTime " + m_binderClassName.replace('$', '.'); String resKey = "gwt.UiBinder.designTime " + m_binderResourceName; boolean old_designTime = Beans.isDesignTime(); try { Beans.setDesignTime(true); // mark "Binder" as design time System.setProperty(isKey, "true"); // put current document content into System, to make it available to UiBinderGenerator { String content = getContent(); content = removeWbpNameAttributes(content); System.setProperty(resKey, content); } // do run runnable.run(); } finally { m_state.getDevModeBridge().invalidateRebind(m_binderClassName); Beans.setDesignTime(old_designTime); System.clearProperty(isKey); System.clearProperty(resKey); getBroadcastSupport().getListener(AfterRunDesignTime.class).invoke(); } }
From source file:org.eclipse.wb.internal.swing.MigLayout.model.MigDimensionInfo.java
/** * @return the {@link BoundSize} of dimension parsed from string. *///from w ww . j a v a2 s . c om private BoundSize parseBoundSize(final String sizeString) { if (sizeString == null) { return null; } boolean old_designTime = Beans.isDesignTime(); try { Beans.setDesignTime(true); return ConstraintParser.parseBoundSize(sizeString, false, m_horizontal); } finally { Beans.setDesignTime(old_designTime); } }
From source file:org.eclipse.wb.internal.swing.MigLayout.model.MigDimensionInfo.java
/** * Parses {@link DimConstraint} from {@link String}. *//* w w w. j a v a2s . co m*/ protected static DimConstraint parseDimConstraint(boolean horizontal, String s) { // prepare constraints AC ac; { boolean old_designTime = Beans.isDesignTime(); try { Beans.setDesignTime(true); if (horizontal) { ac = ConstraintParser.parseColumnConstraints(s); } else { ac = ConstraintParser.parseRowConstraints(s); } } finally { Beans.setDesignTime(old_designTime); } } // extract single constraint Assert.equals(1, ac.getCount(), s); return ac.getConstaints()[0]; }