Package edu.mit.csail.sdg.alloy4

Examples of edu.mit.csail.sdg.alloy4.OurCombobox


            toolbar.add(runbutton=OurUtil.button("Execute", "Executes the latest command", "images/24_execute.gif", doExecuteLatest()));
            toolbar.add(stopbutton=OurUtil.button("Stop", "Stops the current analysis", "images/24_execute_abort2.gif", doStop(2)));
            stopbutton.setVisible(false);
            toolbar.add(showbutton=OurUtil.button("Show", "Shows the latest instance", "images/24_graph.gif", doShowLatest()));
            toolbar.add(Box.createHorizontalGlue());
            toolbar.setBorder(new OurBorder(false,false,false,false));
        } finally {
            wrap = false;
        }

        // Choose the antiAlias setting
        OurAntiAlias.enableAntiAlias(AntiAlias.get());

        // Create the message area
        logpane = OurUtil.scrollpane(null);
        log = new SwingLogPanel(logpane, fontName, fontSize, background, Color.BLACK, new Color(.7f,.2f,.2f), this);

        // Create the text area
        text = new OurTabbedSyntaxWidget(fontName, fontSize, TabSize.get());
        text.listeners.add(this);
        text.enableSyntax(! SyntaxDisabled.get());

        // Add everything to the frame, then display the frame
        Container all=frame.getContentPane();
        all.setLayout(new BorderLayout());
        all.removeAll();
        JPanel lefthalf=new JPanel();
        lefthalf.setLayout(new BorderLayout());
        lefthalf.add(toolbar, BorderLayout.NORTH);
        text.addTo(lefthalf, BorderLayout.CENTER);
        splitpane = OurUtil.splitpane(JSplitPane.HORIZONTAL_SPLIT, lefthalf, logpane, width/2);
        splitpane.setResizeWeight(0.5D);
        status = OurUtil.make(OurAntiAlias.label(" "), new Font(fontName, Font.PLAIN, fontSize), Color.BLACK, background);
        status.setBorder(new OurBorder(true,false,false,false));
        all.add(splitpane, BorderLayout.CENTER);
        all.add(status, BorderLayout.SOUTH);

        // Generate some informative log messages
        log.logBold("Alloy Analyzer "+Version.version()+" (build date: "+Version.buildDate()+")\n\n");
View Full Code Here


        final String JAR = Util.jarPrefix();
        String alloytxt;
        try { alloytxt = Util.readAll(JAR + "LICENSES" + File.separator + "Alloy.txt"); } catch(IOException ex) { return null; }
        final JTextArea text = OurUtil.textarea(alloytxt, 15, 85, false, false, new EmptyBorder(2, 2, 2, 2), new Font("Monospaced", Font.PLAIN, 12));
        final JScrollPane scroll = OurUtil.scrollpane(text, new LineBorder(Color.DARK_GRAY, 1));
        final JComboBox combo = new OurCombobox(new String[]{"Alloy","Kodkod","JavaCup","SAT4J","ZChaff","MiniSat"}) {
            private static final long serialVersionUID = 0;
            @Override public void do_changed(Object value) {
              if (value instanceof String) {
                 try {
                     String content = Util.readAll(JAR + "LICENSES" + File.separator + value + ".txt");
View Full Code Here

         @Override public void focusLost(FocusEvent e) { vizState.label.put(elt, labelText.getText()); }
      });
      final AlloyModel model = vizState.getCurrentModel();
      final AlloyNodeElement elt2;
      if (elt instanceof AlloyType) elt2=model.getSuperType((AlloyType)elt); else if (elt instanceof AlloySet) elt2=((AlloySet)elt).getType(); else elt2=null;
      JComboBox color = new OurCombobox(true, DotColor.valuesWithout(DotColor.MAGIC), 100, 35, vizState.nodeColor.get(elt)) {
         private static final long serialVersionUID = 0;
         @Override public String do_getText(Object value) { if (value==null) return "Inherit"; else return ((DotColor)value).getDisplayedText(); }
         @Override public Icon   do_getIcon(Object value) { if (value==null) value=vizState.nodeColor.resolve(elt2); return value==null ? null : ((DotColor)value).getIcon(vizState.getNodePalette()); }
         @Override public void   do_changed(Object value) { vizState.nodeColor.put(elt, (DotColor)value); }
      };
      JComboBox shape = new OurCombobox(true, DotShape.values(), 125, 35, vizState.shape.get(elt)) {
         private static final long serialVersionUID = 0;
         @Override public String do_getText(Object value) { if (value==null) return "Inherit"; else return ((DotShape)value).getDisplayedText(); }
         @Override public Icon   do_getIcon(Object value) { if (value==null) value=vizState.shape.resolve(elt2); return value==null ? null : ((DotShape)value).getIcon(); }
         @Override public void   do_changed(Object value) { vizState.shape.put(elt, (DotShape)value); }
      };
      JComboBox style = new OurCombobox(true, DotStyle.values(), 95, 35, vizState.nodeStyle.get(elt)) {
         private static final long serialVersionUID = 0;
         @Override public String do_getText(Object value) { if (value==null) return "Inherit"; else return ((DotStyle)value).getDisplayedText(); }
         @Override public Icon   do_getIcon(Object value) { if (value==null) value=vizState.nodeStyle.resolve(elt2); return value==null ? null : ((DotStyle)value).getIcon(); }
         @Override public void   do_changed(Object value) { vizState.nodeStyle.put(elt, (DotStyle)value); }
      };
      //
      answer.add(OurUtil.makeH(10, labelText, wcolor, color, style, shape, 2, null));
      if (elt instanceof AlloyType) {
         JPanel vis = vizState.nodeVisible    .pick(elt, "Show",                   "Display members as nodes");
         JPanel con = vizState.hideUnconnected.pick(elt, "Hide unconnected nodes", "Hide nodes without arcs");
         JPanel num = vizState.number         .pick(elt, "Number nodes",           "Attach atom number to node label as suffix");
         JPanel proj = null;
         if (vizState.canProject((AlloyType)elt))
            proj = new OurCheckbox("Project over this sig", "Click here to " + (enabled?"":"un") + "project over this signature", enabled ? OurCheckbox.ALL_OFF : OurCheckbox.ALL_ON) {
            private static final long serialVersionUID = 0;
            public Icon do_action() {
               if (enabled) projectAlloyType((AlloyType)elt); else deprojectAlloyType((AlloyType)elt);
               lastElement = elt;
               return enabled ? ALL_ON : ALL_OFF;
            }
         };
         labelText.setEnabled(enabled && !vizState.useOriginalName());
         color.setEnabled(enabled);
         shape.setEnabled(enabled);
         style.setEnabled(enabled);
         vis.setEnabled(enabled);
         con.setEnabled(enabled);
         num.setEnabled(enabled && !vizState.useOriginalName());
         JPanel a=OurUtil.makeVR(wcolor,vis,num),b;
         if (proj!=null) b=OurUtil.makeVR(wcolor, con, proj); else b=OurUtil.makeVR(wcolor, con);
View Full Code Here

      });
      JPanel weightPanel = OurUtil.makeH(weightLabel, 5, weightSpinner);
      weightPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
      weightPanel.setAlignmentY(0.5f);
      weightPanel.setToolTipText("A higher weight will cause the edge to be shorter and straighter.");
      OurCombobox color = new OurCombobox(true, DotColor.valuesWithout(DotColor.WHITE), 110, 35, vizState.edgeColor.get(rel)) {
         private static final long serialVersionUID = 0;
         @Override public String do_getText(Object value) { return value==null ? "Inherit" : ((DotColor)value).getDisplayedText(); }
         @Override public Icon   do_getIcon(Object value) { if (value==null) value=vizState.edgeColor.get(null); return value==null ? null : ((DotColor)value).getIcon(vizState.getEdgePalette()); }
         @Override public void   do_changed(Object value) { vizState.edgeColor.put(rel, (DotColor)value); }
      };
      OurCombobox style = new OurCombobox(true, DotStyle.values(), 105, 35, vizState.edgeStyle.get(rel)) {
         private static final long serialVersionUID = 0;
         @Override public String do_getText(Object value) { return value==null ? "Inherit" : ((DotStyle)value).getDisplayedText(); }
         @Override public Icon   do_getIcon(Object value) { if (value==null) value=vizState.edgeStyle.get(null); return value==null ? null : ((DotStyle)value).getIcon(); }
         @Override public void   do_changed(Object value) { vizState.edgeStyle.put(rel, (DotStyle)value); }
      };
View Full Code Here

      JLabel eLabel = OurUtil.label("Edge Color Palette:");
      JLabel aLabel = OurUtil.label("Use original atom names:");
      JLabel pLabel = OurUtil.label("Hide private sigs/relations:");
      JLabel mLabel = OurUtil.label("Hide meta sigs/relations:");
      JLabel fLabel = OurUtil.label("Font Size:");
      JComboBox fontSize = new OurCombobox(false, fontSizes.toArray(), 60, 32, vizState.getFontSize()) {
         private static final long serialVersionUID = 0;
         @Override public void do_changed(Object value) { if (fontSizes.contains(value)) vizState.setFontSize((Integer)value); }
      };
      JComboBox nodepal = new OurCombobox(false, DotPalette.values(), 100, 32, vizState.getNodePalette()) {
         private static final long serialVersionUID = 0;
         @Override public String do_getText(Object value) { return ((DotPalette)value).getDisplayedText(); }
         @Override public void   do_changed(Object value) { vizState.setNodePalette((DotPalette)value); }
      };
      JComboBox edgepal = new OurCombobox(false, DotPalette.values(), 100, 32, vizState.getEdgePalette()) {
         private static final long serialVersionUID = 0;
         @Override public String do_getText(Object value) { return ((DotPalette)value).getDisplayedText(); }
         @Override public void   do_changed(Object value) { vizState.setEdgePalette((DotPalette)value); }
      };
      JPanel name = new OurCheckbox("", "Whether the visualizer should use the original atom names as-is.", vizState.useOriginalName() ? OurCheckbox.ON : OurCheckbox.OFF) {
View Full Code Here

   //=============================================================================================================//

   /** Generates the "default type and set settings" widgets, and add them to "parent". */
   private void createDefaultNodeWidget(JPanel parent) {
      JComboBox color = new OurCombobox(false, DotColor.valuesWithout(DotColor.MAGIC), 110, 35, vizState.nodeColor.get(null)) {
         private static final long serialVersionUID = 0;
         @Override public String do_getText(Object value) { return ((DotColor)value).getDisplayedText(); }
         @Override public Icon   do_getIcon(Object value) { return ((DotColor)value).getIcon(vizState.getNodePalette()); }
         @Override public void   do_changed(Object value) { vizState.nodeColor.put(null, (DotColor)value); }
      };
      JComboBox shape = new OurCombobox(false, DotShape.values(), 135, 35, vizState.shape.get(null)) {
         private static final long serialVersionUID = 0;
         @Override public String do_getText(Object value) { return ((DotShape)value).getDisplayedText(); }
         @Override public Icon   do_getIcon(Object value) { return ((DotShape)value).getIcon(); }
         @Override public void   do_changed(Object value) { vizState.shape.put(null, (DotShape)value); }
      };
      JComboBox style = new OurCombobox(false, DotStyle.values(), 110, 35, vizState.nodeStyle.get(null)) {
         private static final long serialVersionUID = 0;
         @Override public String do_getText(Object value) { return ((DotStyle)value).getDisplayedText(); }
         @Override public Icon   do_getIcon(Object value) { return ((DotStyle)value).getIcon(); }
         @Override public void   do_changed(Object value) { vizState.nodeStyle.put(null, (DotStyle)value); }
      };
View Full Code Here

   //=============================================================================================================//

   /** Generates the "default relation settings" widgets, and add them to "parent". */
   private void createDefaultEdgeWidget(JPanel parent) {
      JComboBox colorComboE = new OurCombobox(false, DotColor.valuesWithout(DotColor.WHITE), 110, 35, vizState.edgeColor.get(null)) {
         private static final long serialVersionUID = 0;
         @Override public String do_getText(Object value) { return ((DotColor)value).getDisplayedText(); }
         @Override public Icon   do_getIcon(Object value) { return ((DotColor)value).getIcon(vizState.getEdgePalette()); }
         @Override public void   do_changed(Object value) { vizState.edgeColor.put(null, (DotColor)value); }
      };
      JComboBox outlineComboE = new OurCombobox(false, DotStyle.values(), 110, 35, vizState.edgeStyle.get(null)) {
         private static final long serialVersionUID = 0;
         @Override public String do_getText(Object value) { return ((DotStyle)value).getDisplayedText(); }
         @Override public Icon   do_getIcon(Object value) { return ((DotStyle)value).getIcon(); }
         @Override public void   do_changed(Object value) { vizState.edgeStyle.put(null, (DotStyle)value); }
      };
View Full Code Here

            atomnames[i]=this.atoms.get(i).getVizName(vizState,true);
            if (this.atoms.get(i).equals(initialValue)) initialIndex=i;
         }
         add(left = new JButton("<<"));
         add(Box.createRigidArea(new Dimension(2,2)));
         add(atomCombo = new OurCombobox(atomnames.length<1 ? new String[]{" "} : atomnames));
         add(Box.createRigidArea(new Dimension(2,2)));
         add(right = new JButton(">>"));
         left.setVerticalAlignment(SwingConstants.CENTER);
         right.setVerticalAlignment(SwingConstants.CENTER);
         Dimension dim = atomCombo.getPreferredSize();
View Full Code Here

    /** Updates the status bar at the bottom of the screen. */
    private Runner notifyChange() {
        if (wrap) return wrapMe();
        commands=null;
        if (text==null) return null; // If this was called prior to the "text" being fully initialized
        OurSyntaxWidget t = text.get();
        if (Util.onMac()) frame.getRootPane().putClientProperty("windowModified", Boolean.valueOf(t.modified()));
        if (t.isFile()) frame.setTitle(t.getFilename()); else frame.setTitle("Alloy Analyzer "+Version.version());
        toolbar.setBorder(new OurBorder(false, false, text.count()<=1, false));
        int c = t.getCaret();
        int y = t.getLineOfOffset(c)+1;
        int x = c - t.getLineStartOffset(y-1)+1;
        status.setText("<html>&nbsp; Line "+y+", Column "+x
              +(t.modified()?" <b style=\"color:#B43333;\">[modified]</b></html>":"</html>"));
        return null;
    }
View Full Code Here

    /** This method performs Edit->FindNext. */
    private Runner doFindNext() {
        if (wrap) return wrapMe();
        if (lastFind.length()==0) return null;
        OurSyntaxWidget t = text.get();
        String all = t.getText();
        int i = Util.indexOf(all, lastFind, t.getCaret()+(lastFindForward?0:-1),lastFindForward,lastFindCaseSensitive);
        if (i<0) {
            i=Util.indexOf(all, lastFind, lastFindForward?0:(all.length()-1), lastFindForward, lastFindCaseSensitive);
            if (i<0) { log.logRed("The specified search string cannot be found."); return null; }
            log.logRed("Search wrapped.");
        } else {
            log.clearError();
        }
        if (lastFindForward) t.moveCaret(i, i+lastFind.length()); else t.moveCaret(i+lastFind.length(), i);
        t.requestFocusInWindow();
        return null;
    }
View Full Code Here

TOP

Related Classes of edu.mit.csail.sdg.alloy4.OurCombobox

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.