Menu
  • HOME
  • TAGS

Make GWT Flextable column resizeable

Tag: gwt,resize,flextable

I'm trying to make my flextables columns resizeable. So the user can decide how width a column should be. One solution is to use css resize property but this doesn't work in IE. Does someone has an idea how to make this working in IE?

My idea was to catch the onBrowserEvent and register some mousehandlers but I don't get the right element to resize.

I hove you can help me. Thanks in advance!

Best How To :

Hi I found a solution for my own. Maybe this can help someone.

 public class ResizableFlexTable
    extends FlexTable
{
  private int mouseDownX;
  private boolean mouseDown;
  private int columnWidth;
  private TableCellElement headerElem;
  private int column;
  private ResizeMode resizeMode;

  /**
   * 
   */
  public ResizableFlexTable()
  {
    super();
    sinkEvents( Event.ONMOUSEMOVE );
    sinkEvents( Event.ONMOUSEDOWN );
    sinkEvents( Event.ONMOUSEUP );
    sinkEvents( Event.ONCLICK );
    Event.setEventListener( getElement(), this );
  }

  @Override
  public void onBrowserEvent( Event event )
  {
    if ( event.getType().equals( "change" ) )
    {
      super.onBrowserEvent( event );
      return;
    }

    boolean eventMouseUp = event.getType().equals( "mouseup" );
    boolean eventClick = event.getType().equals( "click" );
    boolean eventMouseDown = event.getType().equals( "mousedown" );
    boolean eventMouseMove = event.getType().equals( "mousemove" );

    if ( eventMouseUp )
    {
      mouseDownX = -1;
      mouseDown = false;
    }
    if ( resizeMode == ResizeMode.RESIZING && eventClick )
    {
      resizeMode = ResizeMode.ENDING;
    }

    TableCellElement tableCellElement = findNearestParentCell( (Element) event.getEventTarget()
        .cast() );
    if ( tableCellElement == null )
    {
      super.onBrowserEvent( event );
      return;
    }

    Element trElem = tableCellElement.getParentElement();
    if ( trElem == null )
    {
      super.onBrowserEvent( event );
      return;
    }
    TableRowElement tr = TableRowElement.as( trElem );
    // Element sectionElem = tr.getParentElement();
    if ( tr == null )
    {
      super.onBrowserEvent( event );
      return;
    }

    int col = tableCellElement.getCellIndex();
    if ( tr == getTableHeadElement() )
    {
      int mouseX = event.getClientX();
      int right = tableCellElement.getAbsoluteLeft() + tableCellElement.getOffsetWidth();
      if ( !mouseDown && eventMouseDown )
      {
        if ( mouseX <= right && mouseX >= right - 10 )
        {
          headerElem = tableCellElement;
          column = col;
          mouseDownX = event.getClientX();
          mouseDown = true;
          columnWidth = headerElem.getOffsetWidth();
        }
      }
      else if ( eventMouseMove )
      {
        if ( mouseDown || mouseX <= right && mouseX >= right - 10 )
        {
          tableCellElement.getStyle().setCursor( Cursor.COL_RESIZE );
        }
        else
        {
          tableCellElement.getStyle().setCursor( Cursor.AUTO );
        }
      }
    }
    else
    {
      super.onBrowserEvent( event );
    }

    if ( headerElem != null && eventMouseMove && mouseDown )
    {
      int move = event.getClientX() - mouseDownX;
      @SuppressWarnings ( "hiding")
      int columnWidth = this.columnWidth + move;
      if ( columnWidth > 24 )
      {
        getColumnFormatter().getElement( column ).setAttribute( "width", columnWidth + "px" );
        resizeMode = ResizeMode.RESIZING;
      }
    }

    if ( resizeMode != ResizeMode.RESIZING && resizeMode != ResizeMode.ENDING && eventClick )
    {
      super.onBrowserEvent( event );
    }
    else if ( resizeMode == ResizeMode.ENDING )
    {
      resizeMode = ResizeMode.NO;
    }
  }

  /**
   * @return
   */
  private TableRowElement getTableHeadElement()
  {
    TableRowElement row = getRowFormatter().getElement( 0 ).cast();
    return row;
  }

  /**
   * Diese Methode ist 1 zu 1 aus der Oberklasse übernommen. Nicht ändern!!!
   */
  private TableCellElement findNearestParentCell( Element elem )
  {
    while ( (elem != null) && (elem != getElement()) )
    {
      String tagName = elem.getTagName();
      if ( "td".equalsIgnoreCase( tagName ) || "th".equalsIgnoreCase( tagName ) )
      {
        return elem.cast();
      }
      elem = elem.getParentElement();
    }
    return null;
  }
}

This is not very nice but it works for me.

ListGrid / ListGridField - Hover message while editing

gwt,smartgwt

You should be able to manipulate the properties of the editor that is created when you enter edit mode for a field through an appropriate FormItem and the ListGridField.setEditorProperties(FormItem editorProperties) method. For example, if your field is storing texts, you shall create a TextItem and define the hover text using...

How to get gwt jars version information if it is not available in manifest file?

java,gwt,jar

GWT provides the information in several ways: gwt-dev.jar contains a com/google/gwt/dev/About.properties you can launch the gwt-dev.jar (java -jar gwt-dev.jar, or java -cp gwt-dev.jar com.google.gwt.dev.Compiler, and it'll give you the version information) the version is also available into the generated JS, and/or accessible from client code using GWT.getVersion() ...

PlayN and Firefox issues

facebook,firefox,gwt,game-engine,playn

Ok, here is why TextLayout is moved up: FF bugzilla Also after a lot of googling it seems that drawing on canvas has performance issues in FF....

Need to validate GXT DateFields dateTo must be older than dateFrom

validation,date,gwt,gxt

The solution to the problem is here: @UiHandler("dateFrom") void dateFromChange(ValueChangeEvent<Date> event){ dateFrom.addValidator(new MaxDateValidator(dateTo.getValue())); } ...

Python Resize Multiple images ask user to continue

python,xml,image,resize

Change your final loop to: for idx, image in enumerate(imgPath): #img resizing goes here count_remaining = len(imgPath) - (idx+1) if count_remaining > 0: print("There are {} images left to resize.".format(count_remaining)) response = input("Resize image #{}? (Y/N)".format(idx+2)) #use `raw_input` in place of `input` for Python 2.7 and below if response.lower() !=...

JavaFX: How to resize button containing svg image

java,svg,javafx,resize

SVG images can be re-size themselves and fit its container. You can re-size the button and the SVG image will fit its boundary. Button button = new Button(); button.setGraphic(svg); // Re-size the button button.setScaleX(0.5); button.setScaleY(0.5); EDIT - To resize buttons according to the parent. If you want to re-size button...

“Development mode is loading…” and “Waiting for launch URLs” in GWT

java,gwt,google-plugin-eclipse

Both errors (missing gwt-codeserver, and unknown argument) hint that the Google Plugin for Eclipse didn't properly detect the version of the GWT SDK you're using. GWT 2.3 is now really old, so I'd suggest trying with GWT 2.7. As you're beginning with GWT, it's also better to start right with...

HibernateException: Could not instantiate dialect class when using HTTPS for GWT

hibernate,ssl,gwt

When you use -server :ssl then you no longer use the AppEngineLauncher, so class loading is different; with a parent class loader using the classpath (AppEngine only uses WEB-INF/{classes,lib}); this is what causes the ClassCastException. Try removing your server dependencies from the DevMode classpath as a starting point; leaving them...

hide element based on width

jquery,resize,width,hide

Try this: jQuery('.wp-caption-text').each(function(i, el){ if (jQuery(this).width() <= 300) { jQuery(this).addClass('caption-none'); } }); ...

Constraining HandsOnTable to the size of its parent container

resize,handsontable,sizing

Unfortunately the red isn't showing in the fiddle but I think what you want is the stretchH:"all" property. This ensures that if you set a width on the parent container, it will stretch all columns to fill it 100%. After that, you want to set the style of the container...

GWT/Hibernate: java.lang.NoClassDefFoundError: org/hibernate/Interceptor

java,hibernate,maven,gwt

Maven Eclipse plugin will by default add your dependencies to the Eclipse project classpath. It is not aware of any custom build/packaging/deployment scenarios unless you explicitly configure it for the use cases you need. Maybe this question can be helpful in your use case. This article explains how to configure...

GwtMockito - click handlers for many buttons

java,gwt,gwtmockito

Let's read that code together: whenever getClearButton() or getChangeStatusButton() is called, return this.button; that is, the very same button for both method calls, which means you won't be able to tell which is which: it's just the same. whenever addClickHandler is called on that mock button, store the click handler...

Set log4j.properties for GWT

eclipse,gwt,log4j

GWT doesn't create anything in WEB-INF/classes; it only generates JavaScript (and possibly CSS, PNG, etc.) files in a subfolder (named after your compiled module) of the output directory (generally where the WEB-INF/classes also is, but that's just because several things are configured with the same output directory). The log4j.properties you...

Oracle XE data limit reached - how to reduce tablespace size?

oracle,oracle11g,resize,tablespace,data-files

I would do a full database export, drop the tablespace, create a new tablespace with a smaller size and import back into it

Setting Full Width to WPF Image in C#

c#,wpf,design,resize

<Grid Name="grid1"> <Grid.RowDefinitions> <RowDefinition Height="70*" /> <RowDefinition Height="30*" /> </Grid.RowDefinitions> <Image Grid.Row="0" Source="c://a.png" Stretch="Fill" /> <StackPanel Grid.Row="1" > .... </StackPanel> </Grid> ...

Javascript injection overriding CSS for responsive slider

javascript,jquery,html,css,resize

This only seems to be a problem when you are actively re-sizing the browser window with your mouse. This plugin seems to be putting an inline style with a static height on the #hompage-slider_content when it loads. When you scale you browser window down past the 980px mark then reload...

How to group fields to get one change value handler

java,gwt

I think you can achieve more or less the same behavior by registering the same handler on both filterItemName and filterItemAmount : ChangeHandler handler = new ChangeHandler() {...} this.display.getFilterItemAmount().addChangeHandler(handler); this.display.getFilterItemName().addChangeHandler(handler); ...

window.getSelection() Does Not Work When Run Via JSNI and On IE

gwt,jsni

Make sure that your iframe's contentWindow is not losing focus. IE can't deal with these situations as elegantly as others. Try: // windowEl is the contentWindow of an iframe protected native Element insertImage(String src, String title, String cssClassname, Element windowEl) /*-{ var result = null; windowEl.focus(); // ***** add this...

“Tainted canvases may not be loaded” Cross domain issue with WebGL textures

google-chrome,gwt,libgdx,html5-canvas,webgl

are you setting the crossOrigin attribute on your img before requesting it? var img = new Image(); img.crossOrigin = "anonymous"; img.src = "https://graph.facebook.com/1387819034852828/picture?width=150&height=150"; It's working for me var img = new Image(); img.crossOrigin = "anonymous"; // COMMENT OUT TO SEE IT FAIL img.onload = uploadTex; img.src = "https://graph.facebook.com/1387819034852828/picture?width=150&height=150"; function uploadTex()...

Resize a UITableView

swift,uitableview,resize,frame

My first guess was that you were using AutoLayout. Changes to view frames often don't have any effect in that case. Have you double-checked to make sure it's turned off for you storyboard? Failing that, the most likely cause of changing having no effect is broken outlets. Add a println...

Transfer content from one DIV to another whenever window resizes

javascript,jquery,html,css,resize

$(function() { var content = $('.source').html(); function transferContent() { if ($(this).height() < 500) { $(".target").html(content); $(".source").empty(); } else{ $(".source").html(content); $(".target").empty(); } } $(window).on("resize", transferContent); }); .target { background-color: black; height: 100px; width: 100px; color: white } .source { color: white; background-color: brown } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> <div class="target"></div> <div...

Why is my array of struct not resizing with Array.Resize?

c#,arrays,struct,resize,streamwriter

You need to declare your method in the following way: static void addClassMates(ref classMates[] classMateInfo) Notice the ref for the parameter....

Error on running “adb shell wm density 240” for changing Android device density

android,resize,screen,adb

I changed it to: adb shell am display-size 800x480 and it worked...

Responsive Video Window resize (possible js / jquery conflict)

javascript,jquery,html5,video,resize

Use jQuery resize() Here is a fiddle with the resize working: https://jsfiddle.net/b6fncgwg/ The key is using .html() to change the html of your background/video div. $(window).resize(function () { changeBackground(); }); changeBackground(); function changeBackground(){ var viewportWidth = $(window).width(); if (viewportWidth < 767) { $("#video-bg").html('<video autoplay nomuted loop preload="none" poster="http://research.loginsecuretest.eu/loginsecurecmp/background//images/clientvideos/small.jpg" id="bgvid-SMARTPHONE"><source...

java.lang.NoSuchMethodError: com.google.gwt.util.tools.Utility.versionCompare - Google Web Toolkit SDK 2.6.0

java,gwt,eclipse-plugin

If this is a Maven project, then M2Eclipse and the Google Plugin for Eclipse should auto-configure the project to use the GWT referenced from your POM, and not the one you could have installed in your Eclipse. So the problem is that you have GWT 2.6 on the classpath; your...

Why Intellij deletes obsolete files when trying to run DevMode?

java,gwt,intellij-idea

After sending a request to Intellij support team, they gave me the following answer: Adding the following two lines to the IDEA_HOME/bin/idea.properties file: idea.gwt.clear.unit.cache.before.run=false idea.gwt.clean.files.created.by.dev.mode=false Which makes sense, because the only thing I need is to prevent Intellij from deleting my local cached files. Problem solved....

How to select the specific element using HtmlUnit with java?

java,gwt,xpath,htmlunit

You are looking for a div element instead of span. Change your xpath to this: //span[@class='x-tree3-node-text'] Furthermore if you want to find an element by its value use this xpath: //span[text()="OCP"] ...

Replacing the FileService Api to create a Blob file in server side

java,google-app-engine,gwt,google-cloud-storage,blobstore

Since the Blobstore is near to the permanent shutdown, you need to starts using Google Cloud Storage. The Google Cloud Storage Client Library is fully integrated for App Engine, making easy the migration to another API. After you saved an object to Cloud Storage, you can generated a BlobKey starting...

GWT - Could not get type signature for class

java,gwt

I have tried changing the type declaration, adding Serialization, switching to IsSerializible, and nothing works! You missed one: you must have a default (zero-arg) constructor, or a new instance can't be created. The deserialization process creates an object then assigns the fields. I believe you can make this constructor...

GXT MessageBox with scrollable content

html,css,gwt,gxt

It turns out that I was quite near to a solution : the idea is to let the MessageBox adapt its size to the content, and then to fix the size of the ScrollPanel like this : HTML content = new HTML(StacktraceTemplate.RENDERER.render(stackTrace)); ScrollPanel container = new ScrollPanel(content); container.setHeight("700px"); HTMLPanel panel...

Resize ALL images in WebView with Text Autosizing

image,webview,resize,width

Ok, so I solved this one myself: // Content to be rendered content = "<p>Some Html </p> with <img></img> tags"; // Set width and height content = content.replace("<img", "<img height=\"auto\" width=\"100%\" "); // Render wv.loadDataWithBaseURL("", content, "text/html", "UTF-8", ""); and Voila, full width images with preserved Aspect Ratios!...

Making JPanel dynamically fit into JDialog

java,swing,resize

You probably want to change this: f.add(stable,BorderLayout.NORTH); to this: f.add(stable, BorderLayout.CENTER); A JScrollPane should be placed in the center of a BorderLayout, since the center component will stretch both horizontally and vertically when the parent is resized. The edge components stretch in one dimension only, which is not usually the...

GWT syncProxy: createProxy MethodNotSupportedException

java,eclipse,gwt,gwt-syncproxy

Just to verify, you are creating a Java eclipse project (not Android)? Assuming as much, then make sure you also include the gwt-user-2.7.0 and gwt-dev-2.7.0 jar's in your classpath. In regard's to Lev's answer, the MethodNotSupportedException class is actually in the gwt-dev-2.7.0 jar, so you do not necessarily need to...

Is there a single DateTime Picker component for gwt?

java,date,datetime,gwt

This picker might suit your needs, further answers can be found regarding this familiar question.

How to transform elements to widgets?

java,gwt,gwt-widgets

try with something like FlowPanel panel = new FlowPanel(); HTML wrap = new HTML().wrap(myElement); panel.add(wrap); RootPanel.get().add(panel); note : the FlowPanel is not strictly necessary. It adds a <div> around your elements (and HTML.wrap() will add one too). A panel could be helpful if you want to group elements/widgets together....

Specify Library Target of Maven

xml,eclipse,maven,gwt

It looks like you're trying to bend Maven to do things differently than what it expects you to do (e.g. here use war both as input and output folder). As a rule of thumb, never try to fight with Maven, you'll lose eventually. Follow the (almost-undocumented) Maven Way™ or just...

Grid with rows in anchor not visible in GWT (UIBinder)

java,html,gwt,grid,uibinder

You create your ticketTable and your links with UiBinder (createAndBindUi) and then you create a new Grid (re-assigning the ticketTable field BTW) and move your links to it (setWidget), but you never actually use that Grid anywhere. So, basically, you've moved your links to somewhere that's never displayed, so they...

AutoLayout for UICollectionView Cells

objective-c,iphone,resize,autolayout,uicollectionviewcell

After set auto layout for UIImageView to make sure that UIImageView will fit to cell and make the adjustments to the cell size from there - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { int cellWidth = (SCREEN_WIDTH - (3 * PADDING)) / 4; return CGSizeMake(cellWidth, cellWidth); } ...

Adding same widget to two panel causing issue

java,gwt

Your panel subVP isn't added to anything, and when the box is added to subVP, it is removed from mainVP. Widgets can only be one place at a time. -- (adding more detail for the comment posted) This is part of the basic assumption of how a widget works -...

The import javax.ws cannot be resolved with GWT on Eclispe

java,eclipse,gwt,import

With GWT you cannot use all Java libraries available for server side Java. You are restricted to a small JRE emulation subset. As a consequence you cannot use any librariy using standard Java classes outside of the emulation subset. Often there are special GWT libraries for the same purpose. You...

Best way to resize top banner images (viewport/html)

javascript,html,css,image,resize

Using the solution of Saumil Soni, Germano Plebani and http://stephen.io/mediaqueries/, I reach the following solution (thank you guys!): /* TOP BANNER */ /* For mobile phones: */ @media only screen and (max-width: 414px) and (orientation : portrait) { .tp-banner { background-image: url(../images/style/slider/slide414x736.jpg); background-size: cover; } } @media only screen and...

History token fires twice if the URLhas a special character in IE

java,internet-explorer,gwt

IE 11 isn't officially supported in GWT 2.5.1 (I couldn't even tell which permutation is selected in this case; and it depends on X-UA-Compatible). Try updating to GWT 2.7.0, where IE11 has been tested, and should select the gecko1_8 permutation....

What Cell,Table can I use to create a grid of only images in every cell, in GWT?

css,gwt,web-applications,grid,cell

You can use a simple FlowPanel as a container, and add each image with a float set to "left". Alternatively, you can use a flex-box model with flex-flow: row wrap on a container. You don't need any widgets for this. This is simple CSS, and it will give you the...

Get HTML elements in GWT

html,user-interface,gwt,uibinder

Got the right answer :- Button button = Button.wrap(Document.get().getElementById("submit")); is working for me....

GWT Eclipse: using classes from other projects cause "Server class … could not be found in the web app, but was found on the system classpath

java,eclipse,gwt

The details depend on your build tool and/or IDE, but the goal is to have all server-side classes in the webapp's WEB-INF (either in WEB-INF/classes, which is probably the case for your GWT project, or in a JAR in WEB-INF/lib). This will be necessary anyway when deploying the webapp to...

Lazy Loading on a List of Objects using Java?

java,gwt,lazy-loading

You don't need a plugin or a component. You simply attach an event handler to a widget that triggers additional loading requests. It can be a ScrollPanel if you lazy load on scroll down, or a Button/Label (e.g. "Show more"), etc. When this event is triggered, you load and display...

GWT 2.7 Super Dev Mode not working while testing on the same network

gwt,gwt-super-dev-mode

As Thomas pointed out, the problem I had was that from GWT 2.6 onwards, if you want to test from other devices in the same network, you have to whitelist the addresses you'll be using in each *.gwt.xml file using a command line like this: <set-configuration-property name="devModeUrlWhitelistRegexp" value="http://(localhost|127\.0\.0\.1|192\.168\.150\.(\d{1,3}))(:\d+)?/?.*" /> I...

In GWT project CellTable created with using AsyncDataProvider, isn't showed

java,gwt,gwt-rpc,celltable,asynccallback

Your CellTable has a height of zero. This is why you don't see it. You either have to set height of your CellTable in code, or you should add it to a widget that implements ProvidesResize interface, like a LayoutPanel....

How to calculate difference in days between two dateboxes in GWT? [duplicate]

java,date,gwt,datebox

The simplest way: Date currentDate = new Date(); int daysBetween = CalendarUtil.getDaysBetween(myDatePicker.getValue(), currentDate); ...

Replacement for GWT

java,gwt,client-server

Check OpenXava it's easy to use. http://www.openxava.org/ate/gwt-alternative