public void writeLayout(final XmlWriter writer, final RadContainer radContainer) { final AbstractLayout layout = (AbstractLayout)radContainer.getLayout(); // It has sense to save hpap and vgap even for XY layout. The reason is // that XY was previously GRID with non default gaps, so when the user // compose XY into the grid again then he will get the same non default gaps. writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_HGAP, layout.getHGap()); writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VGAP, layout.getVGap()); // Margins final Insets margin = layout.getMargin(); writer.startElement("margin"); try { writer.writeInsets(margin); } finally { writer.endElement(); // margin } }
public void testCopyFormsRuntimeToArtifact() throws IOException { VirtualFile file = createFile("src/A.java", "class A{}"); VirtualFile srcRoot = file.getParent(); Module module = addModule("a", srcRoot); Artifact a = addArtifact(root().module(module)); make(a); assertOutput(a, fs().file("A.class")); File dir = PathManagerEx.findFileUnderCommunityHome("plugins/ui-designer/testData/build/copyFormsRuntimeToArtifact"); FileUtil.copyDir(dir, VfsUtilCore.virtualToIoFile(srcRoot)); srcRoot.refresh(false, false); make(a); File outputDir = VfsUtilCore.virtualToIoFile(getOutputDir(a)); assertTrue(new File(outputDir, "A.class").exists()); assertTrue(new File(outputDir, "B.class").exists()); assertTrue(new File(outputDir, AbstractLayout.class.getName().replace('.', '/') + ".class").exists()); }
private static int getGap(LwContainer container, final boolean horizontal) { while(container != null) { final LayoutManager layout = container.getLayout(); if (layout instanceof AbstractLayout) { AbstractLayout aLayout = (AbstractLayout) layout; final int gap = horizontal ? aLayout.getHGap() : aLayout.getVGap(); if (gap >= 0) { return gap; } } container = container.getParent(); } return horizontal ? AbstractLayout.DEFAULT_HGAP : AbstractLayout.DEFAULT_VGAP; }
public Insets getValue(final RadContainer component) { if (component.getLayout() instanceof AbstractLayout) { final AbstractLayout layoutManager=(AbstractLayout) component.getLayout(); return layoutManager.getMargin(); } return DEFAULT_INSETS; }
protected void setValueImpl(final RadContainer component,final Boolean value) throws Exception { final AbstractLayout layoutManager=(AbstractLayout) component.getLayout(); if (!(layoutManager instanceof GridLayoutManager)) { throw new IllegalArgumentException("grid layout expected: "+layoutManager); } final GridLayoutManager gridLayoutManager = (GridLayoutManager)layoutManager; setGridLayoutPropertyValue(gridLayoutManager, value.booleanValue()); }
public final void setLayout(final LayoutManager layout) { // some components (for example, JXCollapsiblePanel from SwingX) have asymmetrical getLayout/setLayout - a different // layout is returned compared to what was passed to setLayout(). to avoid crashes, we store the layout we passed to // the component. myDelegeeLayout = layout; getDelegee().setLayout(layout); if (layout instanceof AbstractLayout) { AbstractLayout aLayout = (AbstractLayout)layout; for (int i = 0; i < getComponentCount(); i++) { final RadComponent c = getComponent(i); aLayout.addLayoutComponent(c.getDelegee(), c.getConstraints()); } } }
@Override public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { return orientation == SwingConstants.VERTICAL && getComponentCount() >= 2 ? getComponent(1).getHeight() + AbstractLayout.DEFAULT_VGAP : 10; }
private static boolean isRuntimeClassesCopied(JpsModule module) { File outputDir = JpsPathUtil.urlToFile(JpsJavaExtensionService.getInstance().getOutputUrl(module, false)); return new File(outputDir, AbstractLayout.class.getName().replace('.', '/') + ".class").exists(); }
protected void setValueImpl(final RadContainer component, @NotNull final Insets value) throws Exception{ final AbstractLayout layoutManager=(AbstractLayout)component.getLayout(); layoutManager.setMargin(value); }