use of com.intellij.uiDesigner.core.GridConstraints in project intellij-community by JetBrains.
the class FormLayoutCodeGenerator method addNewCellConstraints.
private static void addNewCellConstraints(final GeneratorAdapter generator, final LwComponent lwComponent) {
final GridConstraints constraints = lwComponent.getConstraints();
final CellConstraints cc = (CellConstraints) lwComponent.getCustomLayoutConstraints();
generator.newInstance(ourCellConstraintsType);
generator.dup();
generator.push(constraints.getColumn() + 1);
generator.push(constraints.getRow() + 1);
generator.push(constraints.getColSpan());
generator.push(constraints.getRowSpan());
if (cc.hAlign == CellConstraints.DEFAULT) {
generator.getStatic(ourCellConstraintsType, "DEFAULT", ourCellAlignmentType);
} else {
int hAlign = Utils.alignFromConstraints(constraints, true);
generator.getStatic(ourCellConstraintsType, HORZ_ALIGN_FIELDS[hAlign], ourCellAlignmentType);
}
if (cc.vAlign == CellConstraints.DEFAULT) {
generator.getStatic(ourCellConstraintsType, "DEFAULT", ourCellAlignmentType);
} else {
int vAlign = Utils.alignFromConstraints(constraints, false);
generator.getStatic(ourCellConstraintsType, VERT_ALIGN_FIELDS[vAlign], ourCellAlignmentType);
}
AsmCodeGenerator.pushPropValue(generator, Insets.class.getName(), cc.insets);
generator.invokeConstructor(ourCellConstraintsType, ourCellConstraintsConstructor);
}
use of com.intellij.uiDesigner.core.GridConstraints in project intellij-community by JetBrains.
the class GridBagConverter method prepareConstraints.
public static void prepareConstraints(final LwContainer container, final Map idToConstraintsMap) {
GridLayoutManager gridLayout = (GridLayoutManager) container.getLayout();
GridBagConverter converter = new GridBagConverter(gridLayout.getMargin(), getGap(container, true), getGap(container, false), gridLayout.isSameSizeHorizontally(), gridLayout.isSameSizeVertically());
for (int i = 0; i < container.getComponentCount(); i++) {
final LwComponent component = (LwComponent) container.getComponent(i);
if (component instanceof LwHSpacer || component instanceof LwVSpacer) {
GridConstraints constraints = component.getConstraints().store();
constraints.setHSizePolicy(constraints.getHSizePolicy() & ~GridConstraints.SIZEPOLICY_WANT_GROW);
constraints.setVSizePolicy(constraints.getVSizePolicy() & ~GridConstraints.SIZEPOLICY_WANT_GROW);
converter.addComponent(null, constraints);
} else {
converter.addComponent(null, component.getConstraints());
}
}
Result[] results = converter.convert();
int componentIndex = 0;
for (int i = 0; i < results.length; i++) {
if (!results[i].isFillerPanel) {
final LwComponent component = (LwComponent) container.getComponent(componentIndex++);
idToConstraintsMap.put(component.getId(), results[i]);
}
// else generateFillerPanel(generator, componentLocal, results [i]);
}
}
use of com.intellij.uiDesigner.core.GridConstraints in project intellij-community by JetBrains.
the class GridLayoutCodeGenerator method addNewGridConstraints.
private static void addNewGridConstraints(final GeneratorAdapter generator, final LwComponent lwComponent) {
final GridConstraints constraints = lwComponent.getConstraints();
generator.newInstance(myGridConstraintsType);
generator.dup();
generator.push(constraints.getRow());
generator.push(constraints.getColumn());
generator.push(constraints.getRowSpan());
generator.push(constraints.getColSpan());
generator.push(constraints.getAnchor());
generator.push(constraints.getFill());
generator.push(constraints.getHSizePolicy());
generator.push(constraints.getVSizePolicy());
newDimensionOrNull(generator, constraints.myMinimumSize);
newDimensionOrNull(generator, constraints.myPreferredSize);
newDimensionOrNull(generator, constraints.myMaximumSize);
if (constraints.isUseParentLayout()) {
generator.push(constraints.getIndent());
generator.push(constraints.isUseParentLayout());
generator.invokeConstructor(myGridConstraintsType, myInitConstraintsIndentParentMethod);
} else if (constraints.getIndent() != 0) {
generator.push(constraints.getIndent());
generator.invokeConstructor(myGridConstraintsType, myInitConstraintsIndentMethod);
} else {
generator.invokeConstructor(myGridConstraintsType, myInitConstraintsMethod);
}
}
use of com.intellij.uiDesigner.core.GridConstraints in project intellij-plugins by JetBrains.
the class DartGeneratorPeer method startLoadingTemplates.
private void startLoadingTemplates() {
myLoadingTemplatesPanel.setVisible(true);
myLoadingTemplatesPanel.setPreferredSize(myLoadedTemplatesPanel.getPreferredSize());
myLoadedTemplatesPanel.setVisible(false);
// until loaded
myCreateSampleProjectCheckBox.setSelected(false);
final AsyncProcessIcon asyncProcessIcon = new AsyncProcessIcon("Dart project templates loading");
// defaults are ok: row = 0, column = 0
myLoadingTemplatesPanel.add(asyncProcessIcon, new GridConstraints());
asyncProcessIcon.resume();
ApplicationManager.getApplication().executeOnPooledThread(() -> {
final String sdkPath = mySdkPathComboWithBrowse.getComboBox().getEditor().getItem().toString().trim();
DartProjectTemplate.loadTemplatesAsync(sdkPath, templates -> {
asyncProcessIcon.suspend();
Disposer.dispose(asyncProcessIcon);
onTemplatesLoaded(templates);
});
});
}
use of com.intellij.uiDesigner.core.GridConstraints in project android by JetBrains.
the class InspectorPanelTest method findComponents.
@NotNull
private static Multimap<Integer, Component> findComponents(@NotNull InspectorPanel inspector) {
Multimap<Integer, Component> components = ArrayListMultimap.create();
JPanel panel = (JPanel) inspector.getComponent(0);
GridLayoutManager layout = (GridLayoutManager) panel.getLayout();
for (Component component : panel.getComponents()) {
GridConstraints constraints = layout.getConstraintsForComponent(component);
int row = constraints.getRow();
components.put(row, component);
}
return components;
}
Aggregations